OAuthIssue an access token

OAuth

Issue an access token

Exchanges client_credentials, an authorization_code with PKCE or a single-use refresh_token for an opaque token valid 3600 seconds for one Workspace.

POSThttps://api.sofia-post.com/api/v1/oauth/token

Body

application/x-www-form-urlencoded, application/json

  • grant_typestringrequired

    The grant to exchange: client_credentials, authorization_code or refresh_token

    Allowed values: client_credentialsauthorization_coderefresh_token

  • client_idstringrequired

    Identifier of the client application

  • client_secretstring

    Secret of a confidential client (client_secret_post), or in the Authorization: Basic header (client_secret_basic), never both; none for a public client

  • scopestring

    Requested scopes, separated by a space; absent: all those of the grant

  • workspace_idstring

    The Workspace the token acts on: required when the application holds several under client_credentials, optional when it holds one

  • codestring

    authorization_code: the code received on the redirect address

  • code_verifierstring

    authorization_code: the PKCE verifier (RFC 7636)

  • redirect_uristring

    authorization_code: the same redirect address as at authorization

  • refresh_tokenstring

    refresh_token: the refresh token, single use

Response

200application/json

The access token, with a refresh_token only if offline_access was granted.

  • access_tokenstringrequired

    The opaque access token

  • token_typestringrequired

    Always Bearer

    Allowed values: Bearer

  • expires_innumberrequired

    Validity in seconds

  • scopestringrequired

    The granted scopes, separated by a space

  • refresh_tokenstring

    authorization_code and refresh_token only, when offline_access was granted: single use, it rotates on every exchange

400

invalid_request, invalid_grant, unsupported_grant_type, invalid_scope or unauthorized_client.

401

invalid_client: unknown client, wrong or missing secret, or revoked application.