Skip to content
Docs
About By Dawn Contact supportOpen By Dawn
  1. Work with tickets
  2. Create a ticket

Create a ticket

Use this to file work in By Dawn from another tool: an alert that fires, a form someone fills in, an email to a support address. By the end you’ll have a ticket in a project’s backlog, and its ID to update or comment on it later.

Before you start: you need a Board — read & write key (see Scopes). To pick the project, set SAW_PROJECT_ID to its ID. Without it, the recipe uses your organization’s first project.

Read down the steps. The code on the right follows along and highlights the lines each one explains.

  1. Every recipe starts this way, as the Quickstart explains.

    // 1. Exchange the API key for a short-lived access token. Every call after this goes to your
    // organization's URL with the token as a Bearer header.
    const exchange: Schemas['ApiKeyExchange'] = { apiKey };
    const { accessToken: token } = await call<Schemas['AccessTokenData']['data']>(`${ACCOUNTS_URL}/auth/token/api-key`, { method: 'POST', body: exchange });
    const api = `${WORKSPACE_URL}/orgs/${orgIdOf(token)}`;
  2. Tickets always belong to a project, so the recipe needs one. In your own integration you’ll usually know it already, for example one project per team or per alert source. GET /projects lists them if you need to look one up.

    // 2. Choose the project: SAW_PROJECT_ID if you set it, or else your organization's first one.
    const projectId = process.env.SAW_PROJECT_ID ?? (await call<Schemas['Project'][]>(`${api}/projects`, { token }))[0]?.id;
    if (!projectId) throw new Error('This organization has no projects yet.');
  3. POST /tickets needs only a projectId and a title. Leave out the column and the ticket lands in the project’s backlog, where people triage new work.

    The answer is the new ticket. The recipe prints its identifier, such as WEB-5, for people, then its id for code: that’s what you pass to update or comment on it.

    // 3. Create the ticket. Only projectId and title are required, and it lands in the backlog column.
    const create: Schemas['TicketCreate'] = {
    projectId,
    title: 'Created by the create-ticket recipe',
    description: 'This ticket was created through the SAW API.',
    priority: 'LOW',
    };
    const ticket = await call<Schemas['Ticket']>(`${api}/tickets`, { method: 'POST', body: create, token });
    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);

Run the TypeScript recipe from this page. It creates a real ticket in your organization, so use a test organization. The new ticket’s ID then fills in the update and comment recipes for you.

Try it with your organization

How this works

Connect once and run this recipe live against the By Dawn API.

Your key stays in this tab and goes only to By Dawn. Use a read-only key in a test organization.

▶ Run create-ticket.tsThe same code CI runs, in your browser

This recipe creates a ticket in your organization.

Connect your organization above to run it.

Anything you can set now, you can also change later:

  • What it is: description, and priority (NO_PRIORITY, URGENT, HIGH, MEDIUM or LOW).
  • Where it sits: statusId, a column from GET /statuses?projectId=…, and labelIds.
  • Who and when: assigneeId and dueDate.
  • Planning: cycleId, epicId, milestoneId and estimate. GET /epics?projectId=… lists the project’s epics (see Group work into epics).
  • Structure: parentTicketId, which makes the ticket a sub-ticket.

An ID from another project, or a value the project doesn’t accept, gets 422 with a slug such as invalid_status or validation_error, and message says which field. See Responses and errors.