Get Current Session
Retrieve information about your currently authenticated session. Endpoint:GET /sessions/@me
Get Session Info
The Discord user ID associated with this session
The unique session identifier (UUID)
The user’s account state. Possible values:
normal- Account is in good standingbanned- Account is banned from using the API
The session type. Possible values:
login- Standard OAuth2 web login (1 hour expiry)app_login- Application login with PKCE (14 days expiry)api- API token with custom expiry
List User Sessions
Retrieve a list of all active sessions for the authenticated user. Endpoint:GET /sessions
List Sessions
Array of active session objects
Session tokens are never returned in list responses for security reasons. Tokens are only provided when creating a new session.
Create API Token
Create a new API token for programmatic access. Endpoint:POST /sessions
Create API Token
A descriptive name for the API token (helps identify tokens when managing multiple sessions)
Must be
"api". Only API tokens can be created via this endpoint.Token expiry time in seconds from now. Must be between 0 and 9223372036854775 (approximately 292 million years).Common values:
- 3600 = 1 hour
- 86400 = 1 day
- 604800 = 1 week
- 2592000 = 30 days
- 31536000 = 1 year
The Discord user ID
The newly created API token. Save this immediately - it won’t be shown again!
The unique identifier for this session
ISO 8601 timestamp when the token expires
Always null for API token creation (user info is only returned for OAuth2 logins)
Delete Session
Revoke a session by deleting it. This is useful for logging out or removing compromised tokens. Endpoint:DELETE /sessions/{session_id}
Delete Session
The UUID of the session to delete. You can only delete sessions that belong to your user.
- A successful deletion returns HTTP 204 (No Content) with an empty response body
- You can only delete your own sessions
- Deleted sessions are immediately invalidated and cannot be used for further API requests
Session Management Best Practices
Session Lifecycle
- Create - Generate a new session via OAuth2 or API token creation
- Use - Include the token in the
Authorizationheader for all requests - Monitor - Periodically list sessions to audit active access
- Expire - Sessions automatically expire based on their type or custom expiry
- Delete - Manually revoke sessions that are no longer needed
Expiry Times by Session Type
| Session Type | Default Expiry | Configurable |
|---|---|---|
| login | 1 hour | No |
| app_login | 14 days | No |
| api | Custom | Yes (at creation) |
Error Handling
Use Cases
Rotate API Tokens
Token Rotation
Audit Active Sessions
Session Audit