PerfectParser Docs

Submit Extraction

Reference for the POST /v1/extractions endpoint.

POST /v1/extractions

Submit one or more document files (PDFs, images) to a specific Parser for asynchronous structured data extraction.

This endpoint automatically counts pages server-side and bills your credit balance (1 page = 1 credit). If your balance is insufficient, the request is rejected with a 402 error.

The parser must have a configured schema. Submitting to an unconfigured parser returns a 400 PARSER_NOT_CONFIGURED error.

Headers

HeaderRequiredDescription
X-API-Key✅ YesYour PerfectParser API key.
Content-Type✅ Yesmultipart/form-data
Idempotency-KeyOptionalUnique string (max 24h). Retries with the same key return the original job without double-charging. Response includes Idempotent-Replayed: true on replay.

This endpoint has a tighter rate limit of 20 requests/minute per API key (vs 150/min global).

Body Parameters (Multipart Form)

ParameterTypeRequiredDescription
parser_idstringThe ID of the parser to process these files.
filesfile(s)One or more document files (PDF, PNG, JPG, JPEG, WebP, etc.). Up to 50 files.
curl -X POST https://api.perfectparser.com/v1/extractions \
  -H "X-API-Key: pp_live_your_secret_key" \
  -H "Idempotency-Key: batch-invoice-june-2026" \
  -F "parser_id=prs_999" \
  -F "files=@invoice-1.pdf" \
  -F "files=@invoice-2.pdf"

Response 202 Accepted

{
  "extraction": {
    "extraction_id": "ext_123",
    "parser_id": "prs_999",
    "status": "queued",
    "file_count": 2,
    "page_count": 7,
    "credits_used": 7,
    "credits_remaining": 43,
    "documents": [
      {
        "document_id": "doc_1",
        "filename": "invoice-1.pdf",
        "page_count": 3,
        "credits_used": 3,
        "status": "queued"
      },
      {
        "document_id": "doc_2",
        "filename": "invoice-2.pdf",
        "page_count": 4,
        "credits_used": 4,
        "status": "queued"
      }
    ]
  }
}

Save extraction_id and each document_id — use them for status polling and nested document endpoints.


Common Error Responses

HTTP StatusError CodeDescription
400INVALID_PAYLOADMissing required multipart parameter (parser_id or files).
400PARSER_NOT_CONFIGUREDParser exists but has no schema configured.
400UNSUPPORTED_FILE_TYPEOne or more uploaded files are not supported.
400PAGE_COUNT_FAILEDFile analysis failed.
401UNAUTHORIZEDInvalid or missing API key.
402INSUFFICIENT_CREDITSAccount credit balance too low.
404PARSER_NOT_FOUNDParser not found or belongs to another account.
429RATE_LIMITEDMore than 20 extraction submissions per minute.

On this page