API Reference
Quick reference for all Egret API endpoints.
Base URL
https://api.getegret.com
Authentication
Most endpoints require one of:
- API key:
Authorization: Bearer egret_...orX-API-Key: egret_... - JWT access token:
Authorization: Bearer eyJ...— required for API key management endpoints
Endpoints marked public require no authentication. See Authentication for details.
Endpoints
| Method | Path | Auth | Description |
|---|---|---|---|
POST | /auth/jwt/create/ | — | Login — obtain JWT access & refresh tokens |
POST | /auth/jwt/refresh/ | — | Refresh an access token |
GET | /v1/domains/ | Public | List all available domains |
GET | /v1/domains/{slug}/ | Public | Domain detail with embedded categories |
GET | /v1/domains/{slug}/categories/ | Public | List categories for a domain |
GET | /v1/models/ | API key | List available AI models |
POST | /v1/query/ | API key | Submit a RAG query (streaming or non-streaming) |
GET | /v1/sessions/recent/ | API key | List recent sessions |
GET | /v1/sessions/{id}/messages/ | API key | Get message history for a session |
POST | /v1/sessions/{id}/rename/ | API key | Rename a session |
DELETE | /v1/sessions/{id}/delete/ | API key | Delete a session |
GET | /v1/orgs/ | JWT | List organizations |
GET | /v1/orgs/{slug}/ | JWT | Get organization detail |
PATCH | /v1/orgs/{slug}/ | JWT | Update organization name or allowed domains |
GET | /v1/billings/api-keys/ | JWT | List API keys |
POST | /v1/billings/api-keys/ | JWT | Create an API key |
PATCH | /v1/billings/api-keys/{id}/update/ | JWT | Set or clear key expiration |
POST | /v1/billings/api-keys/{id}/rotate/ | JWT | Rotate (replace) an API key |
GET | /v1/billings/plans/ | Public | List available subscription plans |
GET | /v1/billings/subscription/ | API key | Get current subscription and credit quota |
GET | /health/ | Public | API health check |
Response format
All endpoints return JSON. Successful responses use 200, 201, or 204. Errors return a JSON object with a detail field. See Error Codes for the full list.