Skip to content

Examples

End-to-end walkthroughs for the Partner API endpoints. All examples use the placeholder base URL https://api.example.com and obviously fake values — substitute the base URL and the credentials your integration was given.

Request fields are accepted in either casing. Response field names are reproduced exactly: the /token response uses Token and ExpiresIn; the create responses use accountId, tpAccountName, and url; and the read models — accounts, transactions, positions — return PascalCase (CreatedOn, OrderID).

1. Get a token

Exchange your username and password for a bearer token. Send it as Authorization: Bearer <token> on every call below.

curl -X POST https://api.example.com/token \
  -H "Content-Type: application/json" \
  -d '{ "userName": "your-username", "password": "your-password" }'
{ "Token": "eyJhbGciOi...your token...", "ExpiresIn": 82800 }

The token is valid for 23 hours; request a fresh one before it expires. See Authentication for the full handshake.

2. Create a lead account

A valid phone is required on every create method.

curl -X POST https://api.example.com/accounts/lead \
  -H "Authorization: Bearer eyJhbGciOi...your token..." \
  -H "Content-Type: application/json" \
  -d '{ "firstName": "Jordan", "lastName": "Example", "email": "client@example.com", "phone": "+15550001111" }'
{ "accountId": "100123" }

3. Create a real, tradeable account

Provisions a trading account and returns its name together with a one-time password.

curl -X POST https://api.example.com/accounts/real \
  -H "Authorization: Bearer eyJhbGciOi...your token..." \
  -H "Content-Type: application/json" \
  -d '{ "firstName": "Jordan", "lastName": "Example", "email": "client@example.com", "phone": "+15550001111" }'
{ "accountId": "100123", "tpAccountName": "5501234", "tpAccountPassword": "9fT2xQ7m" }

4. Create an account with single sign-on

Creates an account, attaches a password login, and returns an autologin URL.

curl -X POST https://api.example.com/accounts/registrationwithsso \
  -H "Authorization: Bearer eyJhbGciOi...your token..." \
  -H "Content-Type: application/json" \
  -d '{ "firstName": "Jordan", "lastName": "Example", "email": "client@example.com", "phone": "+15550001111" }'
{ "accountId": "100123", "url": "https://trade.example.com/sso?ticket=..." }

5. List accounts with a filter

Combine a WHERE filter, a page size, and an order. Brackets and values are URL-encoded. See Querying data for the full syntax.

curl -G https://api.example.com/accounts \
  -H "Authorization: Bearer eyJhbGciOi...your token..." \
  --data-urlencode "WHERE[leadStatusCode]=3" \
  --data-urlencode "LIMIT[Take]=50" \
  --data-urlencode "ORDER[sortOrder]=desc"
[
  {
    "Id": "100123",
    "FirstName": "Jordan",
    "LastName": "Example",
    "LeadStatusCode": 3,
    "LeadStatus": "New",
    "TpAccount": "5501234",
    "Currency": "USD",
    "CreatedOn": "2026-01-15T09:24:00Z",
    "ModifiedOn": "2026-01-16T11:02:00Z",
    "Country": "US",
    "AffiliateTransactionId": "txn-abc-123",
    "Affiliate": "partner-42",
    "Email": "client@example.com",
    "Phone": "+15550001111",
    "CampaignId": "spring-2026",
    "Tag": "newsletter",
    "Tag1": "",
    "FtdExists": false,
    "RegistrationUrl": "https://partner.example.com/landing",
    "AdditionalInfo1": "",
    "AdditionalInfo2": "",
    "AdditionalInfo3": "",
    "Language": "en",
    "PromotionCode": "",
    "BrandId": "42"
  }
]

6. List transactions

Requires the transactions scope; without it you get 403. The CustomFtdDate, CustomAmount, and CustomUsdValue fields appear only when the transactions scope is CustomFtd — otherwise they are omitted.

curl -G https://api.example.com/transactions \
  -H "Authorization: Bearer eyJhbGciOi...your token..." \
  --data-urlencode "WHERE[isFtd]=true" \
  --data-urlencode "LIMIT[Take]=25"
[
  {
    "TransactionId": "TX-778812",
    "AccountId": "100123",
    "TypeName": "Deposit",
    "TypeCode": 1,
    "Amount": 500.00,
    "Currency": "USD",
    "IsoCurrency": "USD",
    "IsFtd": true,
    "ApprovedOn": 1768465440000,
    "AffiliateTransactionId": "txn-abc-123",
    "Affiliate": "partner-42",
    "UsdValue": 500.00,
    "MethodOfPaymentCode": 2,
    "MethodOfPayment": "Card",
    "AccountAffiliateTrxId": "txn-abc-123"
  }
]

7. List positions

Requires the positions scope, and both startTime and endTime (epoch milliseconds, or an RFC 3339 / YYYY-MM-DD string). The result includes open and closed positions; an open position has CloseRate and CloseTime set to null.

curl -G https://api.example.com/positions \
  -H "Authorization: Bearer eyJhbGciOi...your token..." \
  --data-urlencode "startTime=1767225600000" \
  --data-urlencode "endTime=1769817600000"
[
  {
    "AccountId": "100123",
    "ActionType": "Buy",
    "Amount": 1.0,
    "OpenRate": 1.0854,
    "OpenTime": 1767312000000,
    "InstrumentName": "EURUSD",
    "OrderID": "ORD-99001",
    "ProfitInAccountCurrency": 0.0,
    "TpAccount": "5501234",
    "Currency": "USD",
    "IsoCurrency": "USD",
    "CloseRate": null,
    "CloseTime": null
  }
]

Error responses

The API uses standard HTTP status codes. The common ones:

Status When it happens
400 Malformed query (bad filter, non-filterable field), a missing/unparseable positions date range, or a create request without a valid phone
401 Invalid credentials, a missing/unknown/expired token, or a caller outside the IP allow-list — one generic response
403 The token lacks the transactions, positions, or account-creation scope for this call
409 An account with this email already exists for the brand
422 The brand's account limit is reached
429 Throttled — back off and retry