post/oauth2/token

Exchange OAuth2 token

Exchanges authorization code or other grant type for access tokens. Supports authorization code, refresh token, and client credentials flows. Client authentication via authorization header or client credentials.

exchange_oauth2_token

Request body

multipart/form-data

json
{
  "oneOf": [
    {
      "$ref": "#/components/schemas/AuthorizationCodeTokenRequest"
    },
    {
      "$ref": "#/components/schemas/RefreshTokenTokenRequest"
    }
  ]
}

Responses

200

Success

json
{
  "type": "object",
  "properties": {
    "access_token": {
      "type": "string",
      "description": "The access token for API authorization"
    },
    "token_type": {
      "type": "string",
      "description": "The type of token, typically \"Bearer\""
    },
    "expires_in": {
      "type": "integer",
      "minimum": 0,
      "maximum": 2147483647,
      "format": "int32",
      "description": "The number of seconds until the access token expires"
    },
    "refresh_token": {
      "type": "string",
      "description": "The refresh token for obtaining new access tokens"
    },
    "scope": {
      "type": "string",
      "description": "The space-separated list of granted scopes"
    }
  },
  "required": [
    "access_token",
    "token_type",
    "expires_in",
    "refresh_token",
    "scope"
  ]
}
400

Bad Request - The request was malformed or contained invalid data

json
{
  "type": "object",
  "properties": {
    "code": {
      "$ref": "#/components/schemas/APIErrorCode"
    },
    "message": {
      "type": "string",
      "description": "Human-readable error message"
    },
    "errors": {
      "type": "array",
      "description": "Field-specific validation errors",
      "items": {
        "$ref": "#/components/schemas/ValidationErrorItem"
      }
    }
  },
  "required": [
    "code",
    "message"
  ]
}
429

Too Many Requests - You are being rate limited

json
{
  "type": "object",
  "properties": {
    "code": {
      "type": "string",
      "enum": [
        "RATE_LIMITED"
      ]
    },
    "message": {
      "type": "string"
    },
    "retry_after": {
      "type": "number",
      "description": "Seconds to wait before retrying"
    },
    "global": {
      "type": "boolean",
      "description": "Whether this is a global rate limit"
    }
  },
  "required": [
    "code",
    "message",
    "retry_after"
  ]
}
500

Internal Server Error - An unexpected error occurred

json
{
  "type": "object",
  "properties": {
    "code": {
      "$ref": "#/components/schemas/APIErrorCode"
    },
    "message": {
      "type": "string",
      "description": "Human-readable error message"
    },
    "errors": {
      "type": "array",
      "description": "Field-specific validation errors",
      "items": {
        "$ref": "#/components/schemas/ValidationErrorItem"
      }
    }
  },
  "required": [
    "code",
    "message"
  ]
}