analysis

Analyze Document

Analyze a document by asking questions. Unlike /extract, this endpoint can compute, reason, and derive values that aren't explicitly written in the document.

Upload a file (or provide a URL) along with a typed schema. Each field must have a type and description.

Example schema:

{
  "total_cost": {"type": "number", "description": "Sum all line item amounts"},
  "is_auto_renew": {"type": "boolean", "description": "Does this contract auto-renew?"},
  "risk_level": {"type": "string", "enum": ["low", "medium", "high"], "description": "Legal risk level"}
}

Supported types: string, number, integer, boolean, array, object

Every answer includes:

  • The computed answer (type-enforced)
  • Reasoning explaining how it was derived
  • Source text snippets from the document
  • Confidence level

Pricing: 2 credits/page (min 5) for documents, 10 credits for websites.

post/api/v1/analyze

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
  • Auth: none declared

Headers

X-API-Keystring

Response

Successful Response

successboolean
dataobject required

Computed/derived values keyed by field name

confidenceobject

Per-field confidence scores (0.0–1.0)

sourcesobject

Per-field source text snippets from the document

reasoningobject

Per-field step-by-step explanation of how the answer was derived

stepsobject

Per-field agent reasoning trace (tool calls). Empty unless include_steps=true.

filenamestring required

Original filename or URL

content_typestring nullable

Detected MIME type

model_usedstring required

Model used for analysis

text_lengthinteger required

Length of extracted text

total_pagesinteger

Total pages in the document (0 for non-paginated files)

credits_usedinteger

Credits consumed

schema_format'typed'

Schema format used for extraction/analysis.

Example response

{
  "confidence": {
    "is_overdue": 0.72,
    "total_cost": 0.95
  },
  "content_type": "application/pdf",
  "credits_used": 10,
  "data": {
    "is_overdue": true,
    "total_cost": 1500
  },
  "filename": "invoice.pdf",
  "model_used": "gpt-5.1",
  "reasoning": {
    "is_overdue": "Due date 2025-01-15 has passed.",
    "total_cost": "Summed 3 line items: $500 + $600 + $400"
  },
  "sources": {
    "is_overdue": [
      "Due Date: January 15, 2025"
    ],
    "total_cost": [
      "Item A: $500",
      "Item B: $600",
      "Item C: $400"
    ]
  },
  "success": true,
  "text_length": 3200,
  "total_pages": 5
}

Changes

No recorded changes to this operation across all 1 revision of this API.