> ## Documentation Index
> Fetch the complete documentation index at: https://docs.60db.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# API Reference

> Complete API reference for 60db

## Base URL

```
https://api.60db.ai
```

## Authentication

All API requests require authentication using an API key in the `Authorization` header:

```bash theme={null}
Authorization: Bearer your-api-key
```

## Response Format

All API responses are returned in JSON format unless otherwise specified.

### Success Response

```json theme={null}
{
  "success": true,
  "data": { ... }
}
```

### Error Response

```json theme={null}
{
  "success": false,
  "error": "Error type",
  "message": "Detailed error message"
}
```

## HTTP Status Codes

| Status Code | Description                                             |
| ----------- | ------------------------------------------------------- |
| 200         | Success                                                 |
| 201         | Created                                                 |
| 202         | Accepted (queued for async processing)                  |
| 400         | Bad Request                                             |
| 401         | Unauthorized                                            |
| 402         | Insufficient credits — workspace wallet balance too low |
| 403         | Forbidden                                               |
| 404         | Not Found                                               |
| 413         | Payload Too Large                                       |
| 422         | Unprocessable Entity (validation or extraction fail)    |
| 429         | Too Many Requests                                       |
| 500         | Internal Server Error                                   |
| 503         | Service Unavailable                                     |

## Rate Limiting

API requests are rate-limited based on your subscription plan. Rate limit information is included in response headers:

* `X-RateLimit-Limit`: Maximum requests allowed
* `X-RateLimit-Remaining`: Remaining requests in current window
* `X-RateLimit-Reset`: Time when the rate limit resets (Unix timestamp)

## Pagination

List endpoints support pagination using query parameters:

* `page`: Page number (default: 1)
* `limit`: Items per page (default: 20, max: 100)

```bash theme={null}
GET /voices?page=2&limit=50
```

Response includes pagination metadata:

```json theme={null}
{
  "data": [...],
  "pagination": {
    "page": 2,
    "limit": 50,
    "total": 150,
    "pages": 3
  }
}
```

## Endpoints Overview

### Text-to-Speech

* `POST /tts-synthesize` - Convert text to speech

### Speech-to-Text

* `POST /stt` - Transcribe audio to text
* `GET /stt/languages` - Get supported languages

### Voices

* `GET /voices` - List all voices

### Memory & RAG

* `POST /memory/ingest` - Store a single memory (user/knowledge/hive)
* `POST /memory/ingest/batch` - Batch-store up to 100 memories
* `POST /memory/documents/extract` - Upload a document (PDF, DOCX, XLSX, images) for extraction + OCR + chunked ingest
* `POST /memory/search` - Hybrid semantic + keyword recall
* `POST /memory/context` - Assemble an LLM-ready context string for RAG
* `GET /memory/collections` - List collections in the workspace
* `POST /memory/collections` - Create a team/knowledge/hive collection
* `GET /memory/usage` - Monthly spend breakdown and wallet balance

Memory endpoints are billed **pay-as-you-go** from the workspace wallet (see [Memory Pricing](/api-reference/memory/pricing) for rates). Every billable response includes `x-credit-balance`, `x-credit-charged`, and `x-billing-tx` headers so you can track spend in real time. When the wallet is empty, billable endpoints return `402 INSUFFICIENT_CREDITS` with a structured `details.shortfall` body so your client can prompt for top-up.

### LLM Chat

* `POST /v1/chat/completions` - OpenAI-compatible chat completions

### Billing & Usage

Each workspace has its own **USD wallet**. All service operations (TTS, STT, LLM, Memory) deduct from the workspace wallet. Funds are added via the [Dashboard](https://app.60db.ai). Only workspace owners can access billing endpoints.

* `GET /billing/usage-logs` - Per-operation deduction history (TTS, STT, LLM, Memory)
* `GET /billing/transactions` - Payment history (top-ups, subscriptions)

All billing endpoints require `billing:manage` permission (workspace owner only). Non-owners receive `403 Forbidden`.

## SDKs

We provide official SDKs for popular programming languages:

<CardGroup cols={2}>
  <Card title="JavaScript/TypeScript" icon="js" href="/sdks/javascript">
    npm install 60db
  </Card>

  <Card title="Python" icon="python" href="/sdks/python">
    pip install 60db
  </Card>
</CardGroup>
