Skip to content

List Extractions

GET /v1/extractions

List extraction records for the authenticated user. Results are returned in reverse chronological order (newest first). Supports cursor-based pagination and filtering by template, batch run, or date range.

Try it

Test this endpoint interactively in the Swagger UI.

Authorization required

Include your API key in the Authorization header.

Request

Headers

HeaderValueRequired
AuthorizationBearer <token>Yes

Query Parameters

ParamTypeRequiredDescription
templateIdstringNoFilter results to extractions from a specific template.
runIdstringNoFilter results to extractions from a specific batch run. Returns all matching results (ignores limit/cursor).
limitnumberNoMaximum number of results to return. Default: 50, maximum: 100.
cursorstringNoPagination cursor. Pass the createdAt value of the last item from the previous page to fetch the next page.
dateFromstringNoFilter to extractions created on or after this date (YYYY-MM-DD).
dateTostringNoFilter to extractions created on or before this date (YYYY-MM-DD).

Pagination

The response includes a hasMore boolean. When true, pass the createdAt value of the last item as the cursor parameter to fetch the next page.

When filtering by runId, all matching extractions are returned in a single response (no pagination needed since batch runs are typically small).

Code Examples

bash
# List all extractions (default limit of 50)
curl https://api.docmap.io/v1/extractions \
  -H "Authorization: Bearer dm_live_a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0"

# Filter by template and limit results
curl "https://api.docmap.io/v1/extractions?templateId=48291&limit=10" \
  -H "Authorization: Bearer dm_live_a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0"

# Filter by batch run ID
curl "https://api.docmap.io/v1/extractions?runId=b4704c6e-8917-4671-8c92-178aec3eba92" \
  -H "Authorization: Bearer dm_live_a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0"

# Filter by date range
curl "https://api.docmap.io/v1/extractions?dateFrom=2025-01-01&dateTo=2025-01-31" \
  -H "Authorization: Bearer dm_live_a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0"

# Paginate through results
curl "https://api.docmap.io/v1/extractions?limit=10&cursor=2025-01-15T09:30:00.000Z" \
  -H "Authorization: Bearer dm_live_a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0"
typescript
const apiKey = process.env.DOCMAP_API_KEY

// List all extractions
const response = await fetch('https://api.docmap.io/v1/extractions', {
  headers: { 'Authorization': `Bearer ${apiKey}` },
})

const { data, hasMore } = await response.json()
console.log(`Found ${data.length} extractions, hasMore: ${hasMore}`)

// Paginate through all results
let cursor: string | undefined
const allExtractions = []

do {
  const url = new URL('https://api.docmap.io/v1/extractions')
  url.searchParams.set('limit', '50')
  if (cursor) url.searchParams.set('cursor', cursor)

  const res = await fetch(url, {
    headers: { 'Authorization': `Bearer ${apiKey}` },
  })
  const page = await res.json()

  allExtractions.push(...page.data)
  cursor = page.hasMore ? page.data.at(-1)?.createdAt : undefined
} while (cursor)

console.log(`Total: ${allExtractions.length} extractions`)

// Filter by template
const filtered = await fetch(
  'https://api.docmap.io/v1/extractions?templateId=48291&limit=10',
  { headers: { 'Authorization': `Bearer ${apiKey}` } },
)

const { data: filteredData } = await filtered.json()
python
import requests

api_key = "dm_live_a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0"
headers = {"Authorization": f"Bearer {api_key}"}

# List all extractions
response = requests.get(
    "https://api.docmap.io/v1/extractions",
    headers=headers,
)
result = response.json()
print(f"Found {len(result['data'])} extractions, hasMore: {result['hasMore']}")

# Paginate through all results
all_extractions = []
cursor = None

while True:
    params = {"limit": 50}
    if cursor:
        params["cursor"] = cursor

    response = requests.get(
        "https://api.docmap.io/v1/extractions",
        headers=headers,
        params=params,
    )
    page = response.json()

    all_extractions.extend(page["data"])

    if not page["hasMore"]:
        break
    cursor = page["data"][-1]["createdAt"]

print(f"Total: {len(all_extractions)} extractions")

# Filter by date range
response = requests.get(
    "https://api.docmap.io/v1/extractions",
    headers=headers,
    params={"dateFrom": "2025-01-01", "dateTo": "2025-01-31"},
)

Response

Status: 200 OK

The response body contains a data array of extraction records and a hasMore boolean indicating whether additional pages exist.

Top-level Fields

FieldTypeDescription
dataExtractionRecord[]Array of extraction records.
hasMorebooleantrue if there are more results beyond the current page. false when filtering by runId (all results returned).

Extraction Record Fields

Each extraction record in the array contains the same fields as the Run Extraction response:

FieldTypeDescription
idstringUnique extraction ID (prefixed with extract-).
userIdstringID of the user who owns this extraction.
templateIdstringID of the template used for extraction.
templateNamestringDisplay name of the template used.
fileNamestringOriginal file name of the uploaded document.
status"processing" | "completed" | "failed"Current extraction status. "processing" if still being processed, "completed" on success, "failed" on error.
extractedDataobject | nullExtracted data matching the template fields. null if extraction failed.
errorstring | nullError message describing the failure. null if extraction succeeded.
variablesVariable[]Array of template variable definitions used during extraction.
source"dashboard" | "api"How the extraction was triggered.
runIdstring | nullBatch run ID, if one was provided.
processingTimeMsnumber | nullTotal processing duration in milliseconds.
createdAtstringISO 8601 timestamp of when the extraction was created.

Example

json
{
  "data": [
    {
      "id": "extract-KmL9nOpQrStUvWxYz",
      "userId": "L5kM9nRpQ7vX3yZ1wD4eF6gHjA2",
      "templateId": "48291",
      "templateName": "Invoice Template",
      "fileName": "invoice-2024-001.pdf",
      "status": "completed",
      "extractedData": {
        "vendor_name": "Acme Corp",
        "invoice_number": "INV-2024-001",
        "total_amount": 1250.00
      },
      "error": null,
      "variables": [
        {
          "name": "vendor_name",
          "type": "string",
          "description": "Name of the vendor or supplier"
        }
      ],
      "source": "api",
      "runId": null,
      "processingTimeMs": 3842,
      "createdAt": "2025-01-20T14:30:00.000Z"
    },
    {
      "id": "extract-Rj4Y8mBpCdEfGhIk",
      "userId": "L5kM9nRpQ7vX3yZ1wD4eF6gHjA2",
      "templateId": "48291",
      "templateName": "Invoice Template",
      "fileName": "invoice-2024-002.pdf",
      "status": "completed",
      "extractedData": {
        "vendor_name": "Global Supplies Ltd",
        "invoice_number": "INV-2024-002",
        "total_amount": 875.50
      },
      "error": null,
      "variables": [
        {
          "name": "vendor_name",
          "type": "string",
          "description": "Name of the vendor or supplier"
        }
      ],
      "source": "dashboard",
      "runId": null,
      "processingTimeMs": 2916,
      "createdAt": "2025-01-19T09:15:00.000Z"
    }
  ],
  "hasMore": true
}

Errors

StatusCodeDescription
401UNAUTHORIZEDMissing, invalid, or expired API key / token.

DocMap API Documentation