---
title: "Upload Invoice PDF for AI Extraction"
method: POST
path: "/v1/platform/businesses/{business_id}/ar-documents/upload"
tags: ["Invoices"]
---

# Upload Invoice PDF for AI Extraction

`POST /v1/platform/businesses/{business_id}/ar-documents/upload`

## Request

- Base URL: `https://docs.thredfi.com` (the document declares no server; this is the origin it was published from)
- URL: `https://docs.thredfi.com/v1/platform/businesses/{business_id}/ar-documents/upload`
- Auth: one of:
  - HTTP bearer
  - HTTP bearer
  - HTTP basic
  - HTTP bearer
  - HTTP bearer

Upload an invoice PDF file for automated AI-powered extraction and processing.

        **Processing Flow:**
        1. PDF is uploaded to S3 storage
        2. Background LangGraph workflow is queued for intelligent processing
        3. API returns immediately (202 Accepted)
        4. Background workflow processing:
           - Extracts invoice data using Reducto AI
           - Classifies document type (invoice/credit note)
           - Validates document is from your business
           - Matches or creates customer using AI semantic matching
           - Detects semantic duplicates
           - Validates extracted data
           - Creates invoice record
        5. Extracted invoice appears in GET /invoices/ list

        **File Requirements:**
        - Format: PDF or images (PNG, JPEG, GIF, BMP, TIFF, HEIC)
        - Size: Maximum 50MB for PDF, 10-20MB for images
        - Content: Invoice document or scanned invoice image
        - Content-Type validation: File content is verified to match declared type

        **Extraction Quality:**
        - Fields with ≥90% confidence are auto-filled
        - Fields below threshold require manual review
        - Line items with parsing errors are flagged
        - Total mismatches (>1% or >$10) trigger review flag

        **Duplicate Detection:**
        - AI compares with last 100 invoices
        - High confidence duplicates (≥90%) are blocked
        - Medium confidence (70-89%) are flagged for review
        - Low confidence (<70%) are processed normally

        **Access Control:**
        - Requires partner authentication
        - Business must belong to authenticated partner

## Path parameters

- `business_id` string, uuid, required

## Request body

- InvoiceUploadRequestRequest: Request serializer for invoice upload endpoint
  - `file` string, binary, required: PDF file to upload (max 50MB)

## Response `202`

- InvoiceUploadResponse: Response serializer for invoice upload endpoint
  - `document_id` string, uuid, required: Unique identifier for the uploaded document
  - `task_id` string, required: Celery task ID for tracking processing
  - `status` string, required: Current status (always 'processing' initially)
  - `message` string, required: Instructions for checking extraction result

## Other responses

- `400`: Validation errors in request data
- `401`: Authentication required - missing or invalid API key
- `403`: Permission denied - insufficient privileges
- `404`: Resource not found
- `409`: Conflict - resource already exists or invalid state transition
- `422`: Unprocessable entity - business logic validation failed
- `500`: Internal server error

---

[API](https://skmtc.dev/thredfi/apis/thredfi-accounting-platform-api.md) - [All operations](https://skmtc.dev/thredfi/apis/thredfi-accounting-platform-api/llms.txt) - [OpenAPI document](https://skmtc.dev/thredfi/apis/thredfi-accounting-platform-api/revisions/0c1918254db3?raw)
