Imports
Import customers, suppliers, products, invoices and expenses from Excel: templates, upfront validation, processing and per-row results.
Imports load data in bulk from an Excel file (.xlsx, up to 10 MB) with the same validations as the app. The flow has two steps: upload and validate (creates nothing) and process.
Scopes: imports:read / imports:write plus the write scope of the imported resource:
import_type | Additional scope |
|---|---|
customers, suppliers, contacts | contacts:write |
products | products:write |
invoices, external_invoices | invoices:write |
expenses | expenses:write |
If one is missing, the API returns 403 insufficient_scope with the missing scope in required_scope.
Templates and columns
GET /imports/types/returns the supported types with their columns (name, example and whether it is required).GET /imports/template/{import_type}/downloads the Excel template for that type.
Upload and validate
/api/v1/imports/upload/imports:writecurl https://api.billora.app/api/v1/imports/upload/ \
-H "Authorization: Bearer $BILLORA_API_KEY" \
-F "file=@customers.xlsx" \
-F "import_type=customers" \
-F "skip_duplicates=true"import os, requests
with open("customers.xlsx", "rb") as fh:
res = requests.post(
"https://api.billora.app/api/v1/imports/upload/",
headers={"Authorization": f"Bearer {os.environ['BILLORA_API_KEY']}"},
files={"file": ("customers.xlsx", fh)},
data={"import_type": "customers", "skip_duplicates": "true"},
timeout=120,
)
job = res.json()
print(job["status"], job["total_rows"], job["validation_errors"])Returns 201 with the job: status (validated or validation_error), total_rows, validation_errors and preview_data (first rows). Options: update_existing (updates existing records), skip_duplicates (skips them) and import_as_issued (invoices: import them already issued).
Process
/api/v1/imports/{id}/process/imports:writeAccepts the same options in the JSON body. Up to 200 rows are processed immediately; larger files are processed in the background: poll GET /imports/{id}/ until status is completed, completed_with_errors or failed (or wait for the webhook). Rows with errors are skipped and the rest are imported.
| Operation | Endpoint |
|---|---|
| Per-row result | GET /imports/{id}/rows/?status=success (success, error, skipped) |
| List / delete jobs | GET /imports/ · DELETE /imports/{id}/ |
Each row returns row_number, status, error_message and, if created, created_object_type and created_object_id.
Events
import.completed (also with partial errors) and import.failed. See webhooks.
