---
title: "Cross-Document Analysis"
method: POST
path: "/api/v1/analyze/cross"
tags: ["analysis"]
---

# Cross-Document Analysis

`POST /api/v1/analyze/cross`

## Request

- Base URL: `https://docs.thedrive.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://docs.thedrive.ai/api/v1/analyze/cross`
- Auth: none declared

Analyze and cross-reference multiple documents together. Unlike `/analyze` (single
document) or `/analyze/batch` (many documents independently), this endpoint lets
the agent reason **across** all documents simultaneously.

**Use cases**:
- Validate an invoice against a contract or purchase order
- Check that a report's numbers match a source spreadsheet
- Compare terms across multiple agreements
- Reconcile data from different sources

Upload 2-5 files and/or provide URLs. Each document gets a label (auto-generated
from filename, or you can provide custom labels). The agent can search, read, and
compare data across all documents.

Provide a typed schema — each field has a type and description.

**Example**:
```json
{
  "rates_match": {"type": "boolean", "description": "Do the hourly rates on the invoice match the contract?"},
  "total_valid": {"type": "boolean", "description": "Does the invoice total equal the sum of line items?"},
  "correct_vendor": {"type": "boolean", "description": "Is the vendor name on the invoice the same as the contracting party?"}
}
```

**Pricing**: 5 credits/document + 3 credits/page (minimum 10).

## Headers

- `X-API-Key` string

## Response `200`

Successful Response

- CrossAnalyzeResponse: Response for cross-document analysis — flat parallel dicts matching /extract.
  - `success` boolean
  - `data` object, required: Computed/derived values keyed by field name
  - `confidence` object: Per-field confidence scores (0.0–1.0)
  - `sources` object: Per-field source text snippets (prefixed with [doc_label])
  - `reasoning` object: Per-field step-by-step explanation referencing specific documents
  - `steps` object: Per-field agent reasoning trace. Empty unless include_steps=true.
  - `documents` DocumentInfo[], required: Metadata for each document in the analysis
    - `label` string, required: Document label used in the analysis
    - `filename` string, required: Original filename or URL
    - `content_type` string, nullable: Detected MIME type
    - `total_pages` integer: Number of pages in this document
    - `text_length` integer: Length of extracted text
  - `model_used` string, required: Model used for analysis
  - `total_text_length` integer, required: Combined text length across all documents
  - `total_pages` integer, required: Combined page count across all documents
  - `credits_used` integer: Credits consumed
  - `schema_format` 'typed': Schema format used for extraction/analysis.

## Other responses

- `400`: Invalid request
- `413`: File too large
- `422`: Validation Error
- `500`: Analysis or extraction failed
- `503`: AI service unavailable
- `504`: Analysis timed out

---

[API](https://skmtc.dev/thedrive/apis/the-drive-ai-api.md) · [All operations](https://skmtc.dev/thedrive/apis/the-drive-ai-api/llms.txt) · [OpenAPI document](https://skmtc.dev/thedrive/apis/the-drive-ai-api/revisions/ee4e32647ebf?raw)
