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

# Revoke API key

> Permanently deactivate an API key

## Authentication

Requires `x-auth-token` and `x-device-id` headers. Obtain these by calling the [login endpoint](/api-reference/user/login).

## Path parameters

<ParamField path="keyId" type="string" required>
  The ID of the API key to revoke.
</ParamField>

## Example request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X DELETE https://relay.bayse.markets/v1/user/me/api-keys/3f7a1b2c-d4e5-6789-abcd-ef0123456789 \
    -H "x-auth-token: YOUR_AUTH_TOKEN" \
    -H "x-device-id: YOUR_DEVICE_ID"
  ```

  ```javascript Node.js theme={null}
  await fetch(
    'https://relay.bayse.markets/v1/user/me/api-keys/3f7a1b2c-d4e5-6789-abcd-ef0123456789',
    {
      method: 'DELETE',
      headers: {
        'x-auth-token': 'YOUR_AUTH_TOKEN',
        'x-device-id': 'YOUR_DEVICE_ID',
      },
    }
  );
  ```

  ```python Python theme={null}
  import requests

  requests.delete(
      'https://relay.bayse.markets/v1/user/me/api-keys/3f7a1b2c-d4e5-6789-abcd-ef0123456789',
      headers={
          'x-auth-token': 'YOUR_AUTH_TOKEN',
          'x-device-id': 'YOUR_DEVICE_ID',
      },
  )
  ```

  ```go Go theme={null}
  req, _ := http.NewRequest(
      "DELETE",
      "https://relay.bayse.markets/v1/user/me/api-keys/3f7a1b2c-d4e5-6789-abcd-ef0123456789",
      nil,
  )
  req.Header.Set("x-auth-token", "YOUR_AUTH_TOKEN")
  req.Header.Set("x-device-id", "YOUR_DEVICE_ID")
  http.DefaultClient.Do(req)
  ```
</CodeGroup>

## Response

<ResponseExample>
  ```json 200 OK theme={null}
  {
    "message": "API key revoked"
  }
  ```
</ResponseExample>

<Warning>
  Revoking a key is permanent. Any requests signed with the revoked key will immediately start returning 401. If you need to replace a key, use [Rotate API key](/api-reference/user/rotate-api-key) instead.
</Warning>
