Skip to main content
Several create endpoints accept an optional attachments field: a JSON array of objects (not raw strings or bare URLs). Each object describes one file for the AI pipeline. Endpoints that use this shape include (non-exhaustive): invoices, bills, expenses, income, journals, contacts, chart of accounts (POST /accounts), and POST /bank-transactions/upload.

Attachment object

FieldRequiredTypeDescription
fileYesstringContent interpreted per type — must be non-empty
typeYesstringOne of base64, url, or raw. Always required — for Base64 file bytes you must send "type": "base64"; the API does not treat a bare string in file as Base64 when type is missing
nameRecommendedstringOriginal filename including extension (e.g. statement-jan.pdf, export.csv). Used for type detection (PDF, CSV, Excel, images). If omitted, a generic name may break detection

type values for file

typeMeaning
base64Standard Base64-encoded file bytes (no data:...;base64, prefix). You must set "type": "base64" alongside file
urlPublic https:// URL the server fetches once (timeout and HTTP success required)
rawRaw binary as string (uncommon in JSON; prefer base64)

Examples

One PDF as Base64

"attachments": [
  {
    "name": "invoice-scan.pdf",
    "type": "base64",
    "file": "JVBERi0xLjQKJeLjz9MKMyAwIG9iago8PC9MZW5ndGggNCAwIFIvRmlsdGVyL0ZsYXRlRGVjb2RlPj4Kc3RyZWFtCnic..."
  }
]

File hosted at a URL

"attachments": [
  {
    "name": "statement.csv",
    "type": "url",
    "file": "https://cdn.example.com/statements/jan-2024.csv"
  }
]

Usage notes

  • Base64: never omit type. Sending only a long string in file without "type": "base64" is invalid for Base64 content.
  • Multiple attachments: each object is processed; for async jobs, processing is often one job per attachment.
  • Omit or empty array: use [] or omit attachments when you only send prompt and optional text_attachment.
  • Bank statement files: for POST /bank-transactions/upload, supported types follow the filename extension: pdf, csv, xlsx, xls, and common images (jpg, jpeg, png, webp, gif, bmp). Other AI pipelines may accept different formats per their service rules.