Skip to main content

Customers API

How to read, search and create customers and suppliers with the REST API: the address, paging, filters, field names and the permission the technical user needs.

To read customers and suppliers the technical user needs the permission Customers and suppliers → Read; to create them, Customers and suppliers → Create. Roles are assigned as in How to create a role and a user; the technical user and the key are in Technical users and API keys: connecting an integration.

The endpoint for customers and suppliers is:

/rest/v1/customer

With a GET request you load the list of customers and page through it with the offset parameter, for example:

This URL returns the first 30 records

/rest/v1/customer

This URL returns the next 30 records

/rest/v1/customer?offset=30

This is how you page through the results. With limit you ask for more at a time, up to 100 (see REST API).

You can filter customers by almost any field: you pass the filter as a JSON string in the filter parameter, an array with one or more objects with the following fields:

property: the name of the property to filter on

operator: the comparison, for example =, !=, >=, <=, like: the full list is in REST API.

value: the value to compare with

For example, to search for a customer by e-mail:

GET /rest/v1/customer?filter=[{"property":"cliente_email","operator":"=","value":"email@example.com"}]

The response contains the list of customers found, each with all the available fields:

{
  "success": true,
  "message": "Record(s) Found",
  "data": {
    "totalCount": 1,
    "customer": [
      {
        ...
        "id": 1234,
        "fullname": "Esempio",
        "email": "email@example.com",
        ...
      }
    ]
  }
}

Creating a customer

POST /rest/v1/customer

In the body of the request you write the customer's data as a JSON "key":"value" string

For example

{
    "cliente_nominativo":"Esempio",
    "cliente_email":"email@example.com"
}

The fields of a customer are written, and used in filters, with the column name (for example cliente_nominativo, cliente_email); the response returns them with different names (fullname, email). If you send a field that does not exist you get a 406 error.

The response contains the customer just created, with all the available fields:

{
  "success": true,
  "message": "Record Created",
  "data": {
    "totalCount": 1,
    "customer": {
      ...
      "id": 1234,
      "fullname": "Esempio",
      "email": "email@example.com",
      ...
    }
  }
}

The "id" field is the one you will then use for further operations on the customer.


Did this answer your question?