Start typing to search.

API Reference

Get current user

View Markdown

Returns the current user from the session cookie. Does not support API key auth.

GET /api/auth/me

Returns the current user from the session cookie. Does not support API key auth.

Operation ID: getCurrentUser

Authentication

  • CookieAuth (apiKey) Session cookie set after login + TOTP verification

Success responses

200

Current user info

Content type: application/json

  • Type: object
  • Properties:
    • id (integer)
    • username (string)
    • role (string)
      • Allowed values: superadmin, admin, viewer

Error responses

401

Not authenticated

Content type: application/json

  • Reference: Error
    • Type: object
    • Properties:
      • error (string)
        • Example: NOT_FOUND
      • message (string)
        • Example: Resource not found

Example:

{
  "error": "AUTH_ERROR",
  "message": "Not authenticated"
}

Examples

cURL

curl --request GET \
  --url 'https://your-envoy.example.com/api/auth/me' \
  --cookie 'envoy_session=YOUR_API_KEY'

JavaScript (fetch)

const response = await fetch('https://your-envoy.example.com/api/auth/me', {
  method: 'GET',
  credentials: 'include',
});
 
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = response.status === 204 ? null : await response.json();
console.log(data);