Docs/API Reference

Endpoints Overview

All available API endpoints at a glance.

Every endpoint below lives under your base URL, so /v1/chat/completions means https://api.tarqaai.com/api/v1/chat/completions. All of them need an API key.

Base URL

In production that's https://api.tarqaai.com, e.g. https://api.tarqaai.com/v1/chat/completions. For local development it's http://localhost:3001/api (different host and an /api prefix; everything else is identical).

Chat & inference

POST/v1/chat/completions
The main endpoint. OpenAI-compatible chat: system messages, multi-turn, streaming and tool calling. See Chat API.
POST/v1/ask?model=model_name
A minimal single-turn endpoint: one question in, one answer out.
GET/v1/models
The authoritative list of model IDs you can pass as model. Read IDs from here instead of hard-coding them, since examples in these docs can lag behind.

RAG (your own documents)

POST/v1/context/conversations/create
Create a RAG conversation, the container for a knowledge base.
POST/v1/rag/index
Index documents so they can be searched.
POST/v1/rag/search
Semantic search across indexed documents, with relevance scores.
POST/v1/rag/chat
Chat with the AI using your indexed documents as context.
GET/v1/rag/stats/:conversationId
Index statistics for a conversation.

API keys & analytics

GET/v1/keys
List the API keys in the current workspace. Add ?teamId=<id> for a team workspace; leave it out for personal.
POST/v1/keys
Create a key. Body: key_name (string), expires_in_days (number, optional), team_id (string, optional; binds the key to that team, leave out for a personal key). The key itself is returned once.
DELETE/v1/keys/:id
Revoke a key. Takes effect within about 5 minutes.
GET/v1/keys/:id/analytics
Real-time analytics for one key. See API Key Analytics.

Webhooks

GET/v1/webhooks
List your webhook endpoints.
POST/v1/webhooks
Register a webhook. Body: name, url, events[]. Returns the signing secret once. See Webhooks.
POST/v1/webhooks/:id/test
Send a webhook.test delivery to the endpoint.
GET/v1/webhooks/:id/deliveries
Recent delivery attempts for a webhook.

System

GET/api/health
Health check for uptime monitors and load-balancer probes.