How to Authenticate
The StoneX Clearing API follows the industry standard
Client Credentials
authentication flow. This returns a JWT that will be passed to subsequent requests in the Authorization
header.
Step 1: Setup Client Credentials
Work with your firm's StoneX relationship manager to setup your developer account and get your client credentials.
Step 2: Generate Token
Once you have your client credentials, you’re ready to get an access token to make API calls. You can get the token using cURL, or you can use a tool such as Postman® or SoapUI®.
The token is valid for ten hours. When the token expires, you must get a new token by calling the /token
endpoint again.
POST https://api.clearing.uat.stonex.com/identity/connect/token
Headers
Key | Value |
---|---|
Content-Type | application/x-www-form-urlencoded |
Body
The request body requires the following attributes:
- Schema
- Example
Key | Value |
---|---|
client_id | <your_client_id> |
client_secret | <your_client_secret> |
curl --location 'https://api.clearing.uat.stonex.com/auth/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'client_id=<your_client_id>' \
--data-urlencode 'client_secret=<your_client_secret>'
Response
The /token
endpoint will return the following response as JSON:
- Schema
- Example
Key | Description |
---|---|
access_token | Your JWT token |
expires_in | Lifetime of token in seconds |
token_type | Token type |
{
"access_token": "{{YOUR_JWT_TOKEN}}",
"expires_in": 36000,
"token_type": "Bearer",
}
Step 3: Use Token
The generated access_token
returned should then be passed to the API endpoint(s) in the Authorization
header following the Bearer schema.
Authorization: Bearer <token>
Token Lifetime
The JWT generated from this endpoint has a lifetime of 10 hours. After that time expires you will need to generate a new one.