Extract quickstart

One document from upload to structured fields.

dev · https://api.dev.oprag.ai
  1. Reserve a job and get an upload URL

    Shell
    curl -X POST 'https://api.dev.oprag.ai/v1/extract/upload-urls' \
      -H 'X-Oprag-Key: sk_live_...' \
      -H 'Content-Type: application/json' \
      -d '{"filename":"invoice.pdf","contentType":"application/pdf","schemaId":"invoice"}'

    The response carries jobId, uploadUrl, uploadFields, and pollUrl. Pass "auto" as schemaId to have the document classified for you.

  2. POST the file to S3

    Shell
    # Every field from uploadFields, then the file, as multipart/form-data.
    curl -X POST "$UPLOAD_URL" \
      -F key="$KEY" -F policy="$POLICY" -F x-amz-signature="$SIGNATURE" \
      -F file=@invoice.pdf

    Going straight to S3 is what allows a 100 MB PDF; the API's own body limit is far smaller. Size limits are enforced by the presigned POST itself.

  3. Confirm

    Shell
    curl -X POST 'https://api.dev.oprag.ai/v1/extract/jobs/ext_a1b2c3d4e5f6789012345678abcdef01/confirm' \
      -H 'X-Oprag-Key: sk_live_...'

    Confirm checks the object exists, is non-empty, is within the size limit, and has both a supported MIME type and matching magic bytes — then queues it. It is idempotent while the job is queued.

  4. Poll

    Shell
    curl 'https://api.dev.oprag.ai/v1/extract/jobs/ext_a1b2c3d4e5f6789012345678abcdef01' \
      -H 'X-Oprag-Key: sk_live_...'

    Poll until status is terminal. Large PDFs report progress along the way with phase, totalPages, and a chunk count.

Ready to ship?

Get started free