Accounts Payable

Upload AP Document for AI Processing

    Upload an accounts payable document (vendor invoice, credit note, or receipt) for automated processing.

    **Processing Flow:**
    1. File is uploaded to S3 storage
    2. Background LangGraph workflow is queued
    3. API returns immediately (202 Accepted)
    4. Background processing:
       - Downloads file and calculates content hash
       - Quick duplicate check (exact file match)
       - Extracts data using Reducto AI
       - Classifies document type (invoice/credit_note/receipt)
       - Validates document is for this company
       - Routes to type-specific workflow:
         * **Invoice**: Creates/matches vendor, checks duplicates, creates Bill
         * **Credit Note**: Creates VendorCreditNote
         * **Receipt**: Matches to Bill, updates payment status
    5. Processed document appears in GET /bills/ or relevant endpoint

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

    **Document Classification:**
    - AI determines if document is invoice, credit note, or receipt
    - Invoice: Bill created, vendor matched/created
    - Credit Note: VendorCreditNote created
    - Receipt: Matched to existing Bill if possible

    **Vendor Matching (for invoices):**
    - AI semantic matching (handles "Amazon Inc" vs "Amazon.com")
    - VAT number matching (very strong signal)
    - Creates new vendor if no confident match found

    **Duplicate Detection:**
    - File hash check (exact file duplicate)
    - AI semantic duplicate check (same invoice number, date, amount)
    - High confidence duplicates (≥90%) flagged for review
    - Medium confidence (70-89%) flagged for review

    **Company Validation:**
    - Invoices/Credit Notes: Strict validation (must match company name/VAT)
    - Receipts: Lenient validation (assumes for company unless explicitly different)
    - Documents not for this company are flagged for review

    **Review Flags:**
    Documents may be flagged for manual review if:
    - Duplicate detected (file or semantic)
    - Not for this company
    - Low extraction confidence
    - Uncertain document type classification
    - Line items don't match total

    **Access Control:**
    - Requires partner authentication
    - Business must belong to authenticated partner
    
post/v1/platform/businesses/{business_id}/ap-documents/upload

Request

  • Base URL
    https://docs.thredfi.com (the document declares no server; this is the origin it was published from)
  • Auth
    • HTTP bearer
    • or HTTP bearer
    • or HTTP basic
    • or HTTP bearer
    • or HTTP bearer

Path parameters

business_idstring uuid required

Request body

filestring binary required

PDF or image file to upload (max 50MB)

Response

document_idstring uuid required

Unique identifier for the uploaded document

task_idstring required

Celery task ID for tracking processing

statusstring required

Current status (always 'processing' initially)

messagestring required

Instructions for checking result

Changes

No recorded changes to this operation across all 1 revision of this API.