Skip to main content
POST
Generate Access Token

Rate Limit

This endpoint allows 30 requests per 10 minutes and 5 requests per minute. Both limits apply per client_id and client_secret pair. A 429 response includes a Retry-After header that gives the number of seconds to wait. The same value also appears in the deprecated X-RETRY-AFTER header. Read Retry-After. Access tokens are reusable for their full lifetime. Generate one access token and reuse the token until the token approaches expiry, instead of calling this endpoint for every API request.

Determine the Token Expiry

The expires_in field gives the access token’s lifetime in seconds, counted from the moment MoEngage issues the token. Schedule your refresh from that value. The lifetime reflects the Expiry time (in minutes) set on the API key, which defaults to 15 minutes. The refresh_token_expires_in field gives the number of seconds until the refresh token expires if you do not use the token. Refresh at least once in that window to keep the refresh token alive. Send the access token on API requests as Authorization: Bearer <access_token>. For the request format and the authentication error codes, refer to Call the MoEngage Public APIs.

Body

application/x-www-form-urlencoded

The form-encoded credentials for the client credentials grant.

grant_type
enum<string>
required

The OAuth 2.0 grant type. The supported value is client_credentials.

Available options:
client_credentials
client_id
string
required

Your Workspace ID. The API key dashboard displays the Workspace ID at Settings > Account > API keys.

client_secret
string
required

The API key value. The dashboard displays the API key only once, when you create the key.

Response

MoEngage issued an access token and a refresh token. Store both tokens. The refresh token expires after 24 hours without a refresh, and after 30 days at most.

access_token
string

The access token that you send as a Bearer token on your API requests.

refresh_token
string

The token that you exchange for new access tokens at Refresh Access Token. The refresh token expires after 24 hours without a refresh, and after 30 days at most.

token_type
string

The token type. The value is always Bearer.

Example:

"Bearer"

expires_in
integer

The lifetime of the access token, in seconds. The value reflects the Expiry time (in minutes) set on the API key.

Example:

900

refresh_token_expires_in
integer

The number of seconds until the refresh token expires if you do not use the token. The value is 24 hours, or less when the refresh token approaches its 30-day limit.

Example:

86400