Customers or contacts, which endpoint do I use?
developers-customers-or-contactsOn this page
They are the same records. Use contacts to create and update, and for the fuller view.
They read the same records, in two views with their own scopes.
| Compare | /customers | /contacts |
|---|---|---|
| Scope | read:customers | read:contacts, and write:contacts to change |
| Fields | name, email, phone, address, notes | first_name, last_name, company_name, job_title, email, billing_email, the phone numbers, preferred_contact_method, address, notes |
| Create or update | No | POST /contacts, PATCH /contacts/{id} |
| Search | None (paging and sync only) | email, phone and search narrow the list |
Use /contacts to find, create and update people. Use /customers when you only need a name, email, phone and address.
A job's customer_id is the id of this record, so a contact you create can be used straight away when you create a job. Find a contact before creating one: GET /contacts?email=…. See Create a job and book a visit.
Find a contact by email
To find a contact before you create one, filter /contacts by email. $SKEDULER_API is your Skeduler API address, and in the JavaScript and PHP tabs the same names in capitals are variables you set.
curl
curl -s "$SKEDULER_API/api/v1/contacts?email=sam@example.com" \
-H "Authorization: Bearer $ACCESS_TOKEN"
JavaScript (fetch)
const res = await fetch(`${SKEDULER_API}/api/v1/contacts?email=sam@example.com`, {
headers: {
Authorization: `Bearer ${ACCESS_TOKEN}`,
},
});
const data = await res.json();
PHP (Guzzle)
$client = new \GuzzleHttp\Client();
$res = $client->request('GET', "$SKEDULER_API/api/v1/contacts?email=sam@example.com", [
'headers' => [
'Authorization' => "Bearer $ACCESS_TOKEN",
],
]);
$data = json_decode((string) $res->getBody(), true);
The answer lists matching contacts in data. If it's empty, create the contact with POST /contacts.
In this section
- Change a job's status
- Create a job and book a visit from your own system
- Push leads from your website into Skeduler
- Read a job's notes
- Read technicians' leave and time blocks
- Record a payment on an invoice
- API reference
- Authentication API
- Contacts API
- Credit Notes API
- Customers API
- Estimates API
- Invoices API
- Jobs API
- Payments API
- Schedule blocks API
- Technicians API
- Visits API
- Webhooks API