Revoke an access token / API key (RFC 7009)
const url = 'https://api.legesher.io/v1/oauth/revoke';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"token":"example","token_type_hint":"example"}'};
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://api.legesher.io/v1/oauth/revoke \ --header 'Content-Type: application/json' \ --data '{ "token": "example", "token_type_hint": "example" }'Deactivate the presented token. Always 200 with a uniform body.
Per RFC 7009 §2.2 the response is identical whether the token was active, already revoked, or never existed, so revocation cannot be used to test whether a key is valid. Works for any API key, not only ones created by device sign-in (they are the same credential): this is how a command line signs out.
Request Bodyrequired
Section titled “ Request Bodyrequired ”object
The access token (API key) to revoke.
Accepted and ignored: there is one token type.
Example generated
{ "token": "example", "token_type_hint": "example"}object
The access token (API key) to revoke.
Accepted and ignored: there is one token type.
Example generated
token=example&token_type_hint=exampleResponses
Section titled “ Responses ”Successful Response
RFC 7009 revocation acknowledgement.
Deliberately uniform: the endpoint answers 200 with this body whether or not the presented token existed, so the response never confirms token validity to a prober.
object
The revocation request was processed.
Example
{ "status": "ok"}Headers
Section titled “ Headers ”Correlation id for this request: the validated inbound X-Request-ID when one was sent, else a server-minted UUID.
OAuth error (RFC 6749 §5.2 / RFC 8628 §3.5): authorization_pending, slow_down, expired_token, access_denied, invalid_grant, invalid_request, or unsupported_grant_type.
RFC 6749 §5.2 / RFC 8628 §3.5 error body (HTTP 400).
error values used by this API: authorization_pending,
slow_down, expired_token, access_denied, invalid_grant,
invalid_request, unsupported_grant_type.
object
Example generated
{ "error": "example", "error_description": "example"}Headers
Section titled “ Headers ”Correlation id for this request: the validated inbound X-Request-ID when one was sent, else a server-minted UUID.
Request body over the ceiling.
Envelope for every error response.
object
Machine-readable code + human message for one error.
object
Machine-readable error code, e.g. ‘validation_error’, ‘unsupported_language’, ‘language_pack_not_found’, ‘payload_too_large’, ‘foundation_unavailable’, ‘invalid_source_code’, ‘internal_error’.
Per-field breakdown (validation errors only).
One request-validation problem, stripped of the submitted input.
object
Dotted location of the offending field.
Human-readable description.
Pydantic error type identifier.
Human-readable explanation.
Example generated
{ "error": { "code": "example", "details": [ { "field": "example", "message": "example", "type": "example" } ], "message": "example" }}Headers
Section titled “ Headers ”Correlation id for this request: the validated inbound X-Request-ID when one was sent, else a server-minted UUID.
Too many requests. Wait before retrying.
Envelope for every error response.
object
Machine-readable code + human message for one error.
object
Machine-readable error code, e.g. ‘validation_error’, ‘unsupported_language’, ‘language_pack_not_found’, ‘payload_too_large’, ‘foundation_unavailable’, ‘invalid_source_code’, ‘internal_error’.
Per-field breakdown (validation errors only).
One request-validation problem, stripped of the submitted input.
object
Dotted location of the offending field.
Human-readable description.
Pydantic error type identifier.
Human-readable explanation.
Example generated
{ "error": { "code": "example", "details": [ { "field": "example", "message": "example", "type": "example" } ], "message": "example" }}Headers
Section titled “ Headers ”Correlation id for this request: the validated inbound X-Request-ID when one was sent, else a server-minted UUID.