Skip to main content
GET
/
v2
/
files
/
{collection_id}
/
extraction
curl -X GET 'https://api.anyformat.ai/v2/files/b2c3d4e5-f6a7-8901-bcde-f12345678901/extraction/' \
  -H 'Authorization: Bearer YOUR_API_KEY'
{
  "invoice_number": {
    "value": "INV-001",
    "confidence": 95,
    "evidence": [{"text": "Invoice #INV-001", "page_number": 1}],
    "verification_status": "not_verified",
    "value_unit": null
  },
  "total_amount": {
    "value": "1250.00",
    "confidence": 92,
    "evidence": [{"text": "Total: $1,250.00", "page_number": 1}],
    "verification_status": "not_verified",
    "value_unit": null
  }
}
Retrieve results for a file. This is the primary polling endpoint for checking status.
The collection_id in the URL is the id returned by POST /v2/files/ or POST /v2/workflows/{id}/run/.
The endpoint returns:
  • 412 Precondition Failed while processing is in progress
  • 200 OK with the extracted data when processing is complete
Prefer webhooks over polling for production integrations. Webhooks deliver results immediately without consuming your rate limit.

Query Parameters

ParameterTypeDescription
as_listsstringTransform single-value fields to arrays for consistent formatting. Pass "true" or "false" as string values.

Polling Example with Backoff

import time
import anyformat
from anyformat import Anyformat

client = Anyformat()
file_id = "b2c3d4e5-f6a7-8901-bcde-f12345678901"

max_attempts = 60
base_delay = 5

for attempt in range(max_attempts):
    try:
        results = client.files.get_extraction_results(file_id)
        print(results)
        break
    except anyformat.APIStatusError as e:
        if e.status_code == 412:
            delay = min(base_delay * (1.5 ** min(attempt, 5)), 30)
            time.sleep(delay)
        elif e.status_code == 429:
            time.sleep(10)
        else:
            print(f"Error: {e.message}")
            break
else:
    print("Polling timed out — consider using webhooks for production")
curl -X GET 'https://api.anyformat.ai/v2/files/b2c3d4e5-f6a7-8901-bcde-f12345678901/extraction/' \
  -H 'Authorization: Bearer YOUR_API_KEY'
{
  "invoice_number": {
    "value": "INV-001",
    "confidence": 95,
    "evidence": [{"text": "Invoice #INV-001", "page_number": 1}],
    "verification_status": "not_verified",
    "value_unit": null
  },
  "total_amount": {
    "value": "1250.00",
    "confidence": 92,
    "evidence": [{"text": "Total: $1,250.00", "page_number": 1}],
    "verification_status": "not_verified",
    "value_unit": null
  }
}

Headers

authorization
string | null

Path Parameters

collection_id
string
required

Response

Successful Response