Batch fill

Map a spreadsheet's columns to form fields once, then fill one PDF per row. Each row goes through deterministic standard fill. Each filled row bills one standard fill.

Suggest a column mapping

POST/forms/{form_id}/suggest-mappingBearer auth

Upload a spreadsheet and let Emboss suggest which column maps to which form field. Bills one context fill on success.

Parameters

NameInTypeRequiredDescription
form_idpathstringyesAn existing form whose status is ready.
filebodyfile (multipart)yesThe spreadsheet (CSV or XLSX) whose header row names the columns to map.
dry_runquerybooleannoSet to true to rehearse this call. Nothing is stored, charged or sent, and no AI is used. The answer says what the real call would do: whether it would succeed or be refused (with the exact status and error it would return), the price and the pages it is based on, and, on an account, whether the free monthly allowance covers it or a card is needed.

Status codes

  • 200Mapping suggestion returned. With ?dry_run=true the answer is a rehearsal instead: what the real call would do, with nothing stored, charged or sent and no AI used. outcome says whether it would succeed or be refused; a refusal carries the status and body the real call would answer.
  • 400Bad or unparseable spreadsheet.
  • 401Missing or invalid API key.
  • 402No payment method on file and either the monthly free allowance is used up or the request is over the free tier's 5-page cap. The body's detail carries code (over_free_tier or over_page_cap), message and billing_url, the page where a payment method can be added.
  • 404No such form, or owned by another key.
  • 409Form not ready. Detection has not finished.
  • 413Spreadsheet too large, or the request exceeds the size cap.
  • 429Rate limit exceeded.
  • 502Mapping failed upstream.
curl -X POST https://api.getemboss.ai/forms/6c47f7f5-f921-4698-910f-95dd7d81310b/suggest-mapping \
  -H "Authorization: Bearer sk_..." \
  -F "file=@./records.csv"
Response
{
  "mapping": {
    "Phone": { "field_id": 0, "confidence": "high" },
    "Email": { "field_id": 1, "confidence": "high" }
  },
  "unmapped_columns": ["Notes"]
}

Start a batch fill

POST/forms/{form_id}/fill-batchBearer auth

Upload the spreadsheet and a resolved mapping to start a batch fill. Returns 202 with a batch id. Each filled row bills one standard fill.

Parameters

NameInTypeRequiredDescription
form_idpathstringyesThe form to fill, with status ready.
filebodyfile (multipart)yesThe spreadsheet of records. One row produces one output PDF. Max 1000 rows.
mappingbodystring (JSON)yesResolved column-to-field mapping. Each key is a spreadsheet column name and each value contains a field_id from the form's contract. Example: {"Phone":{"field_id":0},"Email":{"field_id":1}}.
retentionbodystringnoOptional. ephemeral or account_default; default account_default. See the Ephemeral processing guide.
dry_runquerybooleannoSet to true to rehearse this call. Nothing is stored, charged or sent, and no AI is used. The answer says what the real call would do: whether it would succeed or be refused (with the exact status and error it would return), the price and the pages it is based on, and, on an account, whether the free monthly allowance covers it or a card is needed.

Status codes

  • 200A rehearsal (?dry_run=true): what the real call would do, with nothing stored, charged or sent and no AI used. outcome says whether it would succeed or be refused; a refusal carries the status and body the real call would answer.
  • 202Batch started.
  • 400Bad spreadsheet, invalid mapping JSON, mapping references an unknown column or field, or too many rows (max 1000).
  • 401Missing or invalid API key.
  • 402No payment method on file, and the monthly free allowance is used up, the batch has more rows than the free fills left (the body then carries rows and remaining), or the form is over the free tier's 5-page cap. The body's detail carries code (over_free_tier or over_page_cap), message and billing_url, the page where a payment method can be added.
  • 404No such form, or owned by another key.
  • 409Form not ready or not yet fillable.
  • 410The form's documents have been deleted under its retention policy.
  • 413Spreadsheet too large, or the request exceeds the size cap.
  • 429Rate limit exceeded.
curl -X POST https://api.getemboss.ai/forms/6c47f7f5-f921-4698-910f-95dd7d81310b/fill-batch \
  -H "Authorization: Bearer sk_..." \
  -F "file=@./records.csv" \
  -F 'mapping={"Phone":{"field_id":0},"Email":{"field_id":1}}'
Response
{
  "batch_id": "a1b2c3d4-5e6f-4a7b-8c9d-0e1f2a3b4c5d"
}

Get batch status

GET/forms/fill-batch/{batch_id}Bearer auth

Return the batch manifest. status is one of processing, complete, or failed. Poll until it is complete or failed. Each result entry links to its row PDF. A big batch can be read a page at a time: pass limit (1 to 1000) and offset. With no limit every row comes back. next_offset is where the next page starts, and is empty on the last page and while the batch is still running (its rows appear only when it finishes).

Parameters

NameInTypeRequiredDescription
batch_idpathstringyesThe batch id returned by POST fill-batch.
limitqueryintegernoHow many rows to return. Leave it out for every row.
offsetqueryintegernoThe first row to return, counting from 0.

Status codes

  • 200Batch status returned. Sending limit or offset adds limit, offset and next_offset to the answer.
  • 401Missing or invalid API key.
  • 404No such batch, or owned by another key.
curl https://api.getemboss.ai/forms/fill-batch/a1b2c3d4-5e6f-4a7b-8c9d-0e1f2a3b4c5d \
  -H "Authorization: Bearer sk_..."
Response
{
  "status": "complete",
  "total": 2,
  "filled": 2,
  "failed": 0,
  "results": [
    { "row": 1, "status": "filled", "pdf_url": "/forms/fill-batch/a1b2c3d4-5e6f-4a7b-8c9d-0e1f2a3b4c5d/rows/1/pdf" },
    { "row": 2, "status": "filled", "pdf_url": "/forms/fill-batch/a1b2c3d4-5e6f-4a7b-8c9d-0e1f2a3b4c5d/rows/2/pdf" }
  ],
  "error": null
}

Download a row PDF

GET/forms/fill-batch/{batch_id}/rows/{n}/pdfBearer auth

Download one filled row's PDF. n is the 1-based row index from the batch manifest.

Parameters

NameInTypeRequiredDescription
batch_idpathstringyesThe batch id returned by POST fill-batch.
npathintegeryesThe 1-based row number from the batch results manifest.

Status codes

  • 200PDF returned.
  • 401Missing or invalid API key.
  • 404No such batch, or that row was not filled.
  • 410The form's documents have been deleted under its retention policy.
curl https://api.getemboss.ai/forms/fill-batch/a1b2c3d4-5e6f-4a7b-8c9d-0e1f2a3b4c5d/rows/1/pdf \
  -H "Authorization: Bearer sk_..." \
  -o row-1.pdf
Response
Binary PDF (Content-Type: application/pdf).

Download all rows as ZIP

GET/forms/fill-batch/{batch_id}/zipBearer auth

Download a ZIP of every filled row PDF. Only filled rows are included. The archive is named batch-{id}.zip.

Parameters

NameInTypeRequiredDescription
batch_idpathstringyesThe batch id returned by POST fill-batch.

Status codes

  • 200ZIP returned.
  • 401Missing or invalid API key.
  • 404No such batch, or owned by another key.
  • 410The form's documents have been deleted under its retention policy.
curl https://api.getemboss.ai/forms/fill-batch/a1b2c3d4-5e6f-4a7b-8c9d-0e1f2a3b4c5d/zip \
  -H "Authorization: Bearer sk_..." \
  -o batch.zip
Response
Binary ZIP (Content-Type: application/zip) containing one row-N.pdf per filled row.