Skip to content
The SAW API is in beta.

Update a ticket

PATCH /tickets/{ticketId} changes only the fields you send. The key needs Board — read & write access.

update-ticket.ts
// 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}`);
Terminal window
SAW_API_KEY=saw_live_… node --experimental-strip-types update-ticket.ts <ticketId>
  • labelIds and repoIds replace the whole list. To add a label, send the existing IDs plus the new one.
  • Nullable fields. For fields like cycleId and estimate, leaving the field out keeps it, null clears it, and a value sets it.
  • Moving between columns. Send statusId to move the ticket. A move into a column with the building role would start an agent run, so the API refuses it for an API key.
  • Archiving. POST /tickets/{ticketId}/archive takes the ticket off the board, and /unarchive brings it back. A key can’t delete tickets.