Customers
This section covers the Customers API for managing your customer (buyer) database. Customers can be companies or individuals and are referenced when creating invoices.
Customer Endpoints
All customer endpoints require
apiKeyAuth.
| Endpoint | Method | Description |
|---|---|---|
GET /customers | GET | Paginated list of all customers. Supports filtering, sorting, and relation loading. |
GET /customer/{id} | GET | Get a single customer by its ID. |
POST /customer | POST | Create a new customer. |
PATCH /customer/{id} | PATCH | Update an existing customer. The body must include all required fields (isCompany, address, postcode, city, extras); optional fields you omit are preserved. |
DELETE /customer/{id} | DELETE | Delete a customer. Returns { "succeed": true }. |
GET /customers/generate-number | GET | Generate the next customer number based on the current sequence. Returns { "value": "003" }. |
POST /customers/import | POST | Validate (dryRun) or bulk-import up to 1000 customers from a JSON body in a single all-or-nothing call. Returns the created customers with their faktooraId. |
GET /customer/verify-customer-number | GET | Check whether a customer number is unique. Returns { "succeed": true/false }. |
Query Parameters for GET /customers
| Parameter | Type | Description |
|---|---|---|
page | number | Page number (1-based). |
perPage | number | Results per page. Default 25, max 1000 (clamped silently). |
sort | string | Field to sort by: customerId, name, nameAuthorisedSignatory, address, phoneNo, category, isCompany, email, faktooraId, vatId, taxId, invoiceProfile, supplierNumber, routeId, peppolId, createdAt, updatedAt. |
order | string | Sort direction: asc or desc. |
category | string | Filter by customer category. |
keywords | string[] | Array of search terms matched across customer fields. |
relationFields | string[] | Eager-load related data. Options: user, legalform, importedFile, customerContacts, invoiceTemplate, customerDeliveryAddresses. |
Customer Fields
| Field | Type | Required | Description |
|---|---|---|---|
isCompany | boolean | ✓ | true for a company, false for an individual. |
address | string | ✓ | Street address. |
postcode | string | ✓ | Postal code. Validated per country (DE: 5 digits, AT/CH: 4 digits). |
city | string | ✓ | City name. |
extras | object | ✓ | Additional metadata object (can be {}). |
name | string | Company name (for companies). | |
firstName | string | First name (for individuals). | |
lastName | string | Last name (for individuals). | |
email | string | Contact email address. | |
customerId | string | Your internal customer number/ID. | |
country | string | ISO 3166-1 alpha-2 country code (e.g., DE, AT, CH). | |
phoneNo | string | Phone number. | |
vatId | string | VAT registration number (e.g., DE123456789). | |
taxId | string | Tax ID (Steuernummer). | |
peppolId | string | PEPPOL participant ID for e-invoicing network delivery. | |
glnId | string | Global Location Number (GLN). | |
dunsId | string | D-U-N-S number. | |
invoiceProfile | string | Default invoice format profile for this customer. | |
deliveryAddresses | array | Array of delivery address objects. | |
customerContacts | array | Array of contact person objects. |
Example: Create a company customer
curl -X POST \
-H "X-API-KEY: your-api-token" \
-H "Content-Type: application/json" \
-d '{
"isCompany": true,
"name": "Acme GmbH",
"address": "Musterstraße 1",
"postcode": "10115",
"city": "Berlin",
"country": "DE",
"email": "billing@acme.example.com",
"vatId": "DE123456789",
"extras": {}
}' \
https://api.faktoora.com/api/v1/customer
Response (200 OK) — the created customer object including its id.
Example: List customers with filtering
curl -G -H "X-API-KEY: your-api-token" \
--data-urlencode "keywords[]=Acme" \
--data-urlencode "page=1" \
--data-urlencode "perPage=20" \
--data-urlencode "sort=name" \
--data-urlencode "order=asc" \
https://api.faktoora.com/api/v1/customers
Example: Generate next customer number
curl -H "X-API-KEY: your-api-token" \
https://api.faktoora.com/api/v1/customers/generate-number
Response (200 OK)
{ "value": "003" }
The returned value is the next free number in your tenant's existing sequence — typically a zero-padded integer (the default pad length is 3). If your tenant uses a custom format (e.g. CUST-001), the response follows that format instead. Use this value as the customerId when creating the next customer to maintain a consistent numbering sequence.
Example: Bulk import customers
POST /customers/import validates or imports up to 1000 customers in one call. Send the rows as JSON in the request body (maximum 2 MB).
Each entry has a line (any positive integer that identifies the row in your source, for example the spreadsheet row number; unique per request) and a customer object. line is echoed back in every result and error.
Recommended workflow: first send the rows with "dryRun": true to validate them without writing anything, fix the reported problems, then send the same payload with "dryRun": false.
curl -X POST \
-H "X-API-KEY: your-api-token" \
-H "Content-Type: application/json" \
-d '{
"dryRun": true,
"entries": [
{
"line": 2,
"customer": {
"isCompany": true,
"name": "Acme GmbH",
"address": "Hauptstrasse 1",
"postcode": "10115",
"city": "Berlin",
"country": "DE",
"email": "info@acme.example",
"vatId": "DE123456789",
"contactPerson": { "firstName": "Ann", "lastName": "Lee" },
"bankaccount": { "iban": "DE89370400440532013000", "bic": "COBADEFFXXX" }
}
},
{
"line": 3,
"customer": {
"isCompany": false,
"firstName": "Max",
"lastName": "Mustermann",
"address": "Bahnhofstrasse 5",
"postcode": "80331",
"city": "Munich",
"country": "DE"
}
}
]
}' \
https://api.faktoora.com/api/v1/customers/import
Response (200 OK), dry run — nothing is created.
{
"valid": false,
"errors": [
{ "line": 3, "field": "postcode", "code": "REQUIRED" }
],
"warnings": []
}
Response (200 OK), import ("dryRun": false)
{
"created": 2,
"customers": [
{ "line": 2, "id": "3f1e9db3-7a3b-4781-95fe-9c2754aaa806", "faktooraId": "2f7f1b1c9d3a4e5b8a6c" },
{ "line": 3, "id": "2412b75a-234c-4e8b-a4de-b4bb75d09bd3", "faktooraId": "9a1c4d2e7b6f4a3c8d5e" }
],
"warnings": [
{ "line": 2, "field": "email", "code": "POSSIBLE_DUPLICATE_EMAIL" }
]
}
Response (400 Bad Request) — returned when the request or at least one row is invalid. Every row is validated and all problems are reported, so one line can appear several times. The import is all-or-nothing: if any row is invalid, no customer is created.
{
"code": "BAD_REQUEST",
"statusCode": 400,
"message": "One or more entries failed validation",
"extra": {
"errors": [
{ "line": 3, "field": "email", "code": "INVALID_EMAIL" },
{ "line": 3, "field": "postcode", "code": "REQUIRED" },
{ "line": 7, "field": "customerId", "code": "CUSTOMER_NUMBER_TAKEN" }
],
"warnings": []
}
}
Request fields
| Field | Type | Required | Description |
|---|---|---|---|
dryRun | boolean | yes | true validates only and writes nothing. |
entries | array | yes | 1 to 1000 items of { "line": number, "customer": { ... } }. |
Customer fields (customer) — only isCompany is always required; all other fields are optional and may be null unless noted. Unknown fields are rejected.
- Required by type: companies need
name; persons needfirstNameandlastName.address,postcodeandcityare always required. - Identity:
isCompany,name,firstName,lastName,title,gender,legalformId(id of an existing legal form). - Reference:
customerId(customer number; leave empty to have it assigned automatically),category,note. - Address and contact:
address,postcode,city,country(ISO 3166-1 alpha-2, e.g.DE),email,phoneNo,faxNo. - Tax and routing:
vatId,taxId,routeId,peppolId,glnId,buyerAccountingReference,supplierNumber. contactPerson:firstName,lastName,email,phone,job,gender. AlastNameis required when any contact person field is set.bankaccount:iban,bic,holderName,bankName. Anibanis required when any bank account field is set.
Error codes (errors[].code, with line and field): REQUIRED, TOO_LONG, INVALID_EMAIL, UNKNOWN_COUNTRY, INVALID_IBAN, INVALID_BIC, CONTACT_PERSON_INCOMPLETE, INVALID_TYPE, INVALID_FORMAT, UNKNOWN_FIELD, UNKNOWN_LEGALFORM, CUSTOMER_NUMBER_TAKEN, CUSTOMER_NUMBER_DUPLICATE_IN_FILE, DATABASE_ERROR. If another request is currently assigning customer numbers for your account, the error code is RESOURCE_LOCKED; retry shortly.
Warnings: rows that look like existing customers (same email or VAT ID) produce warnings such as POSSIBLE_DUPLICATE_EMAIL. Warnings never block an import.
Limits and behavior: 1 to 1000 entries per request, request body up to 2 MB, line unique per request. The import only creates customers; it never updates existing ones.
Example: Verify a customer number
curl -G -H "X-API-KEY: your-api-token" \
--data-urlencode "value=CUST-0042" \
https://api.faktoora.com/api/v1/customer/verify-customer-number
Response (200 OK)
{ "succeed": true }
succeed: true means the number is available (not yet in use).
Example: Delete a customer
curl -X DELETE \
-H "X-API-KEY: your-api-token" \
https://api.faktoora.com/api/v1/customer/cust_abc123
Response (200 OK)
{ "succeed": true }