OAuth Authentication
Obtain access tokens using OAuth 2.0 Client Credentials flow.
Endpoint
POST /v1/auth/token
Request
Header Parameters
| Parameter | Type | Required | Example | Description |
|---|---|---|---|---|
Content-Type | string | Yes | application/x-www-form-urlencoded | Request body content type. |
Request Body Schema
application/x-www-form-urlencoded
client_idrequired
string
OAuth client identifier issued to your application.
Example:
YOUR_CLIENT_IDclient_secretrequired
string
OAuth client secret issued to your application.
Example:
YOUR_CLIENT_SECRETExample request
curl -X POST "${API_URL}/auth/token" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "client_id=YOUR_CLIENT_ID" \
-d "client_secret=YOUR_CLIENT_SECRET"
Responses
200 Success
200 Success
Response schema:
application/jsondatajson-stringOAuth token response wrapper.
data
json-string
OAuth token response wrapper.
access_token
string
Access token to use in API requests.
Example:
sk-418e41a74ca2e7d941fa4456d73dbed7token_type
string
Token type.
Example:
Bearerexpires_in
integer
Token lifetime in seconds.
Example:
3600Response sample
{
"data": {
"access_token": "sk-418e41a74ca2e7d941fa4456d73dbed7",
"token_type": "Bearer",
"expires_in": 3600
}
}
400 Bad Request
400 Bad Request
Response schema:
application/jsonerror.code
string
Error code.
Example:
400013error.code_reason
string
Error reason.
Example:
invalid_requesterror.message
string
Human-readable message.
Example:
Missing or invalid parameters{
"error": {
"code": "400013",
"code_reason": "invalid_request",
"message": "Missing or invalid parameters"
}
}
401 Unauthorized
401 Unauthorized
Response schema:
application/jsoncode
string
Error code.
Example:
401021code_reason
string
Error reason.
Example:
invalid_clientmessage
string
Human-readable message.
Example:
Invalid client_id, client_secret, or session_key{
"error": {
"code": "401021",
"code_reason": "invalid_client",
"message": "Invalid client_id, client_secret, or session_key"
}
}
403 Forbidden
403 Forbidden
Response schema:
application/jsonerror
json-string
Access forbidden for this resource.
404 Not Found
404 Not Found
Response schema:
application/jsonerror
json-string
Resource or endpoint not found.
500 Failure
500 Failure
Response schema:
application/jsoncode
string
Error code.
Example:
500999code_reason
string
Error reason.
Example:
API_ERRORmessage
string
Human-readable message.
Example:
Api Error, please contact customer service{
"error": {
"code": "500999",
"code_reason": "API_ERROR",
"message": "Api Error, please contact customer service"
}
}