Exchange a code, or refresh

​

RFC 6749 token endpoint.

  • grant_type=authorization_code: exchanges the code from /v1/oauth/authorize. The code is single-use and expires after ten minutes; redirect_uri must equal the one in the authorization request and code_verifier must match the PKCE challenge. Replaying a consumed code revokes every token it issued.
  • grant_type=refresh_token: returns a fresh access token and a new refresh token; the presented refresh token is retired. Presenting a retired token again revokes the whole connection. Granted scopes are re-intersected with what the consenting user currently holds — they can shrink, never grow.

Confidential clients authenticate with client_id + client_secret in the body or with HTTP Basic auth. Accepts application/x-www-form-urlencoded and application/json. Errors use the RFC 6749 error body, not the API's standard ErrorResponse.

Body·

required

Token request (RFC 6749). Sent as application/x-www-form-urlencoded or application/json. Confidential clients authenticate with client_id + client_secret in the body (client_secret_post) or an Authorization: Basic header (client_secret_basic); public clients send client_id only.

  • Required for confidential clients unless sent as HTTP Basic auth.

  • The authorization code (grant authorization_code).

  • PKCE verifier whose S256 digest matches the code_challenge of the authorization request (grant authorization_code).

  • Must equal the redirect_uri of the authorization request (grant authorization_code).

  • The current refresh token (grant refresh_token). It is rotated on every use; reusing a rotated-out token revokes the connection.

  • RFC 8707 resource indicator. Optional; must equal the authorization request's resource when supplied.

Responses

  • application/json
  • application/json
  • application/json
Request Example for post/v1/oauth/token
curl https://api.signstack.ai/v1/oauth/token \
  --request POST \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --data-urlencode 'grant_type=authorization_code' \
  --data-urlencode 'client_id=oc_01jv8m7qfj6xj9gkz7a4s2h8e' \
  --data-urlencode 'client_secret=' \
  --data-urlencode 'code=' \
  --data-urlencode 'redirect_uri=https://example.com' \
  --data-urlencode 'code_verifier=' \
  --data-urlencode 'refresh_token=' \
  --data-urlencode 'resource=https://example.com'
{
  "access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…",
  "token_type": "Bearer",
  "expires_in": 3600,
  "refresh_token": "wQz3…",
  "scope": "workflow:read workflow:create resource:read"
}