Skip to main content

List your jobs

List your recent jobs to find results you did not receive, such as a callback that never arrived. The list returns one page at a time, newest first, so read it in a loop until no next page is left.

Before you start​

Step 1: Read one page​

Ask for a page of up to page_size jobs. The default is 50 and the maximum is 100; a larger value is treated as 100.

Request
curl "https://partner.api.sasha.eu/jobs?page_size=100" \
-H "Authorization: Bearer <access-token>"
Response
{
"jobs": [
{
"job_id": "01a14496-4060-7e4a-9c2b-5d6e7f8a9b0c",
"type": "lookup-signature",
"status": "completed",
"signature_id": "12345678901234567890",
"creator_id": 123,
"guidance": {
"share_state": "private",
"advice": "not_allowed"
},
"created_at": "2026-10-16T12:01:00Z",
"updated_at": "2026-10-16T12:01:02Z"
}
],
"next_page_token": "<next-page-token>"
}

next_page_token is an opaque string. Send it back unchanged as page_token to read the next page. When next_page_token is absent or empty, you have read the last page. A page can hold fewer jobs than page_size, or none, and still have a next page, so stop on the token, never on the page size.

Step 2: Read every page​

This Node.js script, saved as list-jobs.mjs, reads every page and prints each job. Run it with SASHA_ACCESS_TOKEN set to an access token:

list-jobs.mjs
const listAllJobs = async (accessToken) => {
const jobs = [];
let pageToken = "";

do {
const url = new URL("https://partner.api.sasha.eu/jobs");
url.searchParams.set("page_size", "100");
if (pageToken) url.searchParams.set("page_token", pageToken);

const response = await fetch(url, {
headers: { Authorization: `Bearer ${accessToken}` },
});
if (!response.ok) {
throw new Error(`List Jobs failed with ${response.status}: ${await response.text()}`);
}

const page = await response.json();
jobs.push(...page.jobs);
pageToken = page.next_page_token ?? "";
} while (pageToken);

return jobs;
};

for (const job of await listAllJobs(process.env.SASHA_ACCESS_TOKEN)) {
console.log(job.job_id, job.type, job.status);
}

A 400 on REST, or INVALID_ARGUMENT on gRPC, with the reason PAGE_TOKEN_INVALID means the page_token was not one the API returned. Retrying with the same token fails the same way; start again from the first page, without page_token.

The list holds only recent jobs: a job stays in it for 48 hours after it last changed status, the same window in which GetJob and WatchJob find it. The list is not a snapshot. A job created while you read the pages can appear on a later page or be missed. A job that leaves the 48-hour window while you read is left out of the pages after that. To catch new jobs, start again from the first page.

See also​