POST /api/v1/handoff/ticket

Create escalation tickets suggestions from your own UI.

Request

FieldTypeRequiredDescription
agentIdstringYesThe agent's public ID
visitorEmailstringYesA valid email for follow-up
sessionIdstringNoTies the ticket to an existing conversation. Auto-generated if omitted
notestringNo4,000 chars max. Extra context for the team
historyarrayNo{ role: "user" | "assistant", content: string }[], last 12 turns used. Summarized into a subject and urgency automatically
const res = await fetch("https://app.humaner.io/api/v1/handoff/ticket", {
  method: "POST",
  headers: {
    Authorization: "Bearer hm_live_xxxxxxxx",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    agentId: "AGENT_ID",
    visitorEmail: "customer@example.com",
    note: "Customer needs a refund on order #4521"
  })
});

Response

200 OK

{
  "ok": true,
  "ticketId": "tkt_abc123",
  "liveChat": { "enabled": false }
}

liveChat=enabled only for tickets issued from the widget. API-sourced tickets can only escalate issues with email references.

Errors

StatusMeaning
400agentId missing, or visitorEmail missing or invalid
401Missing or invalid API key, or no Origin header and no key
403Origin not allowed, or Human Desk is off for the organization
404Agent not found
429Rate limit hit (Retry-After header set)
500Ticket creation failed. Safe to retry