API reference
Sample: List tickets
Return the tickets in your account, newest first. Use the query parameters to filter by status, priority or requester, and page through the results with cursor.
This is a sample page
"Acme Tickets" is a made-up API. This page shows a
GET endpoint documented with the PinkDocs API blocks.GET
https://api.example.com/v1/ticketshttps://api.example.com/v1/ticketsRequest
curl -G "https://api.example.com/v1/tickets" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d status=open \
-d priority=high \
-d limit=2const params = new URLSearchParams({ status: 'open', priority: 'high', limit: '2' });
const response = await fetch(`https://api.example.com/v1/tickets?${params}`, {
headers: { 'Authorization': 'Bearer YOUR_API_KEY' }
});
const { data, next_cursor } = await response.json();import requests
response = requests.get(
"https://api.example.com/v1/tickets",
params={"status": "open", "priority": "high", "limit": 2},
headers={"Authorization": "Bearer YOUR_API_KEY"},
)
page = response.json()$url = add_query_arg(['status' => 'open', 'priority' => 'high', 'limit' => 2], 'https://api.example.com/v1/tickets');
$response = wp_remote_get($url, [
'headers' => ['Authorization' => 'Bearer YOUR_API_KEY'],
]);
$page = json_decode(wp_remote_retrieve_body($response), true);Response
A page of tickets
{
"data": [
{
"id": "tkt_8f2a91",
"number": 1042,
"subject": "Cannot log in after password reset",
"status": "open",
"priority": "high",
"created_at": "2026-10-07T09:30:00Z"
},
{
"id": "tkt_7c1d04",
"number": 1039,
"subject": "Invoice shows the wrong VAT number",
"status": "open",
"priority": "high",
"created_at": "2026-10-06T16:12:44Z"
}
],
"has_more": true,
"next_cursor": "eyJpZCI6InRrdF83YzFkMDQifQ"
}A filter has an unknown value
{
"error": "invalid_request",
"message": "status must be one of: open, pending, solved, closed."
}Missing or invalid API key
{
"error": "unauthorized"
}Authentication
- Header
AuthorizationstringrequiredYour API key as a bearer token, e.g.Bearer sk_live_….
Query parameters
- Query
statusstringOnly tickets with this status:open,pending,solvedorclosed. - Query
prioritystringOnly tickets with this priority:low,normal,highorurgent. - Query
requester_emailstringOnly tickets from this customer. - Query
limitintegerdefault:25How many tickets to return, from 1 to 100. - Query
cursorstringThenext_cursorfrom the previous page. Leave it out for the first page.
Paging through results
Each response has has_more and next_cursor. While has_more is true, call the endpoint again with cursor set to next_cursor:
let cursor = null;
const tickets = [];
do {
const params = new URLSearchParams({ status: ‘open’, limit: ‘100’ });
if (cursor) params.set(‘cursor’, cursor);
const res = await fetch(`https://api.example.com/v1/tickets?${params}`, {
headers: { ‘Authorization’: ‘Bearer YOUR_API_KEY’ }
});
const page = await res.json();
tickets.push(…page.data);
cursor = page.has_more ? page.next_cursor : null;
} while (cursor);
Cursors stay valid for 24 hours. Don't build them yourself: they can change format at any time.
Was this page helpful?
Great! What worked best for you?
Please provide additional details about your experience.
Thank you for your feedback!
We appreciate your input.
