Reference
Smart Lists
Smart Lists are saved filter+sort definitions that can be private to a user or
shared across a location. filters is an array of clauses; sort defines the
default ordering. Visibility is determined by the is_shared flag plus the
visibleTo query scope.
List smart lists
Returns smart lists visible to the authenticated user, ordered by sort_order
then alphabetically by name.
GET
/api/smart-lists
curl --request GET \
--get "https://klozzo.com/api/smart-lists" \
--header "Authorization: Bearer {YOUR_API_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
const url = new URL(
"https://klozzo.com/api/smart-lists"
);
const headers = {
"Authorization": "Bearer {YOUR_API_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://klozzo.com/api/smart-lists';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_API_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://klozzo.com/api/smart-lists'
headers = {
'Authorization': 'Bearer {YOUR_API_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()
{
"data": [
{
"id": null,
"location_id": null,
"user_id": 3765,
"name": "aut adipisci",
"filters": [
{
"field": "contact_type",
"operator": "=",
"value": "lead"
}
],
"sort": null,
"sort_order": 2,
"is_shared": false,
"is_default": false,
"created_at": null,
"updated_at": null
},
{
"id": null,
"location_id": null,
"user_id": 3766,
"name": "consequatur aut",
"filters": [
{
"field": "contact_type",
"operator": "=",
"value": "lead"
}
],
"sort": null,
"sort_order": 7,
"is_shared": false,
"is_default": false,
"created_at": null,
"updated_at": null
}
]
}
-
dataobject[]-
idstring -
location_idstring -
user_idinteger -
namestring -
filtersobject[]-
fieldstring -
operatorstring -
valuestring
-
-
sortstring -
sort_orderinteger -
is_sharedboolean -
is_defaultboolean -
created_atstring -
updated_atstring
-
Create a smart list
Creates a smart list: a saved question about contacts, not a saved answer. The list stores the filters and the sort; who matches is worked out every time it is opened, so somebody who becomes a hot lead tomorrow is in it tomorrow without anybody touching it.
POST
/api/smart-lists
That is the difference from a tag: a tag is something you put on a person, a smart list is a rule that finds them.
Set is_shared to give the whole team the list; leave it off and it is
yours. Only one list per user can be is_default, and setting a new one
clears the old.
Body parameters
-
namestring requiredDisplay name (max 255).
Example:
Hot leads, last 7 days -
filtersobject[] requiredFilter clauses. Each clause:
{field, operator, value}. Min 1.-
fieldstring requiredField name.
Example:
contact_type -
operatorstring requiredOperator (e.g.
eq,ne,in,gt,like).Example:
eq -
valuestring requiredValue to compare against. A string for most operators, a list for
in, a date for the date ones — whatever the field takes.Example:
lead
-
-
sortobjectDefault sort. Shape:
{field, direction}.-
fieldstringField to sort by.
Example:
created_at -
directionstringEither
ascordesc.Example:
desc
-
-
sort_orderintegerDisplay order in sidebar (low values first).
Example:
0 -
is_sharedbooleanShare across location.
Example:
false -
is_defaultbooleanMark as the user's default list.
Example:
false
curl --request POST \
"https://klozzo.com/api/smart-lists" \
--header "Authorization: Bearer {YOUR_API_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"name\": \"Hot leads, last 7 days\",
\"filters\": [
{
\"field\": \"contact_type\",
\"operator\": \"eq\",
\"value\": \"lead\"
}
],
\"sort\": {
\"field\": \"created_at\",
\"direction\": \"desc\"
},
\"sort_order\": 0,
\"is_shared\": false,
\"is_default\": false
}"
const url = new URL(
"https://klozzo.com/api/smart-lists"
);
const headers = {
"Authorization": "Bearer {YOUR_API_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"name": "Hot leads, last 7 days",
"filters": [
{
"field": "contact_type",
"operator": "eq",
"value": "lead"
}
],
"sort": {
"field": "created_at",
"direction": "desc"
},
"sort_order": 0,
"is_shared": false,
"is_default": false
};
fetch(url, {
method: "POST",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://klozzo.com/api/smart-lists';
$response = $client->post(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_API_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'name' => 'Hot leads, last 7 days',
'filters' => [
['field' => 'contact_type', 'operator' => 'eq', 'value' => 'lead'],
],
'sort' => ['field' => 'created_at', 'direction' => 'desc'],
'sort_order' => 0,
'is_shared' => false,
'is_default' => false,
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://klozzo.com/api/smart-lists'
payload = {
"name": "Hot leads, last 7 days",
"filters": [
{
"field": "contact_type",
"operator": "eq",
"value": "lead"
}
],
"sort": {
"field": "created_at",
"direction": "desc"
},
"sort_order": 0,
"is_shared": false,
"is_default": false
}
headers = {
'Authorization': 'Bearer {YOUR_API_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('POST', url, headers=headers, json=payload)
response.json()
{
"data": {
"id": null,
"location_id": null,
"user_id": 3767,
"name": "architecto eius",
"filters": [
{
"field": "contact_type",
"operator": "=",
"value": "lead"
}
],
"sort": null,
"sort_order": 0,
"is_shared": false,
"is_default": false,
"created_at": null,
"updated_at": null
}
}
-
dataobject-
idstring -
location_idstring -
user_idinteger -
namestring -
filtersobject[]-
fieldstring -
operatorstring -
valuestring
-
-
sortstring -
sort_orderinteger -
is_sharedboolean -
is_defaultboolean -
created_atstring -
updated_atstring
-
{
"message": "Falta filters.",
"errors": {
"filters": [
"Falta filters."
]
}
}
Every error shares the same shape — message and errors.
See Errors.
{
"message": "Falta filters.0.operator.",
"errors": {
"filters.0.operator": [
"Falta filters.0.operator."
]
}
}
Every error shares the same shape — message and errors.
See Errors.
Fetch a smart list
Its filters and sort, not the contacts it matches — to get those, send the
same filters to GET /api/contacts. A list you cannot see (somebody
else's, unshared) answers 404.
GET
/api/smart-lists/{id}
Path parameters
-
idinteger requiredSmart list ID.
Example:
5
curl --request GET \
--get "https://klozzo.com/api/smart-lists/5" \
--header "Authorization: Bearer {YOUR_API_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
const url = new URL(
"https://klozzo.com/api/smart-lists/5"
);
const headers = {
"Authorization": "Bearer {YOUR_API_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "GET",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://klozzo.com/api/smart-lists/5';
$response = $client->get(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_API_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://klozzo.com/api/smart-lists/5'
headers = {
'Authorization': 'Bearer {YOUR_API_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('GET', url, headers=headers)
response.json()
{
"data": {
"id": null,
"location_id": null,
"user_id": 3768,
"name": "aut adipisci",
"filters": [
{
"field": "contact_type",
"operator": "=",
"value": "lead"
}
],
"sort": null,
"sort_order": 2,
"is_shared": false,
"is_default": false,
"created_at": null,
"updated_at": null
}
}
-
dataobject-
idstring -
location_idstring -
user_idinteger -
namestring -
filtersobject[]-
fieldstring -
operatorstring -
valuestring
-
-
sortstring -
sort_orderinteger -
is_sharedboolean -
is_defaultboolean -
created_atstring -
updated_atstring
-
{
"message": "No query results for model."
}
Every error shares the same shape — message and errors.
See Errors.
Update a smart list
Changes the rule, so it changes who the list finds from the next time anybody opens it — including everybody else's, if the list is shared. There is no version history: the previous filters are gone.
PUT
/api/smart-lists/{id}
Sending filters replaces them all; there is no way to add one clause
without resending the rest.
Path parameters
-
idinteger requiredSmart list ID.
Example:
5
Body parameters
-
namestringDisplay name (max 255).
Example:
Hot leads, last 14 days -
filtersobject[]Filter clauses; same shape as the create payload. Replaces the existing set.
-
fieldstringThis field is required when <code>filters</code> is present.
Example:
architecto -
operatorstringThis field is required when <code>filters</code> is present.
Example:
architecto -
valuestringThis field is required when <code>filters</code> is present.
-
-
sortobjectDefault sort
{field, direction}.-
fieldstringThis field is required when <code>sort</code> is present.
Example:
architecto -
directionstringThis field is required when <code>sort</code> is present.
One of
asc,descExample:
desc
-
-
sort_orderintegerDisplay order.
Example:
2 -
is_sharedbooleanWhether the whole team sees the list. Turning it off hides it from everybody but you.
Example:
true -
is_defaultbooleanMake it the list you land on. Setting it clears the flag on whichever list had it.
Example:
false
curl --request PUT \
"https://klozzo.com/api/smart-lists/5" \
--header "Authorization: Bearer {YOUR_API_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json" \
--data "{
\"name\": \"Hot leads, last 14 days\",
\"filters\": [
{
\"field\": \"architecto\",
\"operator\": \"architecto\"
}
],
\"sort\": {
\"field\": \"architecto\",
\"direction\": \"desc\"
},
\"sort_order\": 2,
\"is_shared\": true,
\"is_default\": false
}"
const url = new URL(
"https://klozzo.com/api/smart-lists/5"
);
const headers = {
"Authorization": "Bearer {YOUR_API_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
let body = {
"name": "Hot leads, last 14 days",
"filters": [
{
"field": "architecto",
"operator": "architecto"
}
],
"sort": {
"field": "architecto",
"direction": "desc"
},
"sort_order": 2,
"is_shared": true,
"is_default": false
};
fetch(url, {
method: "PUT",
headers,
body: JSON.stringify(body),
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://klozzo.com/api/smart-lists/5';
$response = $client->put(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_API_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'name' => 'Hot leads, last 14 days',
'filters' => [
['field' => 'architecto', 'operator' => 'architecto'],
],
'sort' => ['field' => 'architecto', 'direction' => 'desc'],
'sort_order' => 2,
'is_shared' => true,
'is_default' => false,
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://klozzo.com/api/smart-lists/5'
payload = {
"name": "Hot leads, last 14 days",
"filters": [
{
"field": "architecto",
"operator": "architecto"
}
],
"sort": {
"field": "architecto",
"direction": "desc"
},
"sort_order": 2,
"is_shared": true,
"is_default": false
}
headers = {
'Authorization': 'Bearer {YOUR_API_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('PUT', url, headers=headers, json=payload)
response.json()
{
"data": {
"id": null,
"location_id": null,
"user_id": 3769,
"name": "architecto eius",
"filters": [
{
"field": "contact_type",
"operator": "=",
"value": "lead"
}
],
"sort": null,
"sort_order": 0,
"is_shared": false,
"is_default": false,
"created_at": null,
"updated_at": null
}
}
-
dataobject-
idstring -
location_idstring -
user_idinteger -
namestring -
filtersobject[]-
fieldstring -
operatorstring -
valuestring
-
-
sortstring -
sort_orderinteger -
is_sharedboolean -
is_defaultboolean -
created_atstring -
updated_atstring
-
Delete a smart list
Deletes a smart list by id, and only the list. No contact is deleted — a smart list never owned anybody, it only found them — so this is always safe, and it is the one destructive-looking call in this API that is not.
DELETE
/api/smart-lists/{id}
Path parameters
-
idinteger requiredSmart list ID.
Example:
5
curl --request DELETE \
"https://klozzo.com/api/smart-lists/5" \
--header "Authorization: Bearer {YOUR_API_TOKEN}" \
--header "Content-Type: application/json" \
--header "Accept: application/json"
const url = new URL(
"https://klozzo.com/api/smart-lists/5"
);
const headers = {
"Authorization": "Bearer {YOUR_API_TOKEN}",
"Content-Type": "application/json",
"Accept": "application/json",
};
fetch(url, {
method: "DELETE",
headers,
}).then(response => response.json());
$client = new \GuzzleHttp\Client();
$url = 'https://klozzo.com/api/smart-lists/5';
$response = $client->delete(
$url,
[
'headers' => [
'Authorization' => 'Bearer {YOUR_API_TOKEN}',
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
]
);
$body = $response->getBody();
print_r(json_decode((string) $body));
import requests
import json
url = 'https://klozzo.com/api/smart-lists/5'
headers = {
'Authorization': 'Bearer {YOUR_API_TOKEN}',
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.request('DELETE', url, headers=headers)
response.json()
{
"message": "Smart list deleted."
}
-
messagestring