Skip to content

Revoke an access token / API key (RFC 7009)

POST
/v1/oauth/revoke
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.

object
token
required

The access token (API key) to revoke.

string
token_type_hint

Accepted and ignored: there is one token type.

string

Example generated

{
"token": "example",
"token_type_hint": "example"
}

Successful Response

Media type application/json
RevocationResponse

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
status
Status

The revocation request was processed.

string
default: ok
Allowed value: ok

Example

{
"status": "ok"
}
X-Request-ID
string

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.

Media type application/json
OAuthErrorResponse

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
error
required
Error

The OAuth error code (a bare string).

string
error_description
Error Description

Human-readable detail for developers.

Any of:
string

Example generated

{
"error": "example",
"error_description": "example"
}
X-Request-ID
string

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.

Media type application/json
ErrorResponse

Envelope for every error response.

object
error
required
ErrorDetail

Machine-readable code + human message for one error.

object
code
required
Code

Machine-readable error code, e.g. ‘validation_error’, ‘unsupported_language’, ‘language_pack_not_found’, ‘payload_too_large’, ‘foundation_unavailable’, ‘invalid_source_code’, ‘internal_error’.

string
details
Details

Per-field breakdown (validation errors only).

Any of:
Array<object>
FieldIssue

One request-validation problem, stripped of the submitted input.

object
field
required
Field

Dotted location of the offending field.

string
message
required
Message

Human-readable description.

string
type
required
Type

Pydantic error type identifier.

string
message
required
Message

Human-readable explanation.

string

Example generated

{
"error": {
"code": "example",
"details": [
{
"field": "example",
"message": "example",
"type": "example"
}
],
"message": "example"
}
}
X-Request-ID
string

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.

Media type application/json
ErrorResponse

Envelope for every error response.

object
error
required
ErrorDetail

Machine-readable code + human message for one error.

object
code
required
Code

Machine-readable error code, e.g. ‘validation_error’, ‘unsupported_language’, ‘language_pack_not_found’, ‘payload_too_large’, ‘foundation_unavailable’, ‘invalid_source_code’, ‘internal_error’.

string
details
Details

Per-field breakdown (validation errors only).

Any of:
Array<object>
FieldIssue

One request-validation problem, stripped of the submitted input.

object
field
required
Field

Dotted location of the offending field.

string
message
required
Message

Human-readable description.

string
type
required
Type

Pydantic error type identifier.

string
message
required
Message

Human-readable explanation.

string

Example generated

{
"error": {
"code": "example",
"details": [
{
"field": "example",
"message": "example",
"type": "example"
}
],
"message": "example"
}
}
X-Request-ID
string

Correlation id for this request: the validated inbound X-Request-ID when one was sent, else a server-minted UUID.