Pagination
Send limit to choose the page size. To read the next page, pass the returned nextPageToken as pageToken. Stop when nextPageToken is absent or null.
{
"status": "success",
"data": [
{ "id": "Xq8mTe2LwP4kZ1aB9cDf", "name": "Sales" },
{ "id": "Rk2pLm9QxT7vB4nC1dEf", "name": "Support" }
],
"nextPageToken": "eyJvZmZzZXQiOjIwfQ"
} On lists that use data, read their items from that field. Some lists group items by workspace; check each endpoint’s response.
Example
curl "https://api.platic.ai/v1/agents?limit=20&pageToken=$NEXT_PAGE_TOKEN" \
-H "Authorization: Bearer $PLATIC_API_KEY" for await (const agent of platic.agents.iterate()) {
console.log(agent.name);
} Parameters
| Parameter | Description |
|---|---|
limit | How many items you want per page |
pageToken | The nextPageToken from the previous page |
The allowed range of limit and its default are on each list's page. For example, List agents takes 1 to 100 and defaults to 20.
Rules
- When
nextPageTokenis absent ornull, there are no more pages. - Send the
pageTokenwith the same filters and the same?workspace=(or without it, if the first page didn't carry it). With different ones, the answer is400. - A page can contain fewer than
limititems and still have another page. If you receivenextPageToken, use it to continue. - Short lists, such as the eval scenarios of a workspace, come complete and without
nextPageToken. - On contacts, V1 conversations, chats and campaigns,
pageTokencan't be combined withoffset: the answer is400with the problem indetails.issues.
Conversations V2
List conversations, the messages of a conversation and Search conversations use the same limit, pageToken and nextPageToken, with a few extra rules:
| List | limit | Order |
|---|---|---|
| List conversations | 1 to 200, default 50 | lastActivityAt (default) or createdAt, newest first by default |
| Messages of a conversation | 1 to 100, default 20 | Creation date, newest first by default |
| Search conversations | 1 to 100, default 10 | Rank order, up to candidateLimit (250 by default) |
{
"status": "success",
"data": [
{ "id": "conv_1", "contactName": "Ana", "operation": "supervised" }
],
"nextPageToken": "eyJrIjoiY29udl8xIn0",
"pagination": { "limit": 20, "returnedCount": 1, "hasMore": true },
"meta": { "fields": ["id", "contactName", "operation"], "include": [], "requestId": "req_123" }
} nextPageTokenis always present. It isnullon the last page.pagination.hasMoresays the same thing.- Follow the token, not the page length. A page can be shorter than
limit, or even empty, and still have anextPageToken: conversations you can't see or that were deleted are left out. - Same filters, same order, same workspace. A
pageTokensent with other filters, another order, another workspace or another credential answers400 INVALID_CURSOR.limit,fieldsandincludemay change between pages. - No
offset. V2 lists only page with tokens. - The list is live. A conversation whose
lastActivityAtchanges between pages can move position. Messages, sorted by their creation date, don't move.
Search sessions
A search ranks its results once and keeps that ranking for 15 minutes. Send the same body with pageToken to read the next page. After 15 minutes the token answers 410 SEARCH_SESSION_EXPIRED: repeat the search without pageToken. Each page is checked again, so a conversation deleted or out of your reach since the first page is left out. Pages never go past candidateLimit.
Invalid note type. Should be either "note", "tip", "important", "warning", "caution"