AI-extract draft invoices from documents

POST /api/v1/invoices/ai-create

Upload pasted text, PDFs, images, Excel files, or a CSV to extract draft invoice entities using AI. Returns draft invoices ready for user review before creation.

Operation ID: ai_create_invoice_payload_api_v1_invoices_ai_create_post · View as markdown · OpenAPI slice

Authentication

Bearer token authentication. Pass your DayZero API token in the Authorization header and the target business UUID in x-business-id.

Request body

pasted_text string

Raw text content to extract an invoice from. Limit 1 invoice per text input. Mutually exclusive with pasted_text_s3_key.

pasted_text_s3_key string

S3 key of pasted text content. Limit 1 invoice per text input. Mutually exclusive with pasted_text.

single_invoice_s3_keys array · string

S3 keys of individual invoice documents (PDFs, images, Excel). Each file is processed independently.

multi_invoice_s3_key string

S3 key of a CSV file containing multiple invoices.

Responses

201 Successful Response

items array · DraftInvoice requiredDraftInvoice

List of draft invoice entities extracted by AI.

14 fields
customer_name string

Customer/company name extracted by AI. Use to match or create a customer.

amount integer

Total invoice amount in cents extracted by AI.

description string

Invoice description or notes.

invoice_number string

Invoice number from the document.

issue_date string

Invoice issue date (YYYY-MM-DD) extracted by AI.

due_date string

Payment due date (YYYY-MM-DD) extracted by AI.

notes string

Additional notes or terms extracted by AI.

customer_id string

Matched customer UUID (if the customer was found in the system).

currency string

Currency code (USD, CAD, AUD, EUR, or GBP). Defaults to USD.

line_items array · object

Line items extracted by AI: [{description, quantity, unit_price_cents, total_cents}].

s3_key string

S3 key of the source document for this invoice.

confidence number

AI confidence score for this extraction (0.0-1.0).

source string

Source type: 'pasted_text', 'single_file', or 'multi_file'.

source_filename string

Original filename or S3 key of the source document.

errors array · InvoiceFileProcessingError InvoiceFileProcessingError

List of per-file errors for files that could not be processed.

3 fields
s3_key string required

S3 key of the file that failed.

filename string

Original filename (if determinable from the S3 key).

error string required

Human-readable error description.

400 Bad Request - Invalid input

401 Unauthorized - Authentication required

403 Forbidden - Insufficient permissions

422 Validation Error

detail array · ValidationError ValidationError
5 fields
loc array · string | integer required
msg string required
type string required
input object
ctx object