---
title: "Upload Document for AI Classification (AR/AP)"
method: POST
path: "/v1/platform/businesses/{business_id}/documents/upload"
tags: ["Documents"]
---

# Upload Document for AI Classification (AR/AP)

`POST /v1/platform/businesses/{business_id}/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}/documents/upload`
- Auth: one of:
  - HTTP bearer
  - HTTP bearer
  - HTTP basic
  - HTTP bearer
  - HTTP bearer

Upload a financial document file for automated AI-powered AR/AP classification and processing.

        **Processing Flow:**
        1. Document is uploaded to S3 storage
        2. Background unified workflow is queued
        3. API returns immediately (202 Accepted)
        4. Background workflow processing:
           - Extracts document data using Reducto AI
           - Classifies as AR (Accounts Receivable) or AP (Accounts Payable)
           - Routes to appropriate workflow:
             - AR: Sales invoices, customer credit notes (you are the issuer)
             - AP: Bills, receipts, vendor credit notes (you are the recipient)
           - Matches or creates customer/vendor using AI
           - Creates appropriate entity record
        5. Extracted entity appears in respective API endpoint

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

        **Classification Confidence:**
        - High confidence (≥80%): Document processed automatically
        - Low confidence (<80%): Document marked as failed, manual classification required

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

## Path parameters

- `business_id` string, uuid, required

## Request body

- UnifiedDocumentUploadRequestRequest: Request serializer for unified document upload endpoint
  - `file` string, binary, required: PDF or image file (AR or AP document, max 50MB)

## Response `202`

- UnifiedDocumentUploadResponse: Response serializer for unified document 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 result after AR/AP classification

## 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)
