Appearance
Contacts
Endpoints
GET /v1/contacts
GET /v1/contacts/:id
POST /v1/contacts
PATCH /v1/contacts/:id
DELETE /v1/contacts/:id
INFO
GET
endpoints are available for all API users. However, POST
, PATCH
, and DELETE
endpoints are only available if you are using the API as your sync source. If you are using a sync source other than the API to sync your employee data to Workshop, you can only use the GET
endpoints.
List contacts
GET /v1/contacts
Returns a list of contacts.
Parameters
Name | Optional | Default | Description | Options |
---|---|---|---|---|
Pagination parameters | See pagination for more information. |
RETURNS
A paginated list of contact summary objects.
EXAMPLE RESPONSE
json
{
"object": "list",
"has_more": true,
"next": "/v1/contacts?cursor=eyJzb3J0IjoibmFtZSIsIm9yZGVyIjoiY...",
"limit": 5,
"size": 5,
"data": [
{
"object": "contact",
"id": "937ccbe2-4cb5-4c76-96bf-29510b514dfa",
"external_id": "ABC-123",
"first_name": "John",
"last_name": "Doe",
"email": "john@example.com",
"phone_number": "+12345678910",
"urls": {
"details": "/v1/contacts/937ccbe2-4cb5-4c76-96bf-29510b514dfa",
},
},
{...},
{...},
{...},
{...},
],
}
Retrieve a contact
GET /v1/contacts/:id
Gets the details of a single contact.
Parameters
Name | Optional | Type | Description |
---|---|---|---|
id | required | string | The ID of the contact to retrieve. |
RETURNS
A contact object.
EXAMPLE RESPONSE
json
{
"object": "contact",
"id": "937ccbe2-4cb5-4c76-96bf-29510b514dfa",
"external_id": "ABC-123",
"first_name": "John",
"last_name": "Doe",
"email": "john@example.com",
"phone_number": "+12345678910",
"attributes": {
"department": "Sales",
"office": "Austin"
},
"urls": {
"details": "/v1/contacts/937ccbe2-4cb5-4c76-96bf-29510b514dfa"
}
}
Create a contact
POST /v1/contacts
Creates a new contact.
Parameters
Name | Optional | Type | Description |
---|---|---|---|
external_id | required | string | A unique identifier from your system for the contact. |
first_name | required | string | The first name of the contact. |
last_name | required | string | The last name of the contact. |
required | string | The email address of the contact. | |
phone_number | optional | string | The phone number of the contact. |
attributes | optional | object | A dictionary of attributes for the contact. |
EXAMPLE PAYLOAD
json
{
"external_id": "ABC-123",
"first_name": "John",
"last_name": "Doe",
"email": "john@example.com",
"phone_number": "+12345678910",
"attributes": {
"department": "Sales",
"office": "Austin"
}
}
RETURNS
A success message and a 201 status code if successful.
ERRORS
Code | Description |
---|---|
400 | Invalid request, missing required parameters or supplied parameters are invalid |
409 | Contact with the same external_id already exists |
EXAMPLE RESPONSE
json
{
"message": "Contact created successfully"
}
Update a contact
PATCH /v1/contacts/:id
Updates a contact.
Parameters
Name | Optional | Type | Description |
---|---|---|---|
id | required | string | The ID of the contact to update. |
external_id | optional | string | A unique identifier from your system for the contact. |
first_name | optional | string | The first name of the contact. |
last_name | optional | string | The last name of the contact. |
optional | string | The email address of the contact. | |
phone_number | optional | string | The phone number of the contact. |
attributes | optional | object | A dictionary of attributes for the contact. |
If you do not supply a parameter, its value will remain unchanged. If you attempt to update a contact that does not currently have an external_id
, you must supply an external_id
value in your request. If attributes
is supplied, it will replace the existing attributes for the contact, not merge them.
EXAMPLE PAYLOAD
json
{
"first_name": "John",
"last_name": "Doe"
}
RETURNS
A success message and a 200 status code if successful.
ERRORS
Code | Description |
---|---|
400 | Invalid request, supplied parameters did not pass validation. |
404 | Contact with the given ID was not found. |
EXAMPLE RESPONSE
json
{
"message": "Contact updated successfully"
}
Delete a contact
DELETE /v1/contacts/:id
Deletes a contact.
Parameters
Name | Optional | Type | Description |
---|---|---|---|
id | required | string | The ID of the contact to delete. |
RETURNS
A success message and a 200 status code if successful.
EXAMPLE RESPONSE
json
{
"message": "Contact deleted successfully"
}