Skip to content

Imports API

Bring existing invoice data into InvoicePDFs from JSON or CSV. You create an import with your rows, review the parsed result, and then confirm it to commit the data (or cancel it to discard).

Create Import

POST /api/v1/imports

Request:

{
  "source_format": "csv",
  "data": [
    {
      "invoice_number": "INV-2026-001",
      "customer": "Jane Smith",
      "total": "150.00"
    }
  ]
}
Field Required Description
source_format Yes Format of the source rows: json or csv
data Yes List of rows to import (at least one)

Response 200 OK:

{
  "data": {
    "id": "imp_01XYZ",
    "source_format": "csv",
    "status": "pending",
    "total_rows": 1,
    "imported_rows": 0,
    "failed_rows": 0,
    "errors": null,
    "created_at": "2026-07-20T10:00:00Z",
    "updated_at": "2026-07-20T10:00:00Z",
    "completed_at": null
  }
}

A new import starts in pending status. Review it, then confirm to commit or cancel to discard.

Try it

Get Import

GET /api/v1/imports/{import_id}

Response:

{
  "data": {
    "id": "imp_01XYZ",
    "source_format": "csv",
    "status": "pending",
    "total_rows": 1,
    "imported_rows": 0,
    "failed_rows": 0,
    "errors": null,
    "created_at": "2026-07-20T10:00:00Z",
    "updated_at": "2026-07-20T10:00:00Z",
    "completed_at": null
  }
}
Try it

Confirm Import

POST /api/v1/imports/{import_id}/confirm

Commits a pending import. Confirming an import in any other status returns a 409 conflict error.

Response:

{
  "data": {
    "id": "imp_01XYZ",
    "source_format": "csv",
    "status": "completed",
    "total_rows": 1,
    "imported_rows": 1,
    "failed_rows": 0,
    "errors": null,
    "created_at": "2026-07-20T10:00:00Z",
    "updated_at": "2026-07-20T10:05:00Z",
    "completed_at": "2026-07-20T10:05:00Z"
  }
}
Try it

Cancel Import

POST /api/v1/imports/{import_id}/cancel

Cancels an import that is still pending or processing. Cancelling an import in any other status returns a 409 conflict error.

Response:

{
  "data": {
    "id": "imp_01XYZ",
    "source_format": "csv",
    "status": "cancelled",
    "total_rows": 1,
    "imported_rows": 0,
    "failed_rows": 0,
    "errors": null,
    "created_at": "2026-07-20T10:00:00Z",
    "updated_at": "2026-07-20T10:02:00Z",
    "completed_at": "2026-07-20T10:02:00Z"
  }
}
Try it

Import Statuses

Status Description
pending Import created and awaiting confirmation
processing Import is being committed
completed Import was confirmed and committed
failed Import processing failed
cancelled Import was cancelled before completion