> This page is part of EVVA for Developers (https://developers.evvahub.com), the documentation of the EVVA Partner API. The API is in developer preview and the SDK packages are not yet published: do not suggest installing them. Index: https://developers.evvahub.com/llms.txt

# Revoke an access token

POST https://api.evvahub.com/partner/v1/oauth/revoke
Content-Type: application/json

Revokes one of your application's own access tokens, as defined by RFC 7009.

**Request**

Send `token`, the `evpa_live_…` or `evpa_test_…` access token to revoke, as `application/x-www-form-urlencoded` or as JSON. `token_type_hint` is a hint only. Authenticate the client exactly as at the token endpoint: `client_secret_basic`, `client_secret_post` or `private_key_jwt`. See [requesting tokens](/authentication/tokens).

**What happens**

Only the authenticated application's own token is revoked. Revocation takes effect from the next request, and realtime connections the token opened are closed with `SESSION_REVOKED`. Your application can revoke its own tokens even while it is disabled or its agency is suspended.

**Response**

The answer is `200` with an empty body for anything that is not a client error: the token was revoked now, was already revoked, has expired, is unknown, or belongs to another application (which is left untouched).

**Errors**

- `400 invalid_request` — a parameter sent twice, too long or in the URL query, more than one client authentication method, `client_secret` without `client_id`, or `client_assertion` without `client_assertion_type`.
- `400 INVALID_REQUEST` — the body has no `token`, or its `token` does not start with `evpa_`, so it is not a revocation of your token. This answer uses the common `Error` envelope.
- `401 invalid_client` — client authentication failed. The answer is the same constant in every case, with `WWW-Authenticate: Basic` when you used HTTP Basic.
- `401 UNAUTHORIZED` — a JSON body with `client_id` and `client_secret` whose `token` does not start with `evpa_`. This answer uses the common `Error` envelope.
- `503 temporarily_unavailable` — EVVA cannot answer right now. Retry after `Retry-After`.

Reference: https://developers.evvahub.com/api-reference/authentication/revoke-token

## Authentication

- `Authorization` header (basic auth, required) — Client authentication at the token and revocation endpoints with the client id and secret (`client_secret_basic`, RFC 6749, section 2.3.1). `client_secret_post` and `private_key_jwt` send the credentials in the form body instead.

## Request

### Body (application/json)

This endpoint expects an ApplicationTokenRevocationRequest.

- `token` (string, required)
- `token_type_hint` (string, optional)
- `client_id` (string, optional)
- `client_secret` (string, optional)
- `client_assertion_type` ("urn:ietf:params:oauth:client-assertion-type:jwt-bearer", optional)
- `client_assertion` (string, optional)

## Response

### 200

Revoked, or nothing to revoke. The body is empty (RFC 7009, section 2.2).

## Errors

### 400 Bad Request Error

A malformed request. For an `evpa_` token: `invalid_request` (`OAuthTokenError`) — a duplicated parameter, parameters in the URL query, or more than one client authentication method. A body without `token`, or whose `token` does not start with `evpa_`, is answered `INVALID_REQUEST` in the common `Error` envelope.

- `RevokeTokenRequestBadRequestError`
  - Error: Error
  - OAuthTokenError: OAuthTokenError

### 401 Unauthorized Error

Client authentication failed: `invalid_client` (`OAuthTokenError`), one constant body for every failure, with `WWW-Authenticate: Basic` when HTTP Basic was attempted. A JSON body with `client_id`, `client_secret` and a `token` that does not start with `evpa_` is answered `UNAUTHORIZED` in the common `Error` envelope.

- `RevokeTokenRequestUnauthorizedError`
  - Error: Error
  - OAuthTokenError: OAuthTokenError

### 429 Too Many Requests Error

Rate limited: `RATE_LIMIT_EXCEEDED`. Wait `Retry-After` seconds before retrying.

- `code` (enum, required) — A stable machine-readable code (see `KnownErrorCode`; new codes may appear within v1).
  - Allowed values: `RATE_LIMIT_EXCEEDED`, `TOO_MANY_MESSAGES`
- `error` (string, required)
- `requestId` (string, required, nullable) — The same value as the `X-Request-Id` response header — quote it when reporting a problem.
- `details` (RateLimitErrorDetails, optional) — Extra detail for the code, specific to the operation, such as field errors, limits or the creator's account-status details.

### 500 Internal Server Error

Unexpected server error: `INTERNAL_ERROR`. Nothing internal is disclosed; quote the `X-Request-Id` when you report it.

- `code` (string, required) — A stable machine-readable code (see `KnownErrorCode`; new codes may appear within v1).
- `error` (string, required)
- `requestId` (string, required, nullable) — The same value as the `X-Request-Id` response header — quote it when reporting a problem.
- `details` (any, optional) — Extra detail for the code, specific to the operation, such as field errors, limits or the creator's account-status details.

### 503 Service Unavailable Error

EVVA cannot answer right now; always with `Retry-After`. The body is `temporarily_unavailable` (`OAuthTokenError`).

- `RevokeTokenRequestServiceUnavailableError`
  - Error: Error
  - OAuthTokenError: OAuthTokenError

## Types

### Error

The common error envelope. Branch on `code`; `error` is human-readable and may change.

- `code` (string, required) — A stable machine-readable code (see `KnownErrorCode`; new codes may appear within v1).
- `error` (string, required)
- `requestId` (string, required, nullable) — The same value as the `X-Request-Id` response header — quote it when reporting a problem.
- `details` (any, optional) — Extra detail for the code, specific to the operation, such as field errors, limits or the creator's account-status details.

### OAuthTokenError

The error body of the token endpoint (`client_credentials`) and of application token revocation (RFC 7009), as defined by RFC 6749, section 5.2. It is not the `Error` envelope. - `400` — `invalid_request`, `unsupported_grant_type`, `invalid_scope` or `unauthorized_client`. - `401` — `invalid_client`: one constant body for every authentication failure, with `WWW-Authenticate: Basic` when HTTP Basic was attempted. - `503` — `temporarily_unavailable`, with `Retry-After`: a store the decision needs did not answer, and no token is issued when in doubt. Retry later.

- `error` (enum, required)
  - Allowed values: `invalid_request`, `invalid_client`, `unauthorized_client`, `unsupported_grant_type`, `invalid_scope`, `temporarily_unavailable`
- `error_description` (string, optional)

### RateLimitErrorDetails

Extra detail for the code, specific to the operation, such as field errors, limits or the creator's account-status details.

- `retryAfterSec` (integer, required)
- `level` (enum, optional) — The DM send limit that refused the message, set only with `TOO_MANY_MESSAGES`. It is never a quota, a count or a key. - `conversation` — one side of one thread. - `sender` — a person's own ceiling; it does not apply to applications. - `creator` — everything sent for the creator, studio included. - `application` — everything your application sends. - `agency` — everything your agency sends. - `platform` — the agency's fair share of the platform: its throughput or its concurrency. See [rate limits](/authentication/rate-limits).
  - Allowed values: `conversation`, `sender`, `creator`, `application`, `agency`, `platform`

## Examples

### Authentication_revokeToken_example (application/json)

**Request**

```json
{
  "token": "evpa_live_k3Vq7XcN2mR8tL5wZp1Hb9Df4Gy6Js0Ae3Uo8Qi2Tn5",
  "token_type_hint": "access_token"
}
```

**SDK Code**

```python Authentication_revokeToken_example (application/json)
import requests

url = "https://api.evvahub.com/partner/v1/oauth/revoke"

payload = {
    "token": "evpa_live_k3Vq7XcN2mR8tL5wZp1Hb9Df4Gy6Js0Ae3Uo8Qi2Tn5",
    "token_type_hint": "access_token"
}
headers = {
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers, auth=("<clientId>", "<clientSecret>"))

print(response.json())
```

```go Authentication_revokeToken_example (application/json)
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.evvahub.com/partner/v1/oauth/revoke"

	payload := strings.NewReader("{\n  \"token\": \"evpa_live_k3Vq7XcN2mR8tL5wZp1Hb9Df4Gy6Js0Ae3Uo8Qi2Tn5\",\n  \"token_type_hint\": \"access_token\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.SetBasicAuth("<clientId>", "<clientSecret>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```php Authentication_revokeToken_example (application/json)
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.evvahub.com/partner/v1/oauth/revoke', [
  'body' => '{
  "token": "evpa_live_k3Vq7XcN2mR8tL5wZp1Hb9Df4Gy6Js0Ae3Uo8Qi2Tn5",
  "token_type_hint": "access_token"
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
    'auth' => ['<clientId>', '<clientSecret>'],
]);

echo $response->getBody();
```

### Authentication_revokeToken_example (application/x-www-form-urlencoded)

**Request**

```json
{
  "token": "evpa_live_k3Vq7XcN2mR8tL5wZp1Hb9Df4Gy6Js0Ae3Uo8Qi2Tn5",
  "token_type_hint": "access_token"
}
```

**SDK Code**

```python Authentication_revokeToken_example (application/x-www-form-urlencoded)
import requests

url = "https://api.evvahub.com/partner/v1/oauth/revoke"

payload = {
    "token": "evpa_live_k3Vq7XcN2mR8tL5wZp1Hb9Df4Gy6Js0Ae3Uo8Qi2Tn5",
    "token_type_hint": "access_token"
}
headers = {
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers, auth=("<clientId>", "<clientSecret>"))

print(response.json())
```

```go Authentication_revokeToken_example (application/x-www-form-urlencoded)
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.evvahub.com/partner/v1/oauth/revoke"

	payload := strings.NewReader("{\n  \"token\": \"evpa_live_k3Vq7XcN2mR8tL5wZp1Hb9Df4Gy6Js0Ae3Uo8Qi2Tn5\",\n  \"token_type_hint\": \"access_token\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.SetBasicAuth("<clientId>", "<clientSecret>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```php Authentication_revokeToken_example (application/x-www-form-urlencoded)
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.evvahub.com/partner/v1/oauth/revoke', [
  'body' => '{
  "token": "evpa_live_k3Vq7XcN2mR8tL5wZp1Hb9Df4Gy6Js0Ae3Uo8Qi2Tn5",
  "token_type_hint": "access_token"
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
    'auth' => ['<clientId>', '<clientSecret>'],
]);

echo $response->getBody();
```