# Logout

{% hint style="info" %}
End a user session.
{% endhint %}

**Endpoint:** `/user/logout`\
**Method:** POST

{% tabs %}
{% tab title="Request Body" %}

```typescript
{
    sessionJwt: string; // Active session JWT
}
```

{% endtab %}

{% tab title="Success Response (200)" %}

```typescript
{
    message: string;
}
```

{% endtab %}

{% tab title="Error Response (404)" %}

```typescript
{
    error: string;
}
```

{% endtab %}
{% endtabs %}

## Example Usage

```javascript
const timestamp = Date.now().toString();
const body = {
    sessionJwt: 'eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9...' // Active session JWT
};

const hmac = generateHmacSignature(timestamp, body, secretKey);

const response = await axios.post(apiEndpoint + '/user/logout', body, {
    headers: {
        apikey: apiKey,
        signature: hmac,
        timestamp: timestamp
    }
});
```

{% hint style="info" %}
After logout, the session JWT becomes invalid and cannot be used for further API calls.
{% endhint %}

{% hint style="warning" %}
Always clean up session data in your application after a successful logout.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://dev.plyr.network/api-reference/users/authentication/plyr-id/logout.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
