API ReferenceAuth Flows
Revoke Session
Terminate a specific session by ID, logging out the device associated with that session.
Endpoint
DELETE /v1/sessions/{id}Base URL: https://api-id.avnology.net
Authentication: Required -- session token
Revokes a specific session, effectively logging out the device associated with that session. Users can only revoke their own sessions.
Request
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | The session ID to revoke |
Example Request
curl -X DELETE "https://api-id.avnology.net/v1/sessions/ses_9f8e7d6c-5b4a-3c2d-1e0f-9a8b7c6d5e4f" \
-H "Authorization: Bearer avnl_ses_a1b2c3d4..."Response
Success (204 No Content)
No response body. The session has been revoked.
Errors
| Status | Code | Description |
|---|---|---|
| 401 | AVNOLOGY_AUTH_005 | Invalid session token |
| 404 | AVNOLOGY_AUTH_901 | Session not found |
Code Examples
JavaScript (fetch)
async function revokeSession(sessionId, sessionToken) {
await fetch(`https://api-id.avnology.net/v1/sessions/${sessionId}`, {
method: 'DELETE',
headers: { 'Authorization': `Bearer ${sessionToken}` },
});
}Python (httpx)
import httpx
def revoke_session(session_id: str, session_token: str) -> None:
httpx.delete(
f"https://api-id.avnology.net/v1/sessions/{session_id}",
headers
Go (net/http)
func revokeSession(ctx context.Context, sessionID, sessionToken string) error {
url := fmt.Sprintf("https://api-id.avnology.net/v1/sessions/
Related
- List Sessions -- list sessions to find the one to revoke
- Logout -- log out the current session
- SDK:
client.auth.revokeSession(sessionId)(TypeScript)