List a segment's contacts
Page through the contacts that match a segment right now, ordered by id.
GET
https://app.usenotix.dev/api/v1/contactBooks/{contactBookId}/segments/{segmentId}/contactsFull access and read only keys can call this. Sending access keys cannot. Key permissions lists the extra rules some calls have.
Page through the contacts that match a segment right now, ordered by id. Pass nextCursor back as cursor for the next page; limit is 1 to 100 (50 by default).
Path parameters
contactBookIdstringrequired
segmentIdstringrequired
Query parameters
cursorstring
limitinteger
Contacts per page, 1 to 100. Defaults to 50.
Minimum 1. Maximum 100. Default 50.
Headers
Authorizationstringrequired
Bearer followed by your API key.
Errors
400
Invalid cursor or limit.
404
No segment with this id in the contact book for the calling team.
422
The segment took longer than 10 seconds to evaluate.
Every error has the same shape. See all error codes.
curl -X GET "https://app.usenotix.dev/api/v1/contactBooks/<contactBookId>/segments/<segmentId>/contacts" \
-H "Authorization: Bearer $NOTIX_API_KEY"
import { Notix } from "notix-js";
const notix = new Notix(process.env.NOTIX_API_KEY);
let cursor: string | undefined;
do {
const { data } = await notix.segments.contacts("cb_123", "seg_123", { cursor, limit: 100 });
data?.data.forEach((contact) => console.log(contact.email));
cursor = data?.nextCursor ?? undefined;
} while (cursor);
from notix import Notix
notix = Notix() # reads NOTIX_API_KEY
cursor = None
while True:
page, _ = notix.segments.contacts("cb_123", "seg_123", cursor=cursor, limit=100)
for contact in page["data"]:
print(contact["email"])
cursor = page["nextCursor"]
if cursor is None:
break
use Notix\Notix;
$notix = new Notix(getenv('NOTIX_API_KEY'));
$cursor = null;
do {
$page = $notix->segments->contacts('cb_123', 'seg_123', array_filter(['cursor' => $cursor, 'limit' => 100]));
foreach ($page['data'] as $contact) {
echo $contact['email'], PHP_EOL;
}
$cursor = $page['nextCursor'];
} while ($cursor !== null);
Response200
{
"data": [
{
"id": "cm1x8f3k20001qz7v5b9d2e4a",
"email": "customer@example.com",
"firstName": "Acme",
"lastName": "Acme",
"subscribed": true,
"properties": {},
"createdAt": "string",
"updatedAt": "string"
}
],
"nextCursor": "string",
"total": 1
}