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

# Revoke Token

> Revoke a token for a Connected Apps client.

Revoke a token for the given Connected Apps client. This endpoint uses your [Custom Domain](/docs/connected-apps/resources/custom-domains).

This endpoint supports both [access tokens](../tokens/connected-app-access-token-object) and [refresh tokens](../tokens/connected-app-access-token-object#refresh-token).

If the token is a refresh token, the corresponding access token issued at the same time will also be revoked.

This endpoint is an [RFC-7009](https://www.rfc-editor.org/rfc/rfc7009) compliant token revocation endpoint.

* This endpoint supports passing the `client_id` and `client_secret` within the request body as well as within a [HTTP-Basic Auth](https://datatracker.ietf.org/doc/html/rfc6749#section-2.3.1) header.
* This endpoint supports the `application/x-www-form-urlencoded` content type.

<Info>
  We recommend using the [Custom Domain](/docs/connected-apps/resources/custom-domains) whenever possible. For backwards compatibility reasons, this endpoint is also available at [https://test.stytch.com/v1/public/\$\{projectId}/oauth2/revoke](https://test.stytch.com/v1/public/\$\{projectId}/oauth2/revoke).
</Info>

## Body

<ParamField body="token" type="string" required>
  The token to introspect.
</ParamField>

<ParamField body="token_type_hint" type="string">
  A hint for the type of the token. Possible values are `access_token` and `refresh_token`.
</ParamField>

<ParamField body="client_id" type="string" required>
  The ID of the Connected App client.
</ParamField>

<ParamField body="client_secret" type="string">
  The secret of the Connected App client. **Required for confidential clients**
</ParamField>

## Response

<ResponseField name="request_id" type="string">
  Globally unique UUID that is returned with every API call. This value is important to log for debugging purposes; we
  may ask for this value to help identify a specific API call when helping you debug an issue.
</ResponseField>

<ResponseField name="status_code" type="number">
  The HTTP status code of the response. Stytch follows standard HTTP response status code patterns, e.g. 2XX values
  equate to success, 3XX values are redirects, 4XX are client errors, and 5XX are server errors.
</ResponseField>

<Panel>
  <RequestExample>
    ```curl cURL theme={null}
    curl --request POST \
      --url https://${projectDomain}/v1/oauth2/revoke \
      -H 'Content-Type: application/x-www-form-urlencoded' \
      -d 'client_id=${exampleConnectedAppClientID} \
        &client_secret=${exampleConnectedAppClientSecret} \
        &token=eyJ...'

    ```
  </RequestExample>

  <ResponseExample>
    ```json 200 theme={null}
    {
      "request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
      "status_code": 200
    }
    ```

    ```json 404 theme={null}
    {
      "status_code": 404,
      "request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
      "error_type": "idp_client_not_found",
      "error_message": "The IDP client requested could not be found.",
      "error_url": "https://stytch.com/docs/api/errors/404"
    }
    ```

    ```json 429 theme={null}
    {
      "status_code": 429,
      "request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
      "error_type": "too_many_requests",
      "error_message": "Too many requests have been made.",
      "error_url": "https://stytch.com/docs/api/errors/429"
    }
    ```

    ```json 500 theme={null}
    {
      "status_code": 500,
      "request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
      "error_type": "internal_server_error",
      "error_message": "Oops, something seems to have gone wrong, please reach out to support@stytch.com to let us know what went wrong.",
      "error_url": "https://stytch.com/docs/api/errors/500"
    }
    ```
  </ResponseExample>
</Panel>
