RESTful API

API Reference

Build powerful applications with our comprehensive API

Quick Start

1
Get API Key

Sign up at the console and get your API key from the API settings page

2
Create Knowledge Base
POST /knowledge-bases
3
Upload & Query
POST /documents → POST /query

Authentication

All API requests require authentication using your API key in the X-API-Key header:

curl -X GET "API_BASE_URL/tenants/me" \
  -H "X-API-Key: YOUR_API_KEY"

API Endpoints

GET
/tenants/me

Get current tenant information including subscription details and limits

Response:

{
  "tenant_id": "string",
  "name": "string",
  "subscription_tier": "string",
  "created_at": "timestamp"
}

Example Request:

curl -X GET "API_BASE_URL/tenants/me" \
  -H "X-API-Key: YOUR_API_KEY"
GET
/tenants/me/usage

Get usage statistics for the current tenant

Response:

{
  "documents_count": "number",
  "qa_pairs_count": "number",
  "queries_count": "number",
  "storage_bytes": "number"
}

Example Request:

curl -X GET "API_BASE_URL/tenants/me/usage" \
  -H "X-API-Key: YOUR_API_KEY"

Error Responses

The API uses standard HTTP status codes to indicate success or failure. All error responses include a JSON body with an error message.

400
Bad Request

Invalid request parameters or missing required fields.

{
  "error": "Missing required field: knowledge_base_id"
}
401
Unauthorized

Invalid or missing API key.

{
  "error": "Invalid API key"
}
404
Not Found

The requested resource does not exist.

{
  "error": "Knowledge base not found"
}
429
Too Many Requests

Rate limit exceeded. Check your subscription tier.

{
  "error": "Rate limit exceeded. Try again in 60 seconds"
}
500
Internal Server Error

An unexpected error occurred on the server.

{
  "error": "Internal server error. Please try again later"
}

Rate Limits

Rate limits are applied per tenant based on your subscription tier. Exceeding these limits will result in a 429 error response.

Starter

  • 60 requests/minute
  • 1 concurrent workflow
  • 100 MB storage

Professional

  • 300 requests/minute
  • 5 concurrent workflows
  • 1 GB storage

Enterprise

  • Unlimited requests
  • Unlimited workflows
  • Unlimited storage

API Base URL

All API requests should be made to the following base URL:

API_BASE_URL

Replace API_BASE_URL with your actual API endpoint. You can find this in your dashboard settings or contact support for your specific endpoint URL.

Webhooks & Workflows

Long-running operations like document processing, video generation, and batch operations are handled asynchronously through workflows.

Workflow Status Polling

After initiating a workflow, you'll receive a workflow_id. Use the status endpoint to poll for completion:

GET /workflows/{workflow_id}/status

Response:
{
  "id": "wf_abc123",
  "status": "completed" | "running" | "failed",
  "progress": 75,
  "result": { ... }
}

Best Practices

  • Poll the status endpoint every 5-10 seconds for workflow updates
  • Implement exponential backoff if the workflow is taking longer than expected
  • Handle both success and failure states appropriately
  • Set reasonable timeouts (e.g., 10 minutes for video generation)