POST/oauth/token
Issue an OAuth 2.0 token
oauth_token
The OAuth 2.0 token endpoint (RFC 6749, section 3.2). grant_type: authorization_code exchanges a one-time code for a token pair and requires code_verifier (PKCE S256); refresh_token issues a new pair for a refresh token and invalidates the previous refresh token (rotation), and reusing an invalidated one revokes the whole chain; client_credentials issues a token on behalf of the organization, for a confidential app only, without a refresh token. A confidential client authenticates with the Authorization: Basic header or with the client_id and client_secret fields; a public client sends only client_id. An access token is valid for 1 hour, a refresh token for 90 days. Responses and errors follow RFC 6749, section 5, with Cache-Control: no-store. Added in 1.62.0.
Authentication
No credentials needed.
Request body
application/x-www-form-urlencoded
grant_typestringrequiredAllowed values:
authorization_coderefresh_tokenclient_credentialscodestringAuthorization code (
authorization_code).redirect_uristringThe same redirect URI as in the authorization request (
authorization_code).code_verifierstringThe original PKCE value, 43 to 128 characters (
authorization_code).refresh_tokenstringRefresh (
refresh_token).scopestringSpace-separated scopes, narrowing only (
refresh_token,client_credentials).client_idstringApp ID, when the secret is not passed in the
Authorization: Basicheader.client_secretstringClient secret of a
confidentialapp, when it is not passed in theAuthorization: Basicheader.
Responses
200Tokens were issued.
Response headers
RateLimit-PolicyLimits in effect, in the format of the IETF draft
draft-ietf-httpapi-ratelimit-headers: comma-separated items"<name>";q=<quota>;w=<window in seconds>.keyis the request rate of the API key (the quota is the burst, the window is the time to refill it fully; for a session it isuser, without credentialsip);minute,dayandmonthare the organization's quotas for the calendar minute, day and month in UTC.RateLimitWhat is left of each limit in
RateLimit-Policy:"<name>";r=<remaining>;t=<seconds until reset>.X-RateLimit-LimitLimit of the strictest entry in
RateLimit-Policy(the one with the fewest requests left).X-RateLimit-RemainingRequests left under the strictest limit.
X-RateLimit-ResetSeconds until the strictest limit resets.
application/json
access_tokenstringrequiredAccess token (
kbat_…) for theAuthorization: Bearerheader.token_typestringrequiredAllowed values:
Bearerexpires_inintegerrequiredLifetime of the access token in seconds.
refresh_tokenstringRefresh token (
kbrt_…); absent for client credentials.scopestringrequiredSpace-separated scopes of the token.
400Error as defined in RFC 6749, section 5.2.
Response headers
RateLimit-PolicyLimits in effect, in the format of the IETF draft
draft-ietf-httpapi-ratelimit-headers: comma-separated items"<name>";q=<quota>;w=<window in seconds>.keyis the request rate of the API key (the quota is the burst, the window is the time to refill it fully; for a session it isuser, without credentialsip);minute,dayandmonthare the organization's quotas for the calendar minute, day and month in UTC.RateLimitWhat is left of each limit in
RateLimit-Policy:"<name>";r=<remaining>;t=<seconds until reset>.X-RateLimit-LimitLimit of the strictest entry in
RateLimit-Policy(the one with the fewest requests left).X-RateLimit-RemainingRequests left under the strictest limit.
X-RateLimit-ResetSeconds until the strictest limit resets.
application/json
401Invalid client credentials (`invalid_client`).
Response headers
RateLimit-PolicyLimits in effect, in the format of the IETF draft
draft-ietf-httpapi-ratelimit-headers: comma-separated items"<name>";q=<quota>;w=<window in seconds>.keyis the request rate of the API key (the quota is the burst, the window is the time to refill it fully; for a session it isuser, without credentialsip);minute,dayandmonthare the organization's quotas for the calendar minute, day and month in UTC.RateLimitWhat is left of each limit in
RateLimit-Policy:"<name>";r=<remaining>;t=<seconds until reset>.X-RateLimit-LimitLimit of the strictest entry in
RateLimit-Policy(the one with the fewest requests left).X-RateLimit-RemainingRequests left under the strictest limit.
X-RateLimit-ResetSeconds until the strictest limit resets.
application/json
Safe retries
Send an Idempotency-Key header (for example a UUID) with each POST and PATCH. A retry with the same key within 24 hours returns the saved response instead of running the request again.
Rate limits
Responses carry the RateLimit and RateLimit-Policy headers and the earlier X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset. A 429 response has Retry-After in seconds: wait and retry.