Get an access token
const url = 'https://auth.krkplaystennis.example/oauth/token';const options = { method: 'POST', headers: { Authorization: 'Basic <credentials>', 'Content-Type': 'application/x-www-form-urlencoded' }, body: new URLSearchParams({grant_type: 'client_credentials', scope: 'matches:write'})};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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:writeExchanges 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.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
Always client_credentials.
The scopes to request, separated by spaces. Defaults to every scope your client is allowed.
Examples
Token for submitting results
grant_type=client_credentials&scope=matches%3AwriteResponses
Section titled “Responses”The access token.
object
The access token. Treat it as an opaque string.
Always Bearer.
Seconds until the token expires.
The scopes granted, separated by spaces.
Examples
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.
An error from the authorization server, in the RFC 6749 format.
object
The error code.
A human-readable explanation.
Examples
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.
An error from the authorization server, in the RFC 6749 format.
object
The error code.
A human-readable explanation.
Examples
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