Customers API

Customers who buy from the company, companies and private persons, and the contact persons of each customer. Orders, invoices and payments of a customer are found by filtering on the customer: customer.id=5. For access, paging, filters and getting only changes, see API basics.

Customers

GET /api/customer/search

Example request

curl -g -G 'https://{company}.smarton.app/api/customer/search' \
  -H 'Authorization: <token>' \
  --data-urlencode 'paginate=true' \
  --data-urlencode 'limit=500' \
  --data-urlencode 'offset=0' \
  --data-urlencode 'partialJoin[type][]=name' \
  --data-urlencode 'partialJoin[country][]=name' \
  --data-urlencode 'sort[id]=asc'

Fields

FieldMeaning
id, name, aliasID, name and short name.
registrationCode, vatCodeCompany code and VAT code.
type, countryCustomer type and country.
addressInline, invoiceAddressAddress in one line and the address for invoices.
phone, email, emailFinance, websiteContacts of the customer.
discountThe customer's discount in percent.
creditAmount, remnantCreditCredit limit and the part of it still left.
totalInvoiced, totalPaid, remnantAmount invoiced, amount paid, and what is still unpaid (totalInvoiced minus totalPaid).
debtorMarked as a debtor.
active, hideInPosActive customer; hidden in the POS.
comments, createdAt, updatedAtComments and when the record was created and last changed.

Contact persons

GET /api/customer_employee/search?customer.id=5&partialJoin[customer][]=name

The people of a customer: name, firstName, lastName, phone, mobile, email and customer. With an API key, personal codes, dates of birth and health-related fields are not returned.

Orders, invoices and payments of a customer

GET /api/order/search?customer.id=5&paginate=true&limit=200&sort[createdAt]=asc
GET /api/invoice/search?customer.id=5
GET /api/payment/search?customer.id=5

The fields are described in Orders API and Accounting API.

Creating and changing customers

Use the general write calls with the resource customer (or customer_employee for contact persons), for example POST /api/customer/create with name, registrationCode and vatCode. See API basics → Writing data. This needs a login with the permission to create customers.

With an API key

Customers and contact persons belong to the Customers area of an API key. Their orders and invoices need the Sales area, and payments the Accounting area.