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

# Sign Out and Revoke Your Current Active Pay3 Session

> Invalidate your current Pay3 session token and clear the session cookie. Safe to call unconditionally even if no active session is present.

Calling this endpoint immediately revokes your current Pay3 session. The server marks the session token as revoked so it cannot be reused, and clears the `pay3_session` cookie in the response. After logout, any subsequent request using the same session token or cookie will receive a `401 Unauthorized` response.

## Endpoint

**`POST /api/auth/logout`**

Authentication is **optional**. If a valid `pay3_session` cookie or `Authorization: Bearer <session-token>` header is present, the session is revoked. If no token is present or the token has already expired, the endpoint still returns `204 No Content` and clears the cookie — it is safe to call unconditionally during a sign-out flow.

***

## Request Body

No request body is required for this endpoint.

***

## Response

A successful logout returns `204 No Content` with an empty body. The `pay3_session` cookie is cleared via the `Set-Cookie` response header.

> [!NOTE]
>
> There is no JSON body in the response. A `204` status with no content is the
> only success indicator.

***

## Example

### Using the session cookie (browser)

```bash theme={null}
curl --request POST \
  --url https://api.pay3.dev/api/auth/logout \
  --cookie 'pay3_session=your-session-token-here'
```

### Using a Bearer token (server-to-server)

```bash theme={null}
curl --request POST \
  --url https://api.pay3.dev/api/auth/logout \
  --header 'Authorization: Bearer your-session-token-here'
```

### Response

```
HTTP/1.1 204 No Content
Set-Cookie: pay3_session=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT; HttpOnly; SameSite=Strict
```

***

## Error Responses

| HTTP Status | Description |
| - | - |
| `401 Unauthorized` | The session token is structurally invalid (malformed header or cookie value). A missing or already-expired token will still return `204`. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.