POST /api/v1/handoff/ticket

/ Create a Human Desk ticket from your own UI, outside the chat stream's automatic handoff.

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 characters max. Extra context for your 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 is only ever true for tickets from the hosted widget, on Scale or Delegate with live chat on. API-sourced tickets always get the async email flow.

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