Update a ticket
PATCH /tickets/{ticketId} changes only the fields you send. The key needs Board — read &
write access.
// Update a ticket's fields. Only the fields you send change.//// node update-ticket.ts <ticketId>import { createClient } from './saw.ts';
const ticketId = process.argv[2];if (!ticketId) throw new Error('Usage: node update-ticket.ts <ticketId>');
const saw = createClient();
const before = await saw.get('/tickets/{ticketId}', { path: { ticketId } });
// Sending `statusId` moves the ticket to another board column. A move into a column with the// `building` role would start an agent run, so the API refuses it for an API key.const ticket = await saw.patch('/tickets/{ticketId}', { path: { ticketId }, body: { title: 'Updated by the update-ticket recipe', priority: 'HIGH', description: `${before.description ?? ''}\n\nUpdated through the SAW API.`.trim(), },});
console.log(`${ticket.identifier}: "${before.title}" → "${ticket.title}", priority ${before.priority} → ${ticket.priority}`);SAW_API_KEY=saw_live_… node --experimental-strip-types update-ticket.ts <ticketId>Things to know
Section titled “Things to know”labelIdsandrepoIdsreplace the whole list. To add a label, send the existing IDs plus the new one.- Nullable fields. For fields like
cycleIdandestimate, leaving the field out keeps it,nullclears it, and a value sets it. - Moving between columns. Send
statusIdto move the ticket. A move into a column with thebuildingrole would start an agent run, so the API refuses it for an API key. - Archiving.
POST /tickets/{ticketId}/archivetakes the ticket off the board, and/unarchivebrings it back. A key can’t delete tickets.