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

# Developer Platform

> Extract, analyze, and cross-reference any document with a single API call

The same document intelligence that powers [The Drive AI](https://thedrive.ai), available as an API. Upload a PDF, spreadsheet, image, or URL — get back typed JSON matching your schema.

> [!NOTE]
>
> This is not a full API for The Drive AI product. These are standalone document intelligence endpoints — the same ones we use internally — exposed for developers and AI agents that need to process documents programmatically.

> [card] [Extract](https://docs.thedrive.ai/developer/quickstart.md)
>
> Pull structured fields from a document. Fast, schema-enforced, type-safe.

> [card] [Analyze](https://docs.thedrive.ai/developer/analyze.md)
>
> Compute, reason, and derive answers that aren't explicitly written in the document.

> [card] [Cross-Analyze](https://docs.thedrive.ai/developer/cross-analyze.md)
>
> Validate and cross-reference across 2-5 documents simultaneously.

## How it works

1. Define a schema — describe the fields you want, with types
2. Send a document — upload a file or pass a URL
3. Get structured data — typed JSON, confidence scores, source citations

```python Python theme={null}
from thedriveai import TheDriveAI

client = TheDriveAI(api_key="tda_live_...")

result = client.extract(
    file="invoice.pdf",
    schema={
        "vendor": {"type": "string", "description": "Company name"},
        "total": {"type": "number", "description": "Total amount due"},
        "line_items": {
            "type": "array",
            "description": "Each line item",
            "items": {
                "type": "object",
                "properties": {
                    "description": {"type": "string"},
                    "amount": {"type": "number"}
                }
            }
        }
    },
)

print(result.data["vendor"])      # "Acme Corp"
print(result.data["total"])       # 1234.56
print(result.confidence["total"]) # 0.95
```

```typescript TypeScript theme={null}
import { TheDriveAI } from "@thedriveai/sdk";

const client = new TheDriveAI({ apiKey: "tda_live_..." });

const result = await client.extract({
  file: readFileSync("invoice.pdf"),
  schema: {
    vendor: { type: "string", description: "Company name" },
    total: { type: "number", description: "Total amount due" },
  },
});

console.log(result.data.vendor); // "Acme Corp"
console.log(result.data.total);  // 1234.56
```

## Define schemas your way

Write raw JSON, or use Pydantic (Python) and Zod (TypeScript) to define schemas with the tools you already use.

```python Pydantic theme={null}
from pydantic import BaseModel, Field
from thedriveai import TheDriveAI

class Invoice(BaseModel):
    vendor: str = Field(description="Company name")
    total: float = Field(description="Total amount due")
    is_paid: bool = Field(description="Whether the invoice is paid")

client = TheDriveAI(api_key="tda_live_...")
result = client.extract(file="invoice.pdf", schema=Invoice)
```

```typescript Zod theme={null}
import { TheDriveAI, fromZod } from "@thedriveai/sdk";
import { z } from "zod";

const Invoice = z.object({
  vendor: z.string().describe("Company name"),
  total: z.number().describe("Total amount due"),
  is_paid: z.boolean().describe("Whether the invoice is paid"),
});

const client = new TheDriveAI({ apiKey: "tda_live_..." });
const result = await client.extract({
  file: readFileSync("invoice.pdf"),
  schema: fromZod(Invoice),
});
```

The SDK converts your Pydantic models and Zod schemas to the typed format automatically — including nested objects, arrays, enums, and optional fields.

## Supported formats

| Category | Formats |
| - | - |
| Documents | PDF, DOCX, DOC, ODT, RTF |
| Spreadsheets | XLSX, CSV, TSV |
| Presentations | PPTX |
| Data | JSON, XML |
| Images | JPG, PNG, TIFF, WEBP |
| Web | Any public URL (rendered with a headless browser) |

## Authentication

All requests require an `X-API-Key` header. Get your key at [dev.thedrive.ai](https://dev.thedrive.ai).

```bash theme={null}
curl -X POST https://dev.thedrive.ai/api/v1/extract \
  -H "X-API-Key: tda_live_..." \
  -F file=@invoice.pdf \
  -F 'schema={"vendor": {"type": "string", "description": "Company name"}}'
```

## Install

```bash Python theme={null}
pip install thedriveai
```

```bash TypeScript theme={null}
npm install @thedriveai/sdk
```

## Pricing

| Endpoint | Cost |
| - | - |
| Extract | 1 credit/page (min 3), 5 credits for websites |
| Analyze | 2 credits/page (min 5), 10 credits for websites |
| Cross-Analyze | 5 credits/doc + 3 credits/page (min 10) |
| Decide | 2 credits/page (min 5), 10 credits for websites, 5 credits with no document |
| Markdown | 1 credit |
| Thumbnail | 1 credit |

Free tier includes 100 credits/month. [Purchase more](https://dev.thedrive.ai/dashboard/billing).

## Rate limits

Each API key can make a limited number of requests a minute: 30 on the free tier, and more on paid tiers. Past that, and when your credits run out, the API returns `429` with a `Retry-After` header. The SDKs retry `429` responses automatically, waiting as long as `Retry-After` says.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.