> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mcprank.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Revoke Tokens

> Revoke all tokens for a user

# Revoke Tokens

Revoke all tokens for a user, including their MCP Identity Token and stored OAuth tokens.

## Request

```bash theme={null}
curl -X POST https://api.mcprank.com/v1/identity/revoke \
  -H "X-API-Key: sk_mcp_rank_..." \
  -H "Content-Type: application/json" \
  -d '{"user_id": "user_123"}'
```

### Headers

<ParamField header="X-API-Key" type="string" required>
  Your MCP Rank API key
</ParamField>

### Body Parameters

<ParamField body="user_id" type="string" required>
  Your user's unique identifier
</ParamField>

## Response

Returns 200 OK on success.

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST https://api.mcprank.com/v1/identity/revoke \
    -H "X-API-Key: sk_mcp_rank_..." \
    -H "Content-Type: application/json" \
    -d '{"user_id": "user_123"}'
  ```

  ```python Python theme={null}
  from mcp_rank import MCPRankClient

  client = MCPRankClient(api_key="sk_mcp_rank_...", user_id="user_123")
  await client.initialize()

  # Revoke all tokens for this user
  await client.revoke_user_token()

  # Clear local state
  client.clear_user_token()
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "success": true
  }
  ```
</ResponseExample>

## What Gets Revoked

When you call this endpoint:

* **MCP Identity Token (MIT)** - Immediately invalidated
* **Refresh token** - Can no longer be used
* **Stored OAuth tokens** - Deleted from server (Google, etc.)

The user will need to re-authenticate to access their data again.

## When to Revoke Tokens

* **User logout** - When a user signs out of your application
* **Account disconnection** - When a user wants to disconnect their Google account
* **Security concerns** - If you suspect token compromise
* **User deletion** - When removing a user from your system

## Important Notes

<Info>
  Users can also revoke access from:

  * The MCP Rank dashboard
  * Their Google account settings (accounts.google.com/permissions)
</Info>

## Error Responses

| Status Code | Description                |
| ----------- | -------------------------- |
| 400         | Invalid user\_id           |
| 401         | Missing or invalid API key |
| 429         | Rate limit exceeded        |
