Skip to content

AuthCustomer

For a forgotten customer password, use CustomerForgotPassword and CustomerResetPassword. Recovery does not bypass OTP.

Endpoint

POST /customer/auth/login

Description

Authenticates a customer and returns the customer profile, linked accounts, the primary session token __token, and __datalake_token.

If OTP is enabled for the customer, otp_code is required.

Request

{
  "email": "[email protected]",
  "password": "strong-password",
  "otp_code": "123456"
}

otp_code is required only when otp_enabled = 1.

Response

{
  "customer_id": 1,
  "email": "[email protected]",
  "full_name": "John Smith",
  "first_name": "John",
  "last_name": "Smith",
  "status": 0,
  "phone": "+35700000000",
  "preferred_language": "en",
  "brand": "default",
  "avatar": "8e68414e-0e3f-48dd-b7b8-f5be9e26d4f7.svg",
  "deposit_allowed": 1,
  "withdrawal_allowed": 1,
  "desk": "EU",
  "manager_id": 10,
  "last_login_time": 1777600000,
  "otp_enabled": 1,
  "accounts": [
    {
      "login": 100001,
      "customer_id": 1,
      "enable": 1,
      "leverage": 100,
      "group": "standard",
      "name": "John Smith",
      "email": "[email protected]"
    }
  ],
  "__token": "<HS256 session JWT>",
  "__datalake_token": "<EdDSA Data Lake JWT or null>"
}

deposit_allowed and withdrawal_allowed are global customer-level Cashier gates. The terminal can use them to hide or disable deposit/withdrawal actions before requesting payment methods.

The customer profile also includes avatar, a public customer-avatar reference. Use UpdateCustomerSelf to change it.

Response Parameters

Field Type Description
customer_id integer Customer identifier.
email string Customer email address.
full_name string Customer display name.
first_name string Customer first name.
last_name string Customer last name.
status integer Customer status.
phone string Customer phone.
preferred_language string Preferred language.
brand string Customer brand.
avatar string Public customer-avatar reference.
deposit_allowed integer Customer-level deposit gate (0 or 1).
withdrawal_allowed integer Customer-level withdrawal gate (0 or 1).
desk string Customer CRM desk.
manager_id integer Assigned CRM manager ID.
last_login_time integer Last successful customer login timestamp.
otp_enabled integer Whether customer OTP is enabled.
accounts array Linked trading accounts. Each row includes login, customer_id, enable, leverage, group, name, and email.
__token string Existing session JWT used with trading-server APIs.
__datalake_token string or null License-signed EdDSA token for Data Lake authentication. It is null when an active v2 signer or current authorization context is unavailable; customer sign-in still succeeds.

Only __token is used as the ordinary HTTP authorization token and cookie. The Data Lake token is a separate response value. See Data Lake token profile.

With runtime protocol v2, authentication returns HTTP 503 with error: "LICENSE_NOT_ACTIVE" if a lease is unavailable. A post-authentication lease check also prevents issuing a new token if the lease expires during login.

Errors

HTTP Error Description
400 INVALID_DATA Invalid request body
403 CUSTOMER_NOT_FOUND_OR_INCORRECT Email or password is incorrect
403 CUSTOMER_DISABLED Customer is disabled
403 OTP_REQUIRED OTP is enabled and otp_code was not provided
403 INVALID_OTP_CODE OTP code is invalid
403 OTP_NOT_CONFIGURED OTP is enabled but secret is missing
403 BRAND_NOT_AVAILABLE Customer brand is not admitted by the negotiated license policy
503 LICENSE_NOT_ACTIVE A v2 license runtime lease is required before issuing a new session token

When customer login is denied by license brand admission, the direct error body contains only the error code:

{
  "error": "BRAND_NOT_AVAILABLE"
}