Skip to content

Authorization

The Octeth API supports two authentication methods and two permission scopes.

Authentication Methods

Permanent authentication for automated integrations.

bash
curl https://your-domain.com/api.php \
  -F "ResponseFormat=JSON" \
  -F "Command=List.Create" \
  -F "APIKey=your-api-key" \
  -F "SubscriberListName=Newsletter"

Get your API key:

  • User API Key: User Dashboard → Settings → API Keys
  • Admin API Key: Admin Area → Settings → Account → API tab

Session ID

Temporary authentication for interactive applications.

bash
# User login
curl https://your-domain.com/api.php \
  -F "ResponseFormat=JSON" \
  -F "Command=User.Login" \
  -F "Username=user@example.com" \
  -F "Password=password" \
  -F "DisableCaptcha=true"

# Returns: {"SessionID": "abc123..."}

# Use session in subsequent calls
curl https://your-domain.com/api.php \
  -F "ResponseFormat=JSON" \
  -F "Command=List.Create" \
  -F "SessionID=abc123..." \
  -F "SubscriberListName=Newsletter"

Permission Scopes

User Scope

Access to marketing operations.

ParameterMethodAccess
APIKeyAPI KeyLists, campaigns, subscribers, emails
SessionIDSessionSame as API Key

Login options:

bash
# With username/password
curl https://your-domain.com/api.php \
  -F "ResponseFormat=JSON" \
  -F "Command=User.Login" \
  -F "Username=user@example.com" \
  -F "Password=password" \
  -F "DisableCaptcha=true"

# With API key (skip password)
curl https://your-domain.com/api.php \
  -F "ResponseFormat=JSON" \
  -F "Command=User.Login" \
  -F "apikey=your-api-key"

# With 2FA
curl https://your-domain.com/api.php \
  -F "ResponseFormat=JSON" \
  -F "Command=User.Login" \
  -F "Username=user@example.com" \
  -F "Password=password" \
  -F "tfacode=123456" \
  -F "DisableCaptcha=true"

Admin Scope

Access to system administration.

ParameterMethodAccess
AdminAPIKeyAPI KeyUsers, system settings, all user data
SessionIDSessionSame as API Key

Login options:

bash
# With username/password
curl https://your-domain.com/api.php \
  -F "ResponseFormat=JSON" \
  -F "Command=Admin.Login" \
  -F "Username=admin" \
  -F "Password=admin-password" \
  -F "DisableCaptcha=true"

# With admin API key (if ADMIN_API_KEY configured)
curl https://your-domain.com/api.php \
  -F "ResponseFormat=JSON" \
  -F "Command=Admin.Login" \
  -F "adminapikey=admin-api-key"

Two-Factor Authentication

When 2FA is enabled, include the verification code:

bash
# User login with 2FA
curl https://your-domain.com/api.php \
  -F "ResponseFormat=JSON" \
  -F "Command=User.Login" \
  -F "Username=user@example.com" \
  -F "Password=password" \
  -F "tfacode=123456" \
  -F "DisableCaptcha=true"

# Using recovery code (disables 2FA)
curl https://your-domain.com/api.php \
  -F "ResponseFormat=JSON" \
  -F "Command=User.Login" \
  -F "Username=user@example.com" \
  -F "Password=password" \
  -F "tfarecoverycode=XXXX-XXXX-XXXX" \
  -F "DisableCaptcha=true"

Response Format

Successful login

json
{
  "Success": true,
  "ErrorCode": 0,
  "SessionID": "abc123...",
  "UserInfo": {
    "UserID": 42,
    "Username": "user@example.com",
    "EmailAddress": "user@example.com",
    "FirstName": "John",
    "LastName": "Doe",
    "GroupInformation": {...}
  }
}

Failed login

json
{
  "Success": false,
  "ErrorCode": 3,
  "ErrorText": "Invalid credentials"
}

Common Error Codes

CodeDescription
1Missing username
2Missing password
3Invalid credentials
5Invalid captcha
6Invalid 2FA code
1012FA required

Parameter Reference

Login Parameters

All login parameters are lowercase:

ParameterDescriptionExample
usernameAccount username or emailuser@example.com
passwordAccount passwordmypassword
apikeyUser API key (skip password)XXXX-XXXX-XXXX
adminapikeyAdmin API keyXXXX-XXXX-XXXX
tfacode2FA verification code123456
tfarecoverycode2FA recovery codeXXXX-XXXX-XXXX
disablecaptchaSkip captcha validationtrue

API Call Parameters

Authentication parameters for API calls are PascalCase:

ParameterScopeDescription
APIKeyUserUser API key
AdminAPIKeyAdminAdmin API key
SessionIDBothSession from login

Best Practices

Use API Keys for automation

php
// Good: API key for automated tasks
$api->call('Campaign.Send', [
    'APIKey' => getenv('OCTETH_API_KEY'),
    'CampaignID' => 123
]);

Use Sessions for user interfaces

javascript
// Good: Session for web apps
const session = await login(username, password);
localStorage.setItem('sessionId', session.SessionID);

// Use session for subsequent calls
await api.call('Lists.Get', {
    SessionID: localStorage.getItem('sessionId')
});

Handle session expiration

python
def api_call(command, data):
    response = make_request(command, data)
    
    if response['ErrorCode'] == 401:  # Session expired
        # Re-authenticate
        session = login()
        data['SessionID'] = session['SessionID']
        response = make_request(command, data)
    
    return response

Secure your credentials

bash
# Store API keys in environment variables
export OCTETH_API_KEY="your-api-key"
export OCTETH_ADMIN_KEY="your-admin-key"

# Use in scripts
curl https://your-domain.com/api.php \
  -F "APIKey=$OCTETH_API_KEY" \
  ...

Testing Your Setup

Quick test to verify authentication:

bash
# Test with API key
curl https://your-domain.com/api.php \
  -F "ResponseFormat=JSON" \
  -F "Command=Lists.Get" \
  -F "APIKey=your-api-key"

# Test with session
curl https://your-domain.com/api.php \
  -F "ResponseFormat=JSON" \
  -F "Command=Lists.Get" \
  -F "SessionID=your-session-id"

Success response confirms authentication is working:

json
{
  "Success": true,
  "ErrorCode": 0,
  "TotalLists": 5,
  "Lists": [...]
}

Next Steps

Any questions? Contact us.