v1

latestOpenAPI 3.0.12026-08-061158187.8 KB
OAuth API

Request access token

Returns a new OAuth Bearer access token.

Prerequisites

To make requests to this endpoint, you need to have the Client ID and Client Secret credentials. For more information, see Authentication.

Implementation flow

Your implementation must adhere to this flow:

  1. Generate an access token.
  2. Store the token, along with the expiration timestamp, in a persistent storage.
  3. Attach the token as a Bearer token with every API request to a Ninja Van API. This means that for the Authorization HTTP header, the value must be Bearer <INSERT ACCESS TOKEN>.
  4. Five minutes before the token expires, or if a request to a Ninja Van API returns an HTTP 401 status code, generate a new token.

Validity period is dynamic and may change from time to time. The minimum validity period is one hour.

Note: Always set grant_type to client_credentials.

post/{countryCode}/2.0/oauth/access_token

Path parameters

countryCode'SG' | 'MY' | 'TH' | 'ID' | 'VN' | 'PH' | 'MM' required

Country Code

Request body

client_idstring required

Client ID from your Ninja Dashboard account.

client_secretstring required

Client Key from your Ninja Dashboard account.

grant_type'client_credentials' required

Response

Access token was successfully generated.

access_tokenstring required

Bearer token to be included in the Authorization HTTP header for all API requests.

expiresinteger required

The epoch timestamp at which the access token expires.

expires_ininteger required

The number of seconds at which the access token expires.

token_type'bearer' required