API and webhooks

Last updated November 26, 2026

Create and update tickets and customers from your own systems, and get a webhook when anything changes. The API speaks JSON at https://api.lazydesk.app/v1.

Keys

The site's owner makes keys in Settings → API and webhooks. A key belongs to one site and sees only its tickets and customers. Send it on every request:

Authorization: Bearer ldk_…

Each key can make 600 requests a minute. Errors come back with an HTTP status and a body like {"error": {"code": "INPUT", "message": "subject: …"}}: 400 INPUT, 401 UNAUTHORIZED, 403 FORBIDDEN, 404 NOT_FOUND, 429 RATE_LIMITED, 500 SERVER. Times are milliseconds since 1970.

Tickets

A ticket has id, number (1, 2, 3… per site), channel (chat, email or api), subject, status (open, pending, on_hold, solved), priority (low, normal, high, urgent), assigneeUid, tags, fields, assistant (active: the AI answers; human: your team does), handoffReason, customer, seq (its last message's number), preview, lastMessageAt, createdAt and updatedAt. Where a path takes :ticket, give its id or its number.

GET/tickets

Newest activity first: {"tickets": […], "hasMore": true}. Filters: status and priority (comma lists), assigneeUid (none for unassigned), handler (team or ai), tag, customerId, companyId, query. Page with limit (up to 100) and before, the last ticket's lastMessageAt.

POST/tickets

A new ticket with the customer's first message. customer is {"id": "…"}, or an email and/or externalId (your id for them) with name, phone and fields: the customer is found by externalId, then email, or made. channel is api (replies reach you by webhook) or email (replies also go to the customer by email). Optional: status, priority, tags, fields. If the AI is on, it answers.

curl https://api.lazydesk.app/v1/tickets \
  -H "Authorization: Bearer $LAZYDESK_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "customer": {"email": "ann@example.com", "name": "Ann", "externalId": "u_812"},
    "subject": "Refund for order 1042",
    "message": "The box arrived damaged.",
    "priority": "high",
    "tags": ["refund"]
  }'
GET/tickets/:ticket

One ticket.

PATCH/tickets/:ticket

Any of status, priority, assigneeUid (a teammate's, or null), subject, tags (replaces the list), fields (merged; null removes one).

Messages

A message has id, seq (1, 2, 3… in its ticket), from (visitor is the customer; operator, ai, note or system), text, name and createdAt. Notes are for your team only.

GET/tickets/:ticket/messages

Oldest first, after after (a seq, 0 by default), up to limit (200): {"messages": […], "hasMore": false}.

POST/tickets/:ticket/messages

from is visitor (the customer wrote; the AI answers if it's on), operator (a reply from your team, under name; it takes the ticket from the AI) or note. With text, and optionally status and nonce: your id for the message, so sending it twice posts it once.

Customers

A customer has id, name, email, externalId, phone, companyId, fields, createdAt and updatedAt.

GET/customers

Newest first; query matches name, email or externalId, companyId filters. Page with limit and before (createdAt).

POST/customers

Finds the customer by externalId, then email, and updates them with name, phone and fields; or makes them.

GET/customers/:id

One customer.

PATCH/customers/:id

Any of name, email, externalId, phone, companyId (null clears one) and fields (merged).

Webhooks

Add an https URL in Settings → API and webhooks. LazyDesk POSTs it JSON for every change to the site's tickets and customers, from the chat, email, the console, the AI or the API:

  • ticket.created: {ticket}
  • ticket.updated: {ticket, changed}, the names of what changed
  • message.created: {ticket, message}, notes included
  • customer.created and customer.updated: {customer}
  • ping: the Send test button
{
  "id": "evt_6b07…",
  "type": "message.created",
  "siteId": "6a1f…",
  "createdAt": 1795600000000,
  "data": { "ticket": { … }, "message": { … } }
}

Answer with any 2xx within 10 seconds. Anything else is tried again after 10 seconds, a minute and 10 minutes. The same id comes again on a retry, so you can skip one you've had. Each POST carries LazyDesk-Event, LazyDesk-Delivery (the id) and LazyDesk-Signature: t=…,v1=…: v1 is the hex HMAC-SHA256 of t.body (the time, a dot, then the raw body) with the webhook's signing secret, and t the Unix time it was sent. Check it before trusting the body:

import { createHmac, timingSafeEqual } from "node:crypto";

// body: the raw request body, as a string, before any JSON parsing.
function verified(body, header, secret) {
  const parts = Object.fromEntries(header.split(",").map((p) => p.split("=")));
  const expected = createHmac("sha256", secret).update(`${parts.t}.${body}`).digest("hex");
  const fresh = Math.abs(Date.now() / 1000 - Number(parts.t)) < 300;
  return fresh && parts.v1?.length === expected.length &&
    timingSafeEqual(Buffer.from(parts.v1), Buffer.from(expected));
}

Questions? Write to support@lazydesk.app, or use the chat on this page.