Skip to content

Get an access token

POST
/oauth/token
curl --request POST \
--url https://auth.krkplaystennis.example/oauth/token \
--header 'Authorization: Basic <credentials>' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data grant_type=client_credentials \
--data scope=matches:write

Exchanges your client credentials for an access token, using the OAuth 2.0 client credentials grant. Send the token in the Authorization header of POST /matches.

Authenticate with HTTP Basic: your client ID is the username and your client secret is the password.

Tokens expire after 1 hour. There’s no refresh token: request a new token when the current one expires.

This endpoint follows RFC 6749, so its errors use the OAuth error format instead of problem details.

Media typeapplication/x-www-form-urlencoded
object
grant_type
required

Always client_credentials.

string
Allowed value: client_credentials
scope

The scopes to request, separated by spaces. Defaults to every scope your client is allowed.

string

Examples

ExamplematchesWrite

Token for submitting results

grant_type=client_credentials&scope=matches%3Awrite

The access token.

Media typeapplication/json
object
access_token
required

The access token. Treat it as an opaque string.

string
token_type
required

Always Bearer.

string
Allowed value: Bearer
expires_in
required

Seconds until the token expires.

integer
scope
required

The scopes granted, separated by spaces.

string

Examples

Exampletoken

Token valid for 1 hour

{
"access_token": "eyJhbGciOiJSUzI1NiJ9.fictional-token-for-docs.c2lnbmF0dXJl",
"token_type": "Bearer",
"expires_in": 3600,
"scope": "matches:write"
}

The request is invalid, for example it asks for an unknown scope.

Media typeapplication/json

An error from the authorization server, in the RFC 6749 format.

object
error
required

The error code.

string
Allowed values: invalid_request invalid_client invalid_grant unauthorized_client unsupported_grant_type invalid_scope
error_description

A human-readable explanation.

string

Examples

ExampleinvalidScope

Unknown scope

{
"error": "invalid_scope",
"error_description": "The scope matches:delete doesn't exist. The only scope is matches:write."
}

The client ID or client secret is wrong.

Media typeapplication/json

An error from the authorization server, in the RFC 6749 format.

object
error
required

The error code.

string
Allowed values: invalid_request invalid_client invalid_grant unauthorized_client unsupported_grant_type invalid_scope
error_description

A human-readable explanation.

string

Examples

ExampleinvalidClient

Wrong client credentials

{
"error": "invalid_client",
"error_description": "The client ID or client secret is invalid."
}

© 2026 Saverio Cirillo · KRKplaysTennis is a fictional API · Built with Starlight