> ## 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 Session

> Revoke Session using the Stytch React SDK

Wraps the [Revoke](/docs/api-reference/consumer/api/sessions/revoke-session) Session endpoint and revokes the user's current session. This method should be used to log out a user. While calling this method, we clear the user and session objects from the cache unless the SDK cannot contact the Stytch servers. This behavior can be overriden by using the optional param object.

## Parameters

<ParamField body="Configuration" type="object">
  Additional configuration.

  <Expandable title="properties">
    <ParamField body="forceClear" type="boolean" default="false">
      When true, clear the user and session object in the cache, even in the event of a network failure revoking the session.
      When false, the user and session object will not be cleared in the event that the SDK cannot contact the Stytch servers.
      The user and session object will always be cleared when the session revoke call succeeds.
    </ParamField>
  </Expandable>
</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>
    ```jsx theme={null}
    import { useCallback } from 'react';
    import { useStytch } from '@stytch/react';

    export const LogOutButton = () => {
    const stytch = useStytch();

    const logout = useCallback(() => {
      stytch.session.revoke();
    }, [stytch]);

    return <button onClick={logout}>Log out</button>;
    };
    ```
  </RequestExample>

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

    ```json 400 theme={null}
    {
      "status_code": 400,
      "request_id": "request-id-test-b05c992f-ebdc-489d-a754-c7e70ba13141",
      "error_type": "invalid_session_id",
      "error_message": "session_id format is invalid.",
      "error_url": "https://stytch.com/docs/api/errors/400"
    }
    ```

    ```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>
