Create a ticket
POST /tickets creates a ticket. Only projectId and title are required. Without a
statusId, the ticket lands in the project’s backlog column. The key needs Board — read &
write access.
// Create a ticket in a project. It lands in the project's backlog column.//// node create-ticket.ts// SAW_PROJECT_ID=project-… node create-ticket.tsimport { createClient } from './saw.ts';
const saw = createClient();
const projectId = process.env.SAW_PROJECT_ID ?? (await saw.get('/projects'))[0]?.id;if (!projectId) throw new Error('This organization has no projects yet.');
const ticket = await saw.post('/tickets', { body: { projectId, title: 'Created by the create-ticket recipe', description: 'This ticket was created through the SAW API.', priority: 'LOW', },});
console.log(`Created ${ticket.identifier}: ${ticket.title}`);// The id is what every other ticket operation takes, e.g. `node update-ticket.ts <id>`.console.log(ticket.id);SAW_API_KEY=saw_live_… node --experimental-strip-types create-ticket.tsIt prints the new ticket’s identifier and then its ID. Pass the ID to update-ticket.ts and comment.ts.
Other fields
Section titled “Other fields”You can set these at creation or later:
- Content:
description,priority(NO_PRIORITY,URGENT,HIGH,MEDIUM,LOW). - Board:
statusId(a column fromGET /statuses?projectId=…),labelIds. - People and dates:
assigneeId,dueDate. - Planning:
cycleId,epicId,milestoneId,estimate. - Structure:
parentTicketId, which makes the ticket a sub-ticket.
An ID from another project, or a value the project doesn’t accept, answers 422 with a slug
such as invalid_status or validation_error. See
Responses and errors.