Upload Purchase Invoice Attachment
POST/api/purchase-invoices/:purchaseInvoice/attachments
Upload a file attachment to a purchase invoice. Send as multipart/form-data with a file field and an optional category field.
purchase-orders:writeGrant this scope to your token under Settings → Developer → Personal Access Tokens.
Accepted types: PDF, DOC, DOCX, PNG, JPG/JPEG. Maximum size 20 MB. Uploading to an archived invoice returns 422.
Fields:
- file (required): The file to attach.
- category (optional): Document category — one of
invoice,payment_proof, orother. Defaults toother.
Side effects:
- If the invoice is already synced to a connected accounting provider (QuickBooks Online / Xero), the file is forwarded to the remote document asynchronously.
- If Invoice OCR is enabled with auto-scan on upload and the file is a PDF, an OCR scan is queued automatically in the background — the returned attachment will show
ocr_status: "processing".
Requires the purchase-orders:write token scope.
Request
Responses
- 201
- 401
- 403
- 404
- 422
- 429
Created
Response Headers
Unauthenticated — the bearer token is missing, revoked, expired, or malformed. Never retry automatically; fix the credential. See the Errors guide.
Forbidden — the token lacks a required scope, the endpoint is not available to API tokens, or the user behind the token lacks the permission. A human must adjust the token scopes or user permissions; do not retry.
Not found — no record with the given identifier (or the route does not exist). Verify the ID before retrying.
Unprocessable Entity
Response Headers
Rate limited — platform limit is 1,000 requests/min; individual tokens may carry lower limits. Honor the Retry-After header before retrying. See the Rate Limits guide.