Skip to main content

Base URL

All API requests use this base URL:
https://api.vaani.ai
For local development:
http://localhost:8000

Authentication

The Vaani API supports two authentication methods: Authenticate by including the JWT access token as a cookie:
curl -X GET "https://api.vaani.ai/agents" \
  -H "Cookie: access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
Obtaining a token:
curl -X POST "https://api.vaani.ai/auth/login" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "[email protected]",
    "password": "your_password"
  }'

2. API Key (Header-based)

For server-to-server integrations, use an API key:
curl -X GET "https://api.vaani.ai/agents" \
  -H "x-api-key: vk_live_abc123def456..."
API keys are workspace-scoped — they can only access data within the workspace they were created in. See API Keys for creation instructions.

Workspace Selection

For JWT-authenticated requests, specify the workspace context with the X-Workspace-Id header:
curl -X GET "https://api.vaani.ai/agents" \
  -H "Cookie: access_token=YOUR_TOKEN" \
  -H "X-Workspace-Id: 550e8400-e29b-41d4-a716-446655440000"
If omitted, the user’s current_workspace_id is used.

HTTP Methods

MethodUsage
GETRetrieve resources
POSTCreate a resource or trigger an action
PATCHPartially update a resource
PUTFully replace a resource
DELETERemove a resource

Common Headers

HeaderRequiredDescription
Content-TypeYes (POST/PUT/PATCH)Always application/json
CookieYes (if JWT auth)access_token=YOUR_TOKEN
x-api-keyYes (if API key auth)Your workspace API key
X-Workspace-IdOptionalOverride active workspace

Standard Error Response

All errors follow a consistent format:
{
  "detail": "Error message describing what went wrong"
}

HTTP Status Codes

CodeMeaningCommon Cause
200SuccessRequest completed normally
201CreatedResource created successfully
400Bad RequestInvalid input, missing required fields
401UnauthorizedMissing or invalid authentication
403ForbiddenInsufficient role/permissions
404Not FoundResource doesn’t exist or not in your workspace
409ConflictDuplicate resource (e.g., phone number already registered)
422Validation ErrorRequest body fails Pydantic schema validation
500Server ErrorInternal error — contact support

Validation Error Format

For 422 errors, the response includes field-level details:
{
  "detail": [
    {
      "loc": ["body", "agent_name"],
      "msg": "field required",
      "type": "value_error.missing"
    }
  ]
}

Pagination

Endpoints that return lists support cursor-based pagination:
ParameterTypeDefaultDescription
pageinteger1Page number
page_sizeinteger25Items per page
curl "https://api.vaani.ai/calls/logs?page=2&page_size=50" \
  -H "Cookie: access_token=YOUR_TOKEN"
Response includes pagination metadata:
{
  "items": [...],
  "total": 150,
  "page": 2,
  "page_size": 50,
  "total_pages": 3
}

Rate Limiting

Rate limiting is not currently implemented. All endpoints accept unlimited requests. This may change in a future release.