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/api

Authentication

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_KEY

Endpoints

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 chats
  • POST /api/chats — Create a chat
  • GET /api/chats/:id — Get a chat and its messages
  • POST /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