API Reference
Use the OnionAI API for programmatic access to chats, queries, and integrations. This page outlines base URLs, authentication, and common endpoints.
Base URL
All API requests use the base URL of your deployment, for example:
https://ai.onion.az/apiAuthentication
Authenticate using session cookies (for browser-based clients) or an API key in the Authorization header. API keys can be created from your account settings. Include the key as:
Authorization: Bearer YOUR_API_KEYEndpoints
Core resources are available under REST-style paths. Exact endpoint definitions (request/response schemas, error codes) are available in the OpenAPI spec when the API is enabled for your instance.
GET /api/chats— List your chatsPOST /api/chats— Create a chatGET /api/chats/:id— Get a chat and its messagesPOST /api/chats/:id/messages— Send a message and get an AI response
Rate limits
Requests are rate-limited per account. Rate limit headers are included in responses. When exceeded, the API returns 429 Too Many Requests. Use exponential backoff for retries.
Webhooks
Webhooks (e.g. for chat or alert events) can be configured in your workspace settings. Outgoing payloads are signed; verify the signature using the secret provided in the dashboard.
Next steps
- Authentication — Session and API key security
- Security & Compliance — Audit and data handling