The Enable Rebates API uses bearer token authentication. Every request must include a valid JSON Web Token (JWT), which you get from the token endpoint using the OAuth 2.0 client credentials flow.
Requesting a token
Send a POST request to:
https://api.trading-programs.enable.com/oauth2/tokenwith these fields as application/x-www-form-urlencoded form data:
Field | Description |
|---|---|
| The ID of your application. A UUID provided by Enable. |
| The password for your application, provided securely by Enable. Store it securely and share it only with trusted parties. |
| The ID of your application's registration with your Enable instance. A UUID provided by Enable. |
| The areas of the API you need, as a space-separated, case-sensitive list. See Scopes below. |
| Always |
Example
curl --request POST "https://api.trading-programs.enable.com/oauth2/token" \
--header "Content-Type: application/x-www-form-urlencoded" \
--data-urlencode "client_id=<your-client-id>" \
--data-urlencode "client_secret=<your-client-secret>" \
--data-urlencode "dealtrack_registration_id=<your-registration-id>" \
--data-urlencode "scope=read:deals read:activity" \
--data-urlencode "grant_type=client_credentials"Scopes
A token only gives access to the parts of the API named in its scope. If you request a scope your credentials are not permitted to use, the request fails with invalid_scope.
Scope | Gives access to |
|---|---|
| Reading deals and related trading program data |
| Reading the activity log and its attachments |
| Reading users |
Response
If the credentials are valid, the response is:
{
"access_token": "{token_string}",
"expires_in": {time_in_seconds},
"token_type": "Bearer"
}expires_in is the number of seconds until the token expires. Tokens currently last 24 hours. After that, request a new one. You can store a token and reuse it until it expires.
If the request cannot be authorised, the API returns 400 Bad Request with:
{
"error": "{error}"
}where error is one of:
invalid_request: a required field is missing or malformed.invalid_client: the client ID, secret or registration ID is not recognised.invalid_scope: a requested scope is not permitted for these credentials.unsupported_grant_type:grant_typeis notclient_credentials.
Using the token
Send the token on every request in the Authorization header, prefixed with Bearer:
Authorization: Bearer {token_string}