> ## 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.
</Note>

<CardGroup cols={3}>
  <Card title="Extract" icon="file-export" href="/developer/quickstart">
    Pull structured fields from a document. Fast, schema-enforced, type-safe.
  </Card>

  <Card title="Analyze" icon="magnifying-glass-chart" href="/developer/analyze">
    Compute, reason, and derive answers that aren't explicitly written in the document.
  </Card>

  <Card title="Cross-Analyze" icon="code-compare" href="/developer/cross-analyze">
    Validate and cross-reference across 2-5 documents simultaneously.
  </Card>
</CardGroup>

## 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

<CodeGroup>
  ```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
  ```
</CodeGroup>

## Define schemas your way

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

<CodeGroup>
  ```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),
  });
  ```
</CodeGroup>

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

<CodeGroup>
  ```bash Python theme={null}
  pip install thedriveai
  ```

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

## 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)         |
| Markdown      | 1 credit                                        |
| Thumbnail     | 1 credit                                        |

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