Fetch Tickets
Retrieves a paginated list of tickets within a date range, with optional filters for status, assignee, category, tags, CSAT rating, and origin. Optionally includes the full message thread for each tic
Last updated
{
"tickets": [
{
"_id": "6650a1b2c3d4e5f678901234",
"createdAt": "2026-03-15T10:30:00.000Z",
"updatedAt": "2026-03-16T14:22:00.000Z",
"status": "Resolved",
"priority": 2,
"sourceType": "discord",
"resolutionTime": 100920000,
"assignedTo": {
"_id": "6650b2c3d4e5f67890123456",
"name": "Jane Smith"
},
"category": {
"_id": "6650c3d4e5f678901234567a",
"name": "Billing"
},
"tags": [
{ "_id": "6650d4e5f678901234567890", "name": "VIP" }
],
"csat": { "value": 5 },
"aiStatus": "resolved",
"discordUsers": [
{ "discordAuthorId": "123456789", "name": "user#1234" }
],
"attributes": [
{ "attributeId": "6650e5f6789012345678abcd", "name": "Plan", "content": "Enterprise" }
],
"customer": {
"_id": "6650f6789012345678abcdef",
"email": "user@example.com",
"attributes": [
{ "attributeId": "665012345678abcdef012345", "name": "Company", "content": "Acme Inc" }
]
},
"messages": [
{
"_id": "665112345678abcdef012345",
"content": "I need help with my billing",
"senderType": "customer",
"senderName": "user#1234",
"messageType": "ExternalMessage",
"createdAt": "2026-03-15T10:30:00.000Z",
"attachments": []
},
{
"_id": "665212345678abcdef012345",
"content": "Let me look into that for you",
"senderType": "agent",
"senderName": null,
"messageType": "ExternalMessage",
"createdAt": "2026-03-15T11:00:00.000Z",
"attachments": []
}
]
}
],
"count": 285,
"pagination": {
"limit": 50,
"skip": 0,
"hasMore": true
}
}{ "error": "MISSING_DATE_RANGE" }{ "error": "INVALID_DATE_RANGE" }{ "error": "INVALID_LIMIT" }{ "error": "INVALID_SKIP" }{ "error": "UNSUPPORTED_SORT_FIELD" }{ "error": "UNSUPPORTED_SORT_ORDER" }{ "error": "Internal server error" }curl -X GET "https://gateway.mava.app/api/tickets?startDate=2026-01-01&endDate=2026-04-01&limit=20" \
-H "x-auth-token: YOUR_API_KEY"curl -X GET "https://gateway.mava.app/api/tickets?startDate=2026-01-01&endDate=2026-04-01&status=Open&status=Pending&assignedTo=Unassigned&origin=discord&sortBy=priority&sortOrder=desc&includeMessages=true&limit=10" \
-H "x-auth-token: YOUR_API_KEY"const params = new URLSearchParams({
startDate: '2026-01-01',
endDate: '2026-04-01',
limit: '20',
includeMessages: 'true',
});
const response = await fetch(`https://gateway.mava.app/api/tickets?${params}`, {
method: 'GET',
headers: {
'x-auth-token': 'YOUR_API_KEY',
},
});
const data = await response.json();
console.log(`Found ${data.count} tickets`);const limit = 50;
let skip = 0;
let allTickets = [];
while (true) {
const params = new URLSearchParams({
startDate: '2026-01-01',
endDate: '2026-04-01',
limit: String(limit),
skip: String(skip),
});
const res = await fetch(`https://gateway.mava.app/api/tickets?${params}`, {
headers: { 'x-auth-token': 'YOUR_API_KEY' },
});
const page = await res.json();
allTickets.push(...page.tickets);
if (!page.pagination.hasMore) break;
skip += limit;
}
console.log(`Total tickets fetched: ${allTickets.length}`);?status=Open&status=Pending
?origin=discord&origin=email
?csatValues=4&csatValues=5&csatValues=no-rating