Create A Ticket

Create a ticket on behalf of an end user with POST /tickets.

Create a ticket on the desk the token belongs to. The requester is the end user you are filing for, keyed by email. That user is created on first use. The token is only the channel: the agent UI shows "API Via {token name}" so it is clear how the ticket arrived.

Body

Example

curl
curl -X POST https://acme.headoni.app/api/v1/tickets \
  -H "Authorization: Bearer hd_your_secret_here" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "alice@example.com",
    "name": "Alice",
    "subject": "Login broken on staging",
    "body": "I loop back to /sign-in after typing my email.",
    "priority": "high"
  }'
node
const res = await fetch("https://acme.headoni.app/api/v1/tickets", {
  method: "POST",
  headers: {
    Authorization: "Bearer hd_your_secret_here",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    email: "alice@example.com",
    name: "Alice",
    subject: "Login broken on staging",
    body: "I loop back to /sign-in after typing my email.",
    priority: "high",
  }),
});
const { ticket } = await res.json();

Response

201 Created. The response is minimal. Read the full ticket back with Get A Ticket.

201
{
  "ticket": {
    "id": "1490375649312800768",
    "number": 1247,
    "subject": "Login broken on staging",
    "priority": "high",
    "requester": { "email": "alice@example.com" }
  }
}

Errors

StatuserrorMeaning
400invalid_bodyA field is missing or malformed. See issues.
400department_not_founddepartmentId is not on this desk or is deleted.
400ticket_type_not_foundticketTypeId is not on this desk or is archived.
401unauthenticatedMissing or invalid token.
403insufficient_scopeToken lacks tickets:create.
403token_desk_mismatchToken belongs to a different desk than the host.