Endpoint Reference
Use the extraction API to submit documents and retrieve structured results. Create your templates and filters in the app, then select them by name in your requests.
Base URL And Authentication
Section titled “Base URL And Authentication”Send requests to https://api.terrafai.com with your environment’s API key:
Authorization: api-key <environment-api-key>See Authentication & Errors to create a key. The key determines which environment’s templates, filters, and jobs you can use.
Endpoints
Section titled “Endpoints”| Method and path | What it does |
|---|---|
POST /api/v1/extractFields | Extracts a file and returns the result in the same request. See Synchronous Extraction. |
POST /api/v1/extraction-jobs | Creates a job and returns its ID. Use this when your backend needs to retrieve results later or receive a webhook. See Asynchronous Extraction. |
GET /api/v1/extraction-jobs/:id | Returns the job’s status. |
GET /api/v1/extraction-jobs/:id/result | Returns the completed extraction result. |
Both upload endpoints accept an optional
X-Client-Reference header to connect requests to
records in your system. Async job creation also accepts an
Idempotency-Key for safe retries.
Set Up In The App
Section titled “Set Up In The App”Manage templates, filters, workflows, webhook endpoints, document review, API keys, and usage in the app. Start with Templates, Filters & Workflows to prepare your extraction setup.