Extract data with AI

Read a PDF or an image (invoice, ID, statement, form) and return the fields you ask for as JSON in output.data (also saved as a .json output file). Name the fields, or pass a JSON Schema. A field the document doesn't contain comes back null. Runs on MarqPDF's model or one of your own (model). Counts as one operation when it succeeds.

post/extract

Request

  • Base URL: https://marqpdf.com/v1
  • URL: https://marqpdf.com/v1/extract
  • Auth: HTTP bearer

Request body

filestring required

A file id from POST /files.

schemaobject

Instead of fields: a JSON Schema for the result (an object).

instructionsstring

Extra guidance, e.g. 'amounts in AED'.

modelstring

"marqpdf" (the default) or "provider/model" on a key you've added, e.g. "anthropic/claude-opus-5-5", "openai/gpt-5.1", "gemini/gemini-2.5-pro", "openrouter/…", "custom/…".

waitinteger

Seconds to wait for the result before answering 202 with a job to poll. 0 = answer at once.

webhook_urlstring uri

POSTed the finished job, signed with your webhook secret (MarqPDF-Signature).

Example request

{
  "file": "file_…",
  "fields": [
    "invoice_number",
    {
      "name": "total",
      "type": "number"
    },
    {
      "name": "due_date",
      "type": "date"
    }
  ],
  "model": "anthropic/claude-opus-5-5"
}

Response

Finished: the job with its output

object'job' required
idstring required
operationstring required
status'queued' | 'running' | 'succeeded' | 'failed' required
created_atstring date-time required
started_atstring nullable
finished_atstring nullable
webhook_urlstring nullable
webhookobject nullable

Example response

{
  "id": "job_3Fq…",
  "output": {
    "files": [
      {
        "id": "file_8rX2…"
      }
    ]
  }
}

Changes

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