LemuAI docs

LemuAI developer reference

The REST API, the LemuTickets API, webhooks, SDKs, events and the MCP server.

Checked against LemuAI app version 1.0.53. The latest version is always at https://docs.lemuai.com. Plain-text copies for AI assistants: https://docs.lemuai.com/llms-developers.txt

API Trigger

API Trigger helps you trigger your Voice Agent using external systems, like N8n or Zapier

https://docs.lemuai.com/voice-agent/api-trigger

API Payload#

The API Trigger is a POST request, which requires an API Key. It expects a valid JSON with phone_number and initial_context.

Initial Context#

initial_context is a valid JSON object, which contains any contextual information that you would want your voice agent to access. You can refer to these values in your prompts using Handle Bars, which are values enclosed in {{ and }}.

Example: If you have below JSON as your initial_context

Text
{
    "initial_context": {
        "user": {
            "name": "John"
        }
    }
}

you can refer to the user name in your prompts as {{user.name}}. The keys of initial_context are added to the call's context directly, so you don't prefix them with initial_context.

Webhook

Webhook node allow you to sync the result of Voice Agent runs to your external systems, like CRM or to other workflow orchestrator like Zapier or n8n.

https://docs.lemuai.com/voice-agent/webhook

You can have multiple Webhook Nodes for a single Voice Agent, if you want to sync the result of the call at multiple places.

Creating the Webhook Payload#

The payload can contain a valid JSON, and you can reference variables while constructing that payload. You can reference below variables while constructing the payload.

  • {{workflow_run_id}} Unique ID of the Agent run
  • {{workflow_id}} ID of the Agent
  • {{workflow_name}} Name of the workflow
  • {{initial_context.*}} Initial context variables
  • {{gathered_context.*}} Extracted variables
  • {{cost_info.call_duration_seconds}} Call duration
  • {{recording_url}} Call recording URL
  • {{transcript_url}} Transcript URL

An example of the payload is given below

Text
{
  "call_id": "{{workflow_run_id}}",
  "first_name": "{{initial_context.first_name}}",
  "rsvp": "{{gathered_context.rsvp}}",
  "duration": "{{cost_info.call_duration_seconds}}",
  "recording_url": "{{recording_url}}",
  "transcript_url": "{{transcript_url}}"
}

HTTP API

Create REST API tools that your AI agent can invoke during conversations to integrate with external systems.

https://docs.lemuai.com/voice-agent/tools/http-api

HTTP API tools allow you to attach extrernal REST API calls directly to workflow nodes, enabling your voice agents to call any internal or external system during live conversations based on LLM judgment and your prompts. This works similar to function calling on any agentic platform and is fully customizable.

What is an HTTP API Tool?#

An HTTP API Tool is a REST API definition that the LLM can invoke at runtime.

Typical use cases:

  • Call your own backend endpoints
  • Trigger n8n automations
  • Sync data with a CRM
  • Fetch data from external APIs (weather, pricing, availability, etc.)
  • Write/update/read data using Rest API

The LLM decides:

  • which tool to call
  • when to call it
  • what parameters to send

All based on:

  • Your prompts: node-level instructions in simple english (or any language)
  • Tool name
  • Tool description
  • Parameter definitions

Defining an HTTP API Tool#

1. Tool Name#

  • Must be clear and action-oriented.

  • Examples: capture_lead_interest, fetch_weather, 'create_crm_contact', etc

2. Tool Description#

  • Extremely important
  • This is how the LLM decides when to use the tool.
  • Write it in plain, explicit English.

Bad: "API to capture data"

Good: "This tool is to capture interest. Use this tool when the user clearly expresses interest in the product or wants to be contacted"

3. Endpoint Configuration#

  • Full URL (must include http:// or https://)
  • Supports REST methods
Common mistake: forgetting https:// in the URL.

4. Authentication & Headers#

  • Add custom authentication
  • Add custom headers
  • Works with internal services and third-party APIs

5. Parameters#

Each parameter must have:

  • Name
  • Type
  • Description
  • Required/Optional flag

Parameter descriptions matter more than types.

Guidelines:

  • Start with string parameters when possible
  • Be explicit in what the value represents
  • Mark only truly mandatory fields as required

Example:

  • interest (string): "Set to true if the user clearly shows intent to buy or wants follow-up. Otherwise false."


Attaching Tools to Workflow Nodes#

  • You can attach multiple tools to a single node
  • All the tools that you have created will be available for selection in the node
  • Tools are only callable when attached to that node
  • The LLM will choose which one to call

Inside the node, guide the LLM using simple English instructions.

Example:

"If the user shows interest in speaking to sales or wants a callback, immediately call the capture_lead_interest tool and set interest to true." This instruction is often the deciding factor for correct tool usage.

This instruction is often the deciding factor for correct tool usage.


Tool Invocation Logic (How the LLM Thinks)#

The LLM considers:

  • User's spoken intent
  • Node prompt instructions
  • Tool name and description
  • Parameter descriptions

If these align clearly, the tool is called automatically.

Poor naming or vague descriptions lead to:

  • Missed tool calls
  • Wrong parameters
  • Hallucinated values

Key Best Practices#

  • Name tools clearly
  • Write detailed, action-based descriptions
  • Keep parameters simple at first
  • Always include http/https in URLs
  • Use plain English in node instructions
  • Attach only relevant tools to each node

Well-defined tools + clear prompts = reliable, production-grade voice agents.

AI Assistants (MCP)

Let AI assistants like Claude and Cursor use your Lemu AI voice agents through the Model Context Protocol

https://docs.lemuai.com/mcp/overview

Lemu AI runs a remote Model Context Protocol (MCP) server. Once you connect an AI assistant to it, the assistant can look up your voice agents, request phone calls with them, and read how those calls went, all from a normal chat.

Server address:

Text
https://mcp.lemuai.com/mcp

It uses the standard streamable HTTP transport, so any MCP client that supports remote servers with OAuth can connect.

What an assistant can do#

You ask the assistant to...It uses
See which agents it may use and what details a call needslist_agents, get_agent
Place a call with one of those agentsstart_call
Check the status and outcome of its callsget_call, list_calls
Cancel a call that hasn't been dialed yetcancel_call
Draft a new voice agent from a short briefcreate_agent_draft, update_agent_draft, test_agent, archive_agent

See Tools for the full list and what each tool accepts.

How it's kept safe#

An assistant never gets more access than a person in your organization gives it:

  • An admin approves every connection. When an assistant connects, you're sent to a Lemu AI consent screen. Only someone with admin rights in the organization can approve it.
  • You choose the permissions. Each connection gets only the permissions ticked on the consent screen, such as reading agents or requesting calls.
  • You choose the agents. For calls, you pick exactly which agents the assistant may use. Agents you create later are not added automatically.
  • Daily limits. Each connection has a cap on calls per day (at most 200), plus limits on concurrent and pending calls.
  • A person confirms every call. Calls an assistant requests wait for confirmation by someone in your organization before anything is dialed.
  • Your calling policy always applies. Who may be called, local calling hours, the do-not-call list and the AI disclosure are enforced by Lemu AI, whatever the assistant sends.
  • Everything is logged. Every request is recorded in an audit log.

Anything a person says on a call is returned to the assistant as data, never as an instruction.

See Permissions & limits for the details.

Next steps#

Connect an Assistant

Add the Lemu AI MCP server to Claude, Claude Code or Cursor and approve the connection

https://docs.lemuai.com/mcp/connect

Connecting takes two parts: you add the Lemu AI server to your assistant, then you approve the connection on a Lemu AI consent screen. There is no API key to copy. The assistant signs in with OAuth, the same way you'd connect it to any other service.

Server address:

Text
https://mcp.lemuai.com/mcp

Before you start#

  • You need a Lemu AI account with admin rights in the organization you want to connect. Other members can't approve a connection.
  • To let the assistant request calls, the organization needs at least one active agent and a configured telephony provider.

Add Lemu AI to your assistant#

These steps follow each client's standard setup for remote MCP servers. The Lemu AI side (discovery, client registration and the consent screen) works with any client that supports MCP over OAuth. Menu names in third-party apps can change, so check your client's own docs if a step looks different.

Claude

  1. In Claude, open Settings → Connectors.
  2. Click Add custom connector.
  3. Enter a name (for example Lemu AI) and the server address https://mcp.lemuai.com/mcp, then add it.
  4. Click Connect. Claude opens the Lemu AI consent screen (see below).

On Claude Team and Enterprise plans, only an organization owner can add custom connectors. Ask your owner to add it, then each member connects it.

Claude Code

Run:

Shell
claude mcp add --transport http lemuai https://mcp.lemuai.com/mcp

Then start Claude Code, run /mcp, choose lemuai and authenticate. Your browser opens the Lemu AI consent screen.

Cursor

Add the server to your mcp.json (Cursor Settings → MCP → Add new MCP server, or ~/.cursor/mcp.json):

JSON
{
  "mcpServers": {
    "lemuai": {
      "url": "https://mcp.lemuai.com/mcp"
    }
  }
}

Cursor shows the server as needing login. Click Login to open the Lemu AI consent screen.

Approve the connection#

Your assistant sends you to app.lemuai.com/mcp/authorize. Sign in if asked, then review what the assistant is asking for.

  1. Check who is asking

    The screen shows the name the assistant gave itself and the address you'll be sent back to after approving. The name is chosen by the app, so only approve if you started this connection and recognise that address.

  2. Choose the organization

    If you're an admin in more than one organization, pick the one the assistant should work in.

  3. Choose what it may do

    Tick the permissions to grant, for example "See which voice agents you allow it to use" or "Request phone calls". See Permissions & limits for what each one allows.

  4. Choose agents and a daily cap

    If you allow calls, pick which agents it may use and the most calls per day (up to 200). Agents you create later are not included automatically.

  5. Approve

    Click Approve. You're sent back to the assistant and it can use Lemu AI right away.

Click Cancel instead to refuse the connection.

After you connect#

  • Ask the assistant something like "Which Lemu AI agents can you use?" to check the connection.
  • The assistant renews its access automatically: access tokens last 1 hour and refresh on their own. A connection stays valid for up to 90 days, after which you approve it again.
  • Calls the assistant requests wait for a person in your organization to confirm them. See Call confirmation.

Disconnect#

Remove Lemu AI from the assistant's connector or MCP settings. Assistants that support it revoke their access when you do.

Viewing and revoking connections from the Lemu AI dashboard isn't available yet. To cut off a connection immediately, contact support.

MCP Tools

Every tool the Lemu AI MCP server offers, the permission it needs and the arguments it takes

https://docs.lemuai.com/mcp/tools

Your assistant discovers these tools automatically when it connects, so you don't call them yourself. This page explains what each one does so you know what to ask for and what to approve.

A tool only works if the connection was granted its permission on the consent screen. See Permissions & limits.

ToolPermissionWhat it does
list_agentsagents:readLists the agents this connection may use
get_agentagents:readDescribes one agent and the details a call needs
start_callcalls:startRequests an outbound call with an agent
get_callcalls:readStatus and outcome of one call
list_callscalls:readRecent calls made through this connection
cancel_callcalls:cancelCancels a call that hasn't been dialed
create_agent_draftagents:writeDrafts a new agent from a brief
update_agent_draftagents:writeChanges a draft it made
test_agentagents:writeReviews a draft before it can go live
archive_agentagents:writeRetires an agent it made
search_docsnoneSearches the LemuAI docs (how-tos, settings, error messages)
read_docnoneReads one docs page as Markdown

Docs#

search_docs and read_doc read the public docs at docs.lemuai.com, so every connection has them, whatever its permissions. An assistant uses them to explain how to do something in LemuAI or what an error means while it works in your workspace.

search_docs#

ArgumentTypeRequiredDescription
querystringYesA question, a feature, or an error message as written, up to 500 characters
limitintegerNoHow many sections to return, 1 to 10. Default 5

Returns the best matching sections, each with its page title, section heading, url (with the section's anchor) and text.

read_doc#

ArgumentTypeRequiredDescription
pagestringYesA page path like segments/overview, or a url from search_docs

Returns the page as Markdown (markdown), its url, and truncated when the page was longer than 40,000 characters.

Agents#

list_agents#

Lists the voice agents this connection may use: the agents you ticked on the consent screen. Takes no arguments. Each agent comes back with its agent_id, name and the context variables a call can fill in.

get_agent#

Describes one agent: its name and the context variables a call accepts.

ArgumentTypeRequiredDescription
agent_idintegerYesThe id from list_agents

Calls#

start_call#

Requests an outbound phone call with an agent. It returns straight away with a call_id. The call then waits for a person in your organization to confirm it (see Call confirmation) before it's dialed. Read the outcome with get_call.

ArgumentTypeRequiredDescription
agent_idintegerYesThe id from list_agents
phone_numberstringYesWho to call, in international format, like +919876543210
counterparty_classstringYesWho this person is to your organization: employee, customer, distributor, supervisor, prospect or other. Your calling policy decides which are allowed
idempotency_keystringYesA unique key for this call, 8 to 120 letters, digits or _ . : -. Retrying with the same key returns the original call and never dials twice
contextobjectNoValues for the agent's context variables (see get_agent), up to 30
callee_timezonestringNoIANA timezone like America/Chicago. Only needed for countries that span several timezones
correlationobjectNoYour own ids (for example a ticket number), kept in the audit log next to the call

Result webhooks (callback_url) are not available for assistant connections. Assistants read results with get_call.

The call is checked against the connection's limits and your organization's calling policy before it's accepted. If something is wrong, the tool returns an error code such as OUTSIDE_CALLING_HOURS. See Error codes.

get_call#

Gets the status and outcome of a call made through this connection.

ArgumentTypeRequiredDescription
call_idstringYesThe id returned by start_call

It returns:

FieldDescription
call_id, agent_idWhich call and agent
statusSee the statuses below
calleeThe number called, partly masked
created_at, finished_atWhen the call was requested and when it ended
outcomeHow the call ended, once it's over
duration_sCall length in seconds
Captured detailsAny information the agent was set up to collect during the call
transcript_urlA link to the transcript, only if the connection has calls:transcripts:read

Call statuses:

StatusMeaning
pending_confirmationWaiting for a person in your organization to confirm it
initiatingConfirmed and being dialed
in_progressThe call is live
completedThe call finished
failedThe call could not be placed or did not connect
cancelledCancelled before it was dialed
rejectedA person in your organization declined it

list_calls#

Lists recent calls made through this connection.

ArgumentTypeRequiredDescription
statusstringNoOnly calls with this status
limitintegerNoHow many to return, 1 to 100 (default 20)

cancel_call#

Cancels a call that hasn't been dialed yet, for example one still waiting for confirmation. A call that is already ringing or live can't be cancelled this way.

ArgumentTypeRequiredDescription
call_idstringYesThe call to cancel

Drafting agents#

With the agents:write permission, an assistant can write a new voice agent from a short brief. Lemu AI writes the agent's script from the brief and adds fixed safeguards the brief can't remove. A connection can create at most 5 agents a day.

Agents made over MCP are drafts. They can't place calls until they're published, and publishing isn't available to assistant connections. To publish a draft an assistant made, contact support.

create_agent_draft#

ArgumentTypeRequiredDescription
briefobjectYesWhat the agent is for (see below). Not a prompt
idempotency_keystringYesA unique key for this request. Reusing it returns the agent it already created

Brief fields:

FieldRequiredDescription
objectiveYesWhat the call should achieve (10 to 500 characters)
counterparty_classYesWho the agent will call: employee, customer, distributor, supervisor, prospect or other
languageYesprimary language as a tag like hi-IN or en-US, plus up to 5 more it also_understands
personaYesThe agent's name and who it calls on_behalf_of
captureNoUp to 20 details to collect, each with a name, type (string, number, boolean or date), whether it's required and an optional prompt
authorityNoWhat the agent may and may_not agree to on the call (up to 10 each)
off_limits_topicsNoTopics the agent must not discuss (up to 20)
escalationNoWhen to end the call politely and flag it, for example when the person asks for a human
limitsNomax_duration_s (30 to 900, default 300) and max_attempts_per_callee_per_day (1 to 5, default 2)
context_schemaNoUp to 20 context variables a call can pass in, each with a sensitivity class (public, internal or confidential) and a description
expires_in_daysNoHow long the draft lives before it expires (1 to 90, default 7)

update_agent_draft#

Changes a draft this connection made. Send the draft_version you last read. If the draft has changed since, the update is refused with STALE_DRAFT so nothing is overwritten.

ArgumentTypeRequiredDescription
agent_idintegerYesThe draft to change
base_versionintegerYesThe draft_version you read
briefobjectYesThe full updated brief

test_agent#

Reviews the draft as it will run: safeguards present, nothing forbidden, only declared context used. A draft needs a passed review of its exact version before it can be published.

ArgumentTypeRequiredDescription
agent_idintegerYesThe draft to review

archive_agent#

Retires an agent this connection made. Calls already in progress finish normally.

ArgumentTypeRequiredDescription
agent_idintegerYesThe agent to archive

Permissions & Limits

What each MCP permission allows, how calls are confirmed, the calling policy and the error codes assistants can get

https://docs.lemuai.com/mcp/permissions

Every assistant connection is limited to what an admin approved on the consent screen, and Lemu AI enforces those limits on every request, whatever the assistant sends.

Permissions#

These are the permissions (OAuth scopes) an assistant can ask for. The consent screen lists the ones it asked for, and you can untick any of them before approving. An assistant that doesn't ask for specific permissions gets agents:read and calls:read.

ScopeOn the consent screenAllows
agents:readSee which voice agents you allow it to uselist_agents, get_agent
calls:readRead the status and outcome of calls it placesget_call, list_calls
calls:transcripts:readRead call transcripts (may contain personal data)A transcript link in get_call
calls:startRequest phone calls (a person in your organization confirms each one)start_call
calls:cancelCancel calls that have not been dialed yetcancel_call
agents:writeCreate and edit draft voice agents (it cannot publish them)create_agent_draft, update_agent_draft, test_agent, archive_agent

An assistant can only see and read the calls it placed itself, never other calls in your organization.

Call confirmation#

Every call an assistant requests is created with the status pending_confirmation. Nothing is dialed until a person in your organization confirms it. If they decline, the call becomes rejected. When a call is confirmed, the calling policy and limits are checked again, since time may have passed since the request.

Confirming or declining assistant calls from the Lemu AI dashboard isn't available yet. Until it is, calls requested by an assistant stay in pending_confirmation. Contact support if you need to confirm calls now. The assistant can cancel its own pending calls with cancel_call.

Connection limits#

LimitDefaultNotes
Agents it may useChosen on the consent screenAgents created later are not added
Calls per dayChosen on the consent screenAt most 200
Calls in progress at once3
Calls waiting for confirmation20
Agents it may create per day5Only with agents:write
Connection lifetime90 daysAfter that, approve the connection again

Calling policy#

Your organization's calling policy applies to every call an assistant requests:

  • Who may be called. Each call says who the person is: employee, customer, distributor, supervisor, prospect or other. Only classes the policy allows can be called. By default, a prospect can be called at most twice in total (one call and one follow-up).
  • Calling hours. Calls are only placed inside the allowed hours in the callee's local time. Lemu AI works out the timezone from the phone number. For countries that span several timezones (like the US), the assistant must pass callee_timezone.
  • Do not call. People who asked not to be called, are on your do-not-call list, or opted out of calls (or of everything) on their contact in Lemu AI are never called.
  • AI disclosure. The agent must tell the person they're talking to an AI. Its opening greeting needs to include the {{ai_disclosure}} variable, which Lemu AI replaces with your organization's wording.

Until your organization sets its own policy, a default applies: only employees and supervisors can be called, between 09:00 and 20:00 local time, every day, with the AI disclosure on.

Changing the calling policy or the do-not-call list from the dashboard isn't available yet. Contact support to change them.

Error codes#

When a tool can't do what was asked, it returns an error with a code and a short message. The common ones:

CodeMeaning
SCOPE_MISSINGThe connection wasn't granted the permission this tool needs
INVALID_ARGUMENTSAn argument is missing or has the wrong format
AGENT_NOT_FOUNDThe agent doesn't exist or isn't active
AGENT_NOT_ALLOWEDThe connection may not use this agent
INVALID_PHONEThe phone number isn't valid. Use international format like +919876543210
COUNTRY_NOT_ALLOWEDCalls to this country aren't allowed for this connection
CLASS_NOT_PERMITTEDYour calling policy doesn't allow calls to this class of person
OUTSIDE_CALLING_HOURSIt's outside the allowed hours in the callee's timezone. The error says when the next window opens
TIMEZONE_REQUIREDThe country spans several timezones, so callee_timezone is needed
TIMEZONE_INVALIDcallee_timezone isn't a known timezone name
NUMBER_OPTED_OUTThe person asked not to be called, is on the do-not-call list, or opted out of calls in Lemu AI
CALL_LIMIT_FOR_PERSONThis person has already been called the maximum number of times
DISCLOSURE_MISSINGThe agent's opening greeting doesn't include {{ai_disclosure}}
DAILY_CALL_LIMITThe connection reached its calls-per-day limit
CONCURRENCY_LIMITThe connection already has the maximum calls in progress
PENDING_LIMITToo many calls are waiting for confirmation
DAILY_MINUTES_LIMITThe connection used its daily call minutes
QUOTA_EXCEEDEDYour organization has no call minutes left on its plan
TELEPHONY_NOT_CONFIGUREDTelephony isn't set up for your organization
DIAL_FAILEDThe telephony provider couldn't start the call
CALL_NOT_FOUNDNo such call, or it wasn't made through this connection
CANNOT_CANCELThe call has already been dialed, so it can't be cancelled
INVALID_BRIEFThe agent brief isn't valid. The error lists the problems
STALE_DRAFTThe draft changed since you read it. Read it again and retry
AGENT_QUOTAThe connection already created its 5 agents for today
REVIEW_FAILEDThe draft review found problems to fix
AGENT_EXPIRED / AGENT_ARCHIVEDThe draft expired or was archived
TOKEN_INVALIDThe connection was revoked or expired. Reconnect the assistant

Audit log#

Every request an assistant makes is recorded: which connection, which tool, the outcome, the call it touched and how long it took. Arguments are stored as a fingerprint, not in full, and phone numbers are masked. If you need a copy of the log for a connection, contact support.

Standard and conversion events

The event names Lemu recognises, the fields an order needs (value, currency and order_id), and how revenue and ROI are calculated

https://docs.lemuai.com/website-pixel/standard-events

Lemu uses Meta Pixel's standard events exactly as Meta defines them: the same names and the same parameters. If your site or app already sends events to Meta, you can send the same calls to Lemu unchanged. The same names work everywhere: the website snippet, the app SDKs, the Send an Event API and Shopify.

Only conversion events have required fields. By default that is Purchase, because journey and campaign revenue and ROI are calculated from it. Every other event is free-form.

Meta's standard events#

EventMeaningParameters Meta lists
PageViewA page loaded. The website snippet sends it for you
ViewContentA product or other key page was viewedcontent_ids, content_category, content_name, content_type, contents, currency, value
SearchA searchsearch_string, content_category, content_ids, contents, currency, value
AddToCartAn item was added to the cartcontent_ids, content_name, content_type, contents, currency, value
AddToWishlistAn item was added to a wishlistcontent_ids, content_name, content_category, contents, currency, value
InitiateCheckoutCheckout startedcontent_ids, content_category, contents, currency, num_items, value
AddPaymentInfoPayment details were enteredcontent_ids, content_category, contents, currency, value
PurchaseAn order was placedvalue and currency (required by Meta), content_ids, content_name, content_type, contents, num_items, plus order_id for Lemu
LeadA lead was submittedcontent_category, content_name, currency, value
CompleteRegistrationA sign-up was completedcontent_name, currency, status, value
SubscribeA paid subscription startedcurrency, predicted_ltv, value
StartTrialA free trial startedcurrency, predicted_ltv, value
ScheduleAn appointment was booked
SubmitApplicationAn application was submitted
ContactSomeone contacted your business
CustomizeProductA product was customised
DonateA donation
FindLocationSomeone searched for a store location

What the parameters mean:

ParameterTypeMeaning
valuenumberAn amount in major units: 1499.5 is ₹1,499.50
currencystringAn ISO 4217 code such as INR
content_idslist of stringsProduct ids or SKUs
contentslist of objectsItems, each with id and quantity, and optionally item_price, title, brand and category
content_typestringproduct or product_group
content_name, content_categorystringA name and a category
num_itemsintegerThe number of items
search_stringstringWhat was searched for
predicted_ltvnumberThe expected lifetime value of a subscriber
statusstringThe status of a registration

You can add your own parameters next to these, for example payment_method: "cod" or coupon. For Meta's full definitions, see Meta's standard events reference.

What value means on each event#

value follows Meta's definition, which is different on each step of the funnel:

  • On AddToCart, it is the value of what was added, not the cart total.
  • On InitiateCheckout, it is the checkout (cart) total. Use this event's value for abandoned-cart conditions on cart value.
  • On Purchase, it is the order total.

If you want a running cart total on AddToCart, send it as your own parameter, for example cart_total.

Matching names#

Matching a Meta name ignores case and separators. purchase, PURCHASE and Purchase are all stored as Purchase, and add_to_cart, Add To Cart and AddToCart are all stored as AddToCart.

A name that doesn't match one of Meta's events is a custom event. Custom events are allowed everywhere and are never renamed, rejected or reshaped. Personal data is still removed from their properties.

App events#

The app SDKs also send these events for you. They have no Meta equivalent and are never conversions:

EventWhen
app_installedThe first launch with the SDK
app_updatedThe first launch after the app version changed
app_openedThe app is launched or comes back to the foreground
app_backgroundedThe app goes to the background
deep_link_openedA link opens the app
screen_viewedA screen is shown, when you track screens

See the event reference.

Meta and Lemu side by side#

JavaScript
// Already on your site for Meta:
fbq("track", "Purchase", { value: 1499.5, currency: "INR", content_ids: ["SKU1"], content_type: "product" });
 
// The same call for Lemu, plus order_id:
lemu("track", "Purchase", { value: 1499.5, currency: "INR", content_ids: ["SKU1"], content_type: "product", order_id: "1042" });

For purchases you can also use lemu("purchase", { value, currency, order_id }), which sends the event straight away.

Why Lemu adds order_id#

Lemu counts one conversion per order. The same order is often reported more than once: by your website, by your app, by Shopify (from both the storefront and the store's order webhook), by your server, or by a reload of the thank-you page. With order_id, all of these count as one order, so revenue isn't counted twice. Without it, every Purchase event counts as its own order.

Meta's Conversions API has the same field, so your order id fits both. Use the same order id your store and backend use.

Conversion events#

A conversion event is an event that counts as an order for revenue and ROI. The list is set under Settings → Sending Limits → Conversion events. The default is Purchase. You can add others, such as Lead, Subscribe, Schedule, or one of your own custom events. See Sending Limits.

Every conversion event needs three fields:

FieldWhat it should be
valueA number, 0 or more, in major units
currencyAn ISO 4217 code such as INR
order_idYour id for the order, as text

When a field is missing#

A conversion event is never rejected for a missing or wrong field. A missing field never drops an order. Instead Lemu does the following, and counts it:

ProblemWhat Lemu does
value is text, such as "1,499.00"Converts it to a number
value is missing, but an older field such as total_price or total has the amountUses that field
value is missing, isn't a number, or is negativeCounts the order with no revenue
currency is missing or isn't an ISO codeUses your workspace currency
order_id is missing, but an older field such as order_number has itUses that field
order_id is missingCounts the order, but the same order sent twice counts twice

You can see these counts in two places:

  • Settings → Sending Limits, under Conversion events: how many conversion events arrived in the last 30 days, and how many had each problem.
  • The Recent events debugger on each tracking source: each conversion event, marked Conversion, with what was missing or fixed.

Events that aren't conversion events go through none of these checks.

How ROI is calculated#

An order is credited to the last journey or campaign message the contact got, if that message came within the channel's attribution window. See Sending Limits.

  • Revenue is the total value of the credited orders, per currency.
  • Message spend is what the messages cost in money: WhatsApp charges from your WhatsApp wallet. Email (paid in credits) and calls (paid in plan minutes) are not priced, so they don't add to spend.
  • ROI is revenue divided by message spend. 3.5x means 3.5 back for each 1 spent. When there was no message spend in the period, ROI shows –.

A few details:

  • Orders that arrived without a value count as orders but add nothing to revenue. Reports say how many there were, so a low ROI caused by missing data isn't mistaken for a poor journey.
  • ROI uses revenue in the same currency as the spend. Revenue in other currencies is shown but left out of the ratio.

ROI is shown on each journey's report, on marketing campaigns and on the Copilot home in the AI Copilot.

Old names that still match#

Before standard events, Lemu's website pixel and Shopify connection used their own names. These old names still match their Meta event everywhere you name an event: journey triggers, exit events, Wait for reaction, segments, the Event Log filter and Conversion events. A journey on Purchase also starts for an event sent as order_placed, and the other way round.

Old nameMatches
order_placed, checkout_completedPurchase
cart_added, checkout_startedInitiateCheckout
added_to_cartAddToCart
viewed_productViewContent
page_viewedPageView
searchedSearch
checkout_payment_submittedAddPaymentInfo

cart_added matches InitiateCheckout, not AddToCart, because it was always sent when a shopper started checkout.

Saved journeys, segments and the Conversion events setting that used these old names were renamed to the Meta names for you. Events you sent before keep the name they were stored with, and still match. Your own custom event names were not changed.

Send purchases from your server too#

A purchase sent from a browser or an app can be lost: the app is closed right after payment, or an ad blocker stops the script. For the most reliable revenue and ROI, also send Purchase from your backend with the Send an Event API:

cURL
curl -X POST https://app.lemuai.com/api/v1/events \
  -H "X-API-Key: lemu_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "event_type": "Purchase",
    "phone": "+919876543210",
    "data": { "value": 1499.5, "currency": "INR", "order_id": "1042" }
  }'

Keep sending it from your site or app as well. With the same order_id, both count as one order. Shopify stores already send orders from the store's order webhook (see Shopify).

SDKs

Send events, purchases and known users to Lemu from your website, JavaScript and React apps, and your Android, iOS, Flutter and React Native apps

https://docs.lemuai.com/sdks/overview

Setup required: the SDK packages (@lemuai/analytics, @lemuai/react, @lemuai/react-native, com.lemuai:analytics, LemuAnalytics and lemu_analytics) are rolling out. If a package isn't available yet, contact LemuAI support for access. The website snippet needs no package.

The Lemu SDKs send what people do on your website and in your apps to Lemu: page and screen views, Meta's standard events such as AddToCart and Purchase, and identify for people you know. Lemu uses these events for contact activity and segments, to start journeys, and to calculate the revenue and ROI of your journeys and campaigns.

Pick your SDK#

PlatformPackageSource kindGuide
Any websiteThe snippet from your sourceWebsiteWebsite and JavaScript
JavaScript with a bundlernpm @lemuai/analyticsWebsiteWebsite and JavaScript
React and Next.jsnpm @lemuai/reactWebsiteReact and Next.js
React Native and Exponpm @lemuai/react-nativeAppReact Native and Expo
Android (Kotlin, Java)Maven Central com.lemuai:analyticsAppAndroid
iOS and tvOS (Swift, Objective-C)Swift Package Manager or CocoaPods LemuAnalyticsAppiOS
Flutter (Android, iOS, web, desktop)pub.dev lemu_analyticsAppFlutter

Get a write key#

Every SDK needs the write key of a tracking source.

  1. Add a source

    In Lemu, open Settings → Tracking Sources. Under Add a tracking source, choose Website for a website or a JavaScript, React or Next.js app. Choose App for an Android, iOS, Flutter or React Native app.

  2. Name it

    Give it a Name, for example "Main store" or "Android and iOS app". You can list the Allowed sites or Allowed apps now or later. Then click Create.

  3. Copy the write key

    On the new source, under Set up, copy the write key. It starts with lpk_.

Under Set up, the source also shows install and setup code for each platform with your key filled in: Any website and React / Next.js on a website source, and Android, iOS, Flutter and React Native on an app source.

The write key is public by design and safe to ship in your site or app: it can only send events, never read anything. One app source can serve the same app on every platform, for example your Android and iOS builds. Create a separate source for each environment, such as staging, so test events stay apart.

What every SDK does#

Every SDK has the same calls. Each guide shows them in that platform's language.

CallWhat it does
track(event, properties)Sends any event. Use Meta's standard name, such as AddToCart, when one fits
purchase(...)Sends a Purchase with value, currency and your order id, straight away
identify(userId, traits)Ties the visitor or install to your own user id and sends their contact details
reset()Call on logout: starts a new anonymous id and clears the user id
page() or screen(name)A page view on a website, a screen view in an app
setConsent(granted)Starts or stops sending when the SDK waits for consent
optOut() and optIn()Turns all tracking off or back on, remembered on the device
flush()Sends queued events now

Every SDK has constants for the standard event names (LemuEvent), so the names can't be misspelled. See the event reference.

Purchases, revenue and ROI#

Send every order with purchase, with three fields:

  • value: the order total, in major units (1499.5 is ₹1,499.50).
  • currency: an ISO 4217 code such as INR.
  • the order id (order_id in JavaScript, orderId on Android, iOS and Flutter): the same id your store and backend use.

Lemu counts one conversion per order id, however many times the order is reported: by your app, your website, Shopify or your server. Without it, every report counts as a separate sale. See Conversion events for what Lemu does when a field is missing, and send purchases from your server too for the most reliable numbers.

Known users#

Call identify when someone signs up or logs in, with your own user id and their contact details (email, phone in international format such as +919876543210, first_name, last_name). The user id is sent with every later event until reset.

  • An identify with an email or a phone finds the matching contact, or creates one.
  • An identify with only your user id links to an existing contact with that id. It never creates one.
  • Before identify, a visitor or install is anonymous and isn't a contact. Once they identify, their earlier anonymous activity shows up on the contact.

Contact details belong in identify only. Lemu removes keys such as email, phone and address from event properties.

To let tracked actions from identified people start journeys, switch on Let identified visitors' tracked actions trigger journeys on the source. See Trigger journeys.

If you need consent before tracking, for example under GDPR or the DPDP Act, start the SDK with requireConsent and call setConsent(true) once the person agrees.

  • Until consent, nothing is sent and nothing is stored on the device, not even the anonymous id. Up to 50 events wait in memory and are sent once consent is given.
  • setConsent(false) discards the waiting and queued events. A granted consent is remembered (in the browser, across visits; in an app, across launches) until setConsent(false).
  • optOut() stops all tracking and clears the queue, and is remembered. optIn() turns tracking back on.

How events are sent#

WebsitesApps
WhenEvery second or every 10 events, and when the page is hiddenEvery 30 seconds or every 20 events, when the app goes to the background, and right after a purchase
If sending failsRetried with increasing waits, up to 5 minutes apart, while the page is openKept on the device, also across restarts, and retried with increasing waits, up to 5 minutes apart, for up to 20 hours
QueueUp to 1,000 events, in memoryUp to 1,000 events, for up to 7 days. When it's full, the oldest event that isn't a purchase is dropped first

Each request carries up to 50 events. The same event received twice within 24 hours is recorded once, so retries never double count. See Limits and duplicates.

The SDKs never throw into your code. A bad argument, such as an empty event name, is ignored and logged in debug mode.

Privacy#

The SDKs collect a random anonymous id for each browser or app install, the events and properties your code sends, the user id and traits you pass to identify, and basic app and device details such as the app version, OS version, device model, locale and time zone. They collect no advertising ids (IDFA, GAID) and no hardware ids.

For app store forms, see Google Play data safety and App Store privacy.

Check that events arrive#

  1. Turn on debug mode

    Start the SDK with debug on. It logs every call, request and response.

  2. Send an event

    Open your site or app and do something you track, or call flush() to send straight away.

  3. Look in Lemu

    In Settings → Tracking Sources, the source shows when the last event arrived. Under Recent events, click Show recent events to see the last 50 events from the past hour as Lemu stored them, then Refresh for new ones. See Recent events.

Events also appear in the Event Log.

Next steps#

Website and JavaScript

Add Lemu to any website with the snippet, or to a JavaScript app with the @lemuai/analytics package: page views, events, purchases, known users and consent

https://docs.lemuai.com/sdks/javascript

The same script powers the website snippet and the @lemuai/analytics npm package. It has no dependencies, is about 5.5 KB gzipped, and is safe to import during server-side rendering.

  • Use the snippet on any website, including Shopify themes, WordPress and site builders.
  • Use the package in a JavaScript or TypeScript app built with a bundler.
  • For React and Next.js, use @lemuai/react, which is built on this package.

You need the write key of a Website source. See Get a write key.

Add the snippet#

Copy the snippet from your source (Settings → Tracking Sources, the Any website tab under Set up) and paste it into the <head> of every page. It loads the script, starts it with your key and records a page view:

HTML
<script>
  !function(w,d){w.lemu=w.lemu||function(){(w.lemu.q=w.lemu.q||[]).push(arguments)};
  var s=d.createElement("script");s.async=1;s.src="https://app.lemuai.com/api/v1/pixel/sdk.js";
  d.head.appendChild(s)}(window,document);
  lemu("init", "YOUR_WRITE_KEY");
  lemu("page");
</script>

With the snippet, call every method by name, for example lemu("track", "AddToCart", { value: 999, currency: "INR" }). Calls made before the script has loaded are kept and run once it arrives.

Or install the package#

Shell
npm install @lemuai/analytics
JavaScript
import { lemu, LemuEvent } from "@lemuai/analytics";
 
lemu.init("YOUR_WRITE_KEY");
lemu.page();
 
lemu.track(LemuEvent.AddToCart, {
  value: 999,
  currency: "INR",
  content_ids: ["SKU1"],
  content_type: "product",
});

Calls made before init are kept and run after it. The package sends to https://app.lemuai.com unless you set apiHost.

Send events#

Use Meta's standard event names for standard actions, such as ViewContent, AddToCart and InitiateCheckout. With the package, use the LemuEvent constants. Any other name works as a custom event.

Snippet

JavaScript
lemu("track", "ViewContent", { content_ids: ["SKU1"], content_type: "product", value: 999, currency: "INR" });
lemu("track", "coupon_applied", { code: "DIWALI10" });

Package

JavaScript
lemu.track(LemuEvent.ViewContent, { content_ids: ["SKU1"], content_type: "product", value: 999, currency: "INR" });
lemu.track("coupon_applied", { code: "DIWALI10" });

value is in major units (999 is ₹999) and currency is an ISO 4217 code such as INR. See the event reference for every name and parameter.

Keep contact details such as email, phone and address out of event properties. Lemu removes them. Send them with identify instead.

Purchases#

Send every order with purchase on your thank-you or order confirmation page:

Snippet

JavaScript
lemu("purchase", {
  value: 1499.5,
  currency: "INR",
  order_id: "1042",
  contents: [{ id: "SKU1", quantity: 1, item_price: 1499.5 }],
});

Package

JavaScript
lemu.purchase({
  value: 1499.5,
  currency: "INR",
  order_id: "1042",
  contents: [{ id: "SKU1", quantity: 1, item_price: 1499.5 }],
});

purchase sends a Purchase event at once, without waiting for the next batch, so it isn't lost if the visitor closes the tab.

value, currency and order_id are required. Lemu counts one conversion per order_id, so the same order reported by this page, a reload of the page, Shopify or your server counts once. Lemu never rejects an event for a missing field, but it flags the conversion. See Conversion events.

Identify visitors#

Call identify when the visitor signs up, logs in or fills a form, with your own user id and their contact details:

JavaScript
lemu.identify("crm-123", {
  email: "asha@example.com",
  phone: "+919876543210",
  first_name: "Asha",
});
 
// without your own id
lemu.identify({ email: "asha@example.com" });
 
// on logout
lemu.reset();

With the snippet, the same calls are lemu("identify", "crm-123", { ... }) and lemu("reset").

The user id is kept and sent with every later event until reset, which also gives the visitor a new anonymous id. See Identify visitors for how Lemu matches contacts.

Page views and single-page apps#

page(name?, properties?) records a page view with the page's URL, path, title and referrer. It's stored as PageView.

In a single-page app, start with trackPageChanges to record a page view on every history.pushState and on back and forward navigation:

JavaScript
lemu.init("YOUR_WRITE_KEY", { trackPageChanges: true });

With the snippet, pass options as the third argument: lemu("init", "YOUR_WRITE_KEY", { trackPageChanges: true }).

UTM parameters (utm_source, utm_medium, utm_campaign, utm_term, utm_content) and gclid / fbclid on the landing page are kept with the visitor's events. Personal data in page URLs, such as ?email=, is removed.

If you need consent before tracking, for example after your cookie banner, start with requireConsent:

JavaScript
lemu.init("YOUR_WRITE_KEY", { requireConsent: true });
 
// later, from your consent banner
lemu.setConsent(true); // snippet: lemu("consent", true)
  • Until consent, nothing is sent and nothing is written to cookies or local storage, not even the visitor id. Up to 50 events wait in memory and are sent once consent is given.
  • setConsent(false) discards them. A granted consent is remembered in local storage (_lemu_consent), so returning visitors aren't asked again. setConsent(false) forgets it.
  • optOut() stops all tracking and clears the queue. It is remembered in a cookie and in local storage. optIn() undoes it.

Debug mode#

JavaScript
lemu.init("YOUR_WRITE_KEY", { debug: true });

Every call, request and response is logged to the browser console with a [lemu] prefix. Bad arguments, such as an empty event name or properties that can't be turned into JSON, are logged and ignored. The script never throws into your code.

If the console shows a refused request, check that your site is listed under Allowed sites on the source.

Options#

OptionDefaultWhat it does
apiHosthttps://app.lemuai.comWhere to send events. The snippet sends to the host it was loaded from
debugfalseLogs calls, requests and responses
requireConsentfalseHolds events until setConsent(true)
trackPageChangesfalseRecords a page view on single-page-app navigation
cookieDomainthe current hostShares the visitor id across subdomains, for example .example.com
flushAt10Sends when this many events are queued
flushInterval1000Sends queued events after this many milliseconds
maxQueueSize1000The most events kept while offline

API#

MethodWhat it does
init(writeKey, options?)Starts tracking. Calls made before init are kept and run after it
page(name?, properties?)Records a page view
track(event, properties?)Sends any event
purchase({ value, currency, order_id, ... })Sends a Purchase at once
identify(userId?, traits?)Sets the user id and sends contact details
reset()New anonymous id, user id cleared
flush()Sends queued events now. Returns a promise
setConsent(granted)Starts or stops sending under requireConsent
optOut(), optIn()Stops or resumes all tracking, remembered in the browser
anonymousId()The visitor id, or null before consent or after opt-out
createLemu()A separate client, for sending to a second source from the same page (package only)

How events are sent#

Events are batched and sent every second or every 10 events, and with sendBeacon when the page is hidden, so events from the last page aren't lost. Requests are sent as plain text, so the browser makes no extra CORS request first. Failed requests are retried with increasing waits.

The visitor id lives in the _lemu_aid first-party cookie and in local storage, so returning visitors keep the same id.

React and Next.js

Add Lemu to a React or Next.js app with @lemuai/react: a provider, the useLemu hook and page tracking for React Router and the Next.js routers

https://docs.lemuai.com/sdks/react

@lemuai/react adds Lemu to React and Next.js apps: a provider, a hook to send events from any component, and page tracking for React Router and both Next.js routers. It's built on @lemuai/analytics and is safe with server-side rendering: nothing touches window during render, and calls made on the server do nothing.

You need the write key of a Website source. See Get a write key. The source's React / Next.js tab under Set up shows the code below with your key filled in.

Install#

Shell
npm install @lemuai/react

Set up#

Wrap your app once with LemuProvider:

TSX
import { LemuProvider } from "@lemuai/react";
 
export function App() {
  return (
    <LemuProvider writeKey="YOUR_WRITE_KEY">
      <Routes />
    </LemuProvider>
  );
}

The provider starts tracking after it mounts in the browser. It reads options once, when it mounts. For the options, see Website and JavaScript.

Page views#

usePageTracking(pathname) records a page view whenever the path changes. Use it once, inside the provider.

Next.js app router

Put the provider in a client component:

TSX
// app/lemu.tsx
"use client";
import { usePathname } from "next/navigation";
import { LemuProvider, usePageTracking } from "@lemuai/react";
 
function PageTracker() {
  usePageTracking(usePathname());
  return null;
}
 
export function Lemu({ children }: { children: React.ReactNode }) {
  return (
    <LemuProvider writeKey={process.env.NEXT_PUBLIC_LEMU_WRITE_KEY!}>
      <PageTracker />
      {children}
    </LemuProvider>
  );
}

Then use it in your root layout:

TSX
// app/layout.tsx
import { Lemu } from "./lemu";
 
export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <html lang="en">
      <body>
        <Lemu>{children}</Lemu>
      </body>
    </html>
  );
}

Set NEXT_PUBLIC_LEMU_WRITE_KEY to your write key. It's public, so the NEXT_PUBLIC_ prefix is fine.

Next.js pages router

In pages/_app.tsx:

TSX
import type { AppProps } from "next/app";
import { useRouter } from "next/router";
import { LemuProvider, usePageTracking } from "@lemuai/react";
 
function PageTracker() {
  usePageTracking(useRouter().asPath);
  return null;
}
 
export default function MyApp({ Component, pageProps }: AppProps) {
  return (
    <LemuProvider writeKey={process.env.NEXT_PUBLIC_LEMU_WRITE_KEY!}>
      <PageTracker />
      <Component {...pageProps} />
    </LemuProvider>
  );
}

React Router

TSX
import { useLocation } from "react-router-dom";
import { usePageTracking } from "@lemuai/react";
 
function PageTracker() {
  usePageTracking(useLocation().pathname);
  return null;
}

Render <PageTracker /> inside both your router and LemuProvider.

Send events#

Get the client with useLemu() in any component:

TSX
import { LemuEvent, useLemu } from "@lemuai/react";
 
function AddToCartButton({ product }) {
  const lemu = useLemu();
  return (
    <button
      onClick={() =>
        lemu.track(LemuEvent.AddToCart, {
          value: product.price,
          currency: "INR",
          content_ids: [product.sku],
        })
      }
    >
      Add to cart
    </button>
  );
}

LemuEvent has a constant for each of Meta's standard events. Any other name works as a custom event. See the event reference.

useLemu() also works outside a provider. It returns the shared client, and calls made before the provider starts it are kept and sent once it does.

Purchases#

TSX
const lemu = useLemu();
lemu.purchase({
  value: 1499.5,
  currency: "INR",
  order_id: order.id,
  contents: [{ id: "SKU1", quantity: 1, item_price: 1499.5 }],
});

purchase sends a Purchase event at once. Always pass your real order id: Lemu counts one conversion per order_id, however many sources report the order (this page, a webhook, a reload of the thank-you page). See Conversion events.

Identify users#

TSX
const lemu = useLemu();
 
// after sign-up or login
lemu.identify(user.id, { email: user.email, phone: user.phone, first_name: user.firstName });
 
// on logout
lemu.reset();

The user id is kept and sent with every later event until reset. Send phone numbers in international format, for example +919876543210. Contact details belong in identify only.

To wait for consent, pass requireConsent to the provider and call setConsent(true) from your consent banner:

TSX
<LemuProvider writeKey="YOUR_WRITE_KEY" options={{ requireConsent: true }}>
  <App />
</LemuProvider>
 
// in your consent banner
const lemu = useLemu();
lemu.setConsent(true);

Nothing is sent or stored until then. lemu.optOut() and lemu.optIn() turn tracking off and on, remembered in the browser. See Consent and opt-out for the details.

Debug mode#

TSX
<LemuProvider writeKey="YOUR_WRITE_KEY" options={{ debug: true }}>

Every call, request and response is logged to the browser console with a [lemu] prefix.

API#

ExportWhat it is
LemuProviderProps: writeKey, options (see options), and an optional client from createLemu(). Starts tracking after mount
useLemu()The client: track, page, purchase, identify, reset, flush, setConsent, optOut, optIn, anonymousId
usePageTracking(pathname, properties?)Records a page view on every path change
LemuEventStandard event names. See the event reference
createLemu()A separate client, for sending to a second source

React Native and Expo

Add Lemu to a React Native or Expo app with @lemuai/react-native: events, purchases, known users, screens, app installs and opens, and deep links

https://docs.lemuai.com/sdks/react-native

@lemuai/react-native sends events, purchases, known users and screens from your React Native or Expo app, and records installs, app opens and the deep links that bring people in. It's pure JavaScript with no native module of its own, so it works in Expo Go and in bare React Native apps.

You need the write key of an App source. See Get a write key.

Install#

React Native

Shell
npm install @lemuai/react-native @react-native-async-storage/async-storage
# optional, for the app version, bundle id and device model:
npm install react-native-device-info

Expo

Shell
npx expo install @lemuai/react-native @react-native-async-storage/async-storage

react-native-device-info needs a development build in Expo. Without it, pass the app details yourself (see below).

Set up#

Call init once, as early as possible, for example in index.js or your root component:

TSX
import { lemu } from "@lemuai/react-native";
 
lemu.init("lpk_...");

Calls made before storage has loaded are kept and sent in order.

Without react-native-device-info, for example in Expo Go, pass the app version, build and id yourself:

TSX
import * as Application from "expo-application";
import { lemu } from "@lemuai/react-native";
 
lemu.init("lpk_...", {
  appVersion: Application.nativeApplicationVersion ?? undefined,
  appBuild: Application.nativeBuildVersion ?? undefined,
  appNamespace: "com.brand.app",
});

If the source lists Allowed apps, Lemu refuses events that don't carry an allowed app id. The SDK reads the id from react-native-device-info. Without that package, set appNamespace to your bundle id or package name, or leave Allowed apps empty.

Send events#

TSX
import { lemu, LemuEvent } from "@lemuai/react-native";
 
lemu.track(LemuEvent.AddToCart, { value: 999, currency: "INR", content_ids: ["SKU1"] });
lemu.track("coupon_applied", { code: "DIWALI10" });

LemuEvent has a constant for each of Meta's standard events and for the app events. Any other name works as a custom event. See the event reference.

Keep contact details out of event properties. Lemu removes them. Send them with identify instead.

Purchases#

TSX
lemu.purchase({
  value: 1499.5,
  currency: "INR",
  order_id: "1042",
  contents: [{ id: "SKU1", quantity: 1, item_price: 1499.5 }],
});

purchase sends a Purchase event and sends the queue right away. Always pass the order id your backend uses: the same order is often reported by the app, your backend and your payment provider, and Lemu counts one conversion per order_id. See Conversion events.

Identify users#

TSX
// after sign-up or login
lemu.identify("crm-123", { email: "asha@example.com", phone: "+919876543210", first_name: "Asha" });
 
// on logout
lemu.reset();

The user id is stored and sent with every later event, across restarts, until reset. reset also starts a new anonymous id.

Screens#

Screens aren't tracked automatically. Send one yourself:

TSX
lemu.screen("Checkout", { step: 2 });

Or record every route change in React Navigation:

TSX
import { NavigationContainer, useNavigationContainerRef } from "@react-navigation/native";
import { useLemuNavigationTracking } from "@lemuai/react-native";
 
export function App() {
  const navigationRef = useNavigationContainerRef();
  useLemuNavigationTracking(navigationRef);
  return <NavigationContainer ref={navigationRef}>{/* screens */}</NavigationContainer>;
}

Outside a component, trackNavigationState(navigationRef) does the same and returns a function that stops it. Only the route name is sent, not route params, because params can hold personal data. Screens are stored as screen_viewed.

The SDK sends these for you:

EventWhenProperties
app_installedFirst launchversion, build
app_updatedFirst launch after the version or build changedversion, build, previous_version, previous_build
app_openedEvery launch and every return from the backgroundfrom_background, and url when a link opened the app
app_backgroundedThe app goes to the background. Queued events are sent then too
deep_link_openedA link opens the app or arrives while it runsurl, referrer

UTM parameters (utm_source, utm_medium, utm_campaign, utm_term, utm_content) and gclid / fbclid in a deep link are kept with that event and every later event in the session, so Lemu can credit what happens next, such as a purchase, to the campaign.

Turn these off with trackLifecycle: false and trackDeepLinks: false.

TSX
lemu.init("lpk_...", { requireConsent: true });
 
// once the user agrees
lemu.setConsent(true);
  • Until consent, nothing is sent and nothing is written to storage, not even the anonymous id. Up to 50 events wait in memory and are sent on consent.
  • setConsent(false) discards them. A granted consent is remembered across launches, and setConsent(false) forgets it.
  • lemu.optOut() stops all tracking and is remembered across launches. lemu.optIn() resumes.

Debug mode#

TSX
lemu.init("lpk_...", { debug: true });

Every call, request and response is logged with a [lemu] prefix. Bad arguments are logged and ignored; the SDK never throws into your app.

Options#

OptionDefaultWhat it does
apiHosthttps://app.lemuai.comWhere to send events
debugfalseLogs calls, requests and responses
requireConsentfalseHolds events until setConsent(true)
trackLifecycletrueapp_installed, app_updated, app_opened, app_backgrounded
trackDeepLinkstruedeep_link_opened and campaign parameters from links
flushAt20Sends when this many events are queued
flushInterval30000Sends queued events after this many milliseconds
maxQueueSize1000The most events kept on the device
appVersion, appBuildfrom react-native-device-infoSet them when that package isn't installed
appName, appNamespacefrom react-native-device-infoThe app's name, and its bundle id or package name
storageAsyncStorageAny { get, set, remove } storage, for example MMKV
deviceInfofound automaticallyPass react-native-device-info yourself

API#

init(writeKey, options?), track(event, properties?), screen(name, properties?), purchase({ value, currency, order_id, ... }), identify(userId?, traits?), reset(), flush(), setConsent(granted), optOut(), optIn() and anonymousId(), plus useLemuNavigationTracking, trackNavigationState, createLemu() for a separate client, and LemuEvent.

Offline and delivery#

Events are kept in AsyncStorage (or the storage you pass) and survive restarts. They are sent every 30 seconds, every 20 events, when the app goes to the background, and right after a purchase. Failed requests are retried with increasing waits, up to 5 minutes apart. At most 1,000 events are kept; when the queue is full, the oldest event that isn't a purchase is dropped. Events older than 7 days are dropped.

Requests carry a User-Agent such as lemu-react-native/1.0.0 (iOS 17.4; iPhone15,2). No advertising ids or hardware ids are collected. For app store forms, the SDK collects the same data as the native SDKs, so the answers under Google Play data safety and App Privacy answers in App Store Connect apply.

Android

Add Lemu to an Android app in Kotlin or Java: events, purchases, known users, screens, installs, deep links and the Play install referrer

https://docs.lemuai.com/sdks/android

The Android SDK sends events, purchases, known users and screens from your app, and records installs, app opens and the links and Play Store campaigns that bring people in.

  • Kotlin, and works from Java. Android 5.0 (API 21) or later.
  • One small AndroidX dependency (androidx.lifecycle:lifecycle-process). No OkHttp, Retrofit or Gson, so nothing clashes with your app's versions.
  • Events are kept on disk, batched, and retried when the network is back.
  • No advertising id and no hardware ids.

You need the write key of an App source. See Get a write key.

Install#

The SDK is on Maven Central. In your app module's build.gradle.kts:

kotlin
dependencies {
    implementation("com.lemuai:analytics:1.0.0")
 
    // Optional: attribute installs to the Play Store campaign that brought the user.
    implementation("com.android.installreferrer:installreferrer:2.2")
}

Make sure mavenCentral() is in your repositories. It is by default in new projects.

Set up#

Call setup once, in Application.onCreate():

Kotlin

kotlin
class MyApp : Application() {
    override fun onCreate() {
        super.onCreate()
        Lemu.setup(this, "lpk_...", LemuOptions(debug = BuildConfig.DEBUG))
    }
}

Java

Java
Lemu.setup(this, "lpk_...", LemuOptions.builder().debug(BuildConfig.DEBUG).build());

If your app runs code in more than one process, call setup in the main process only.

If the source lists Allowed apps, add your app's package name (its applicationId). Builds with an applicationIdSuffix, such as com.brand.app.debug, send that id, so add it too or use a separate source for testing.

Options#

OptionDefaultWhat it does
apiHosthttps://app.lemuai.comWhere to send events. Change it only if your source's setup steps show another host
debugfalseLogs every call, request and response to Logcat with the tag Lemu
requireConsentfalseSends and stores nothing until setConsent(true)
trackLifecycleEventstrueapp_installed, app_updated, app_opened, app_backgrounded
trackDeepLinkstruedeep_link_opened for links that open an activity, and their campaign parameters
collectInstallReferrertrueReads the Play install referrer on first launch, when the library is in your app
trackActivityScreensfalseSends a screen each time an activity starts
flushAt20Sends when this many events are queued
flushIntervalSeconds30Sends at least this often while events are queued
maxQueueSize1000The most events kept on the device while offline

Send events#

kotlin
Lemu.track(LemuEvent.ADD_TO_CART, mapOf(
    "value" to 999,
    "currency" to "INR",
    "content_ids" to listOf("SKU1"),
    "content_type" to "product",
))
 
Lemu.track("coupon_applied", mapOf("code" to "DIWALI10"))

Any event name works. For Meta's standard events, use the LemuEvent constants (VIEW_CONTENT, ADD_TO_CART, INITIATE_CHECKOUT, PURCHASE and the rest) so the names match exactly. See the event reference.

Keep contact details such as email, phone and address out of event properties. Lemu removes them. Send them with identify instead.

Purchases#

kotlin
Lemu.purchase(
    value = 1499.5,
    currency = "INR",
    orderId = "1042",
    contents = listOf(LemuContent(id = "SKU1", quantity = 1, itemPrice = 1499.5)),
    contentIds = listOf("SKU1"),
    numItems = 1,
    properties = mapOf("payment_method" to "cod"),
)

purchase sends a Purchase event straight away instead of waiting for the next batch. value, currency and orderId are what Lemu calculates journey and campaign revenue and ROI from.

Always pass orderId. The same order is often reported by the app, your website, Shopify or your server. Lemu counts one conversion per order id, so use the same id your backend and store use. Without it, every report counts as a separate sale. The app can be closed right after payment, so for the most reliable numbers send purchases from your server too. With the same order id, both count once.

With debug on, track("Purchase", ...) without value, currency or order_id logs a warning. The event is still sent.

Identify users#

When a user signs in or gives you their details:

kotlin
Lemu.identify("user-829", mapOf(
    "email" to "asha@example.com",
    "phone" to "+919812345678",
    "first_name" to "Asha",
    "last_name" to "Rao",
))

The user id is sent with every later event until reset(). Send phone numbers in international format. On logout:

kotlin
Lemu.reset() // new anonymous id, user id cleared

Lemu.anonymousId returns the random id the SDK created for this install.

Screens#

kotlin
Lemu.screen("Checkout", mapOf("step" to 2))

Screens are stored as screen_viewed and aren't tracked automatically. To send one each time an activity starts, set trackActivityScreens = true, or register the tracker yourself to choose the names:

kotlin
LemuActivityScreenTracker.register(this) { activity -> activity.title?.toString() }

Apps built on one activity with Compose or Fragments should call Lemu.screen() from their navigation.

Links that start an activity (ACTION_VIEW with a URL) are recorded as deep_link_opened with the url and referrer. UTM parameters (utm_source, utm_medium, utm_campaign, utm_term, utm_content) and gclid / fbclid in the link become the campaign for this and later events in the session, so a purchase made after tapping a campaign link is credited to that campaign.

Links delivered to an activity that is already running arrive in onNewIntent, which the SDK can't see. Record those yourself:

kotlin
override fun onNewIntent(intent: Intent) {
    super.onNewIntent(intent)
    setIntent(intent)
    Lemu.trackDeepLink(intent)
}

Install referrer#

With com.android.installreferrer:installreferrer in your app (see Install), the SDK reads the Play install referrer on the first launch. The campaign the user arrived with, for example from a Google Ads or Meta app campaign link to the Play Store, is added to app_installed and the rest of that first session. app_installed waits up to 10 seconds for the referrer. Without the library this is skipped. Set collectInstallReferrer = false to turn it off.

App lifecycle events#

Sent for you unless you set trackLifecycleEvents = false:

EventWhenProperties
app_installedFirst launch with the SDKversion, build
app_updatedFirst launch after the version changesversion, build, previous_version, previous_build
app_openedEvery time the app comes to the foregroundfrom_background, and url when a link opened the app
app_backgroundedThe app goes to the background. Queued events are sent then

If you add the SDK to an app people already have, the first launch after they update counts as app_installed.

If you need consent before tracking, for example under GDPR or the DPDP Act:

kotlin
Lemu.setup(this, "lpk_...", LemuOptions(requireConsent = true))
 
// later, from your consent screen
Lemu.setConsent(true)   // sends what was held and starts tracking
Lemu.setConsent(false)  // discards held and queued events

Until consent, nothing is sent and nothing is written to the device, not even the anonymous id. Up to 50 events wait in memory and are sent once consent is given. A granted consent is remembered across launches; call setConsent(false) if the user withdraws it.

To let users switch tracking off entirely:

kotlin
Lemu.optOut() // stops everything, clears queued events, remembered across launches
Lemu.optIn()  // turns it back on

Debug logging#

kotlin
LemuOptions(debug = true)

Every call, request body and server response is logged to Logcat with the tag Lemu. Use it during development only, because event properties and traits appear in the log. A refused request (an unknown write key, or an app that isn't in Allowed apps) is logged too.

Delivery#

  • Events are sent in batches of up to 50: every 30 seconds, when 20 are queued, when the app goes to the background, and right after a purchase. Lemu.flush() sends now.
  • Events are stored in the app's no-backup files directory, so they survive restarts and aren't copied to other devices by Auto Backup. At most 1,000 are kept; when full, the oldest are dropped first, purchases last. Events older than 7 days are dropped.
  • Failed requests are retried with increasing waits, up to 5 minutes apart, for up to 20 hours. Refused batches are dropped and logged in debug mode.
  • The SDK never throws into your app. A bad argument is logged in debug mode and ignored.

The SDK ships its own ProGuard and R8 rules, so you don't need to add any.

Google Play data safety#

Your answers depend on how you use the SDK. With the SDK alone, this is what it collects and sends to Lemu:

Play data typeCollectedWhenPurpose
Device or other IDsYesAlways: a random anonymous id created by the SDK for this install (not an advertising id or a hardware id)Analytics
App activity: App interactionsYesAlways: lifecycle events, screens and the events you trackAnalytics
App activity: Other actionsIf you track themSearches, sign-ups and other custom eventsAnalytics
Financial info: Purchase historyIf you send purchasesOrder value, currency, order id, itemsAnalytics
Personal info: User IDsIf you call identify with a user idYour own user idAnalytics, App functionality
Personal info: Name, Email address, Phone numberIf you pass them to identifyThe traits you sendAnalytics, and Advertising or marketing if you message users from Lemu

Also sent with every event, and not a Play data type: app name, version, build and package name; device manufacturer, model and type; Android version; screen size and density; locale and time zone; the link that opened the app and its campaign parameters.

Not collected: advertising id (GAID), Android ID, IMEI, serial number, MAC address, location, contacts, photos, files and crash logs.

  • Is data encrypted in transit? Yes, it is sent over HTTPS.
  • Is data shared? Lemu processes it as your service provider. Under Play's definitions, that isn't sharing. If you forward conversions to an ad platform, that is.
  • Is collection optional? Yes, if you use requireConsent or offer optOut().

Java#

Every method is static on Lemu and has Java overloads:

Java
Map<String, Object> props = new HashMap<>();
props.put("value", 999);
props.put("currency", "INR");
Lemu.track(LemuEvent.ADD_TO_CART, props);
Lemu.purchase(1499.5, "INR", "1042");

iOS

Add Lemu to an iOS or tvOS app in Swift or Objective-C: events, purchases, known users, screens, app opens, deep links and App Store privacy answers

https://docs.lemuai.com/sdks/ios

The iOS SDK (LemuAnalytics) sends events, purchases, known users and screens from your iOS or tvOS app, and records app opens and the deep links that bring people in.

  • iOS 13 or later, tvOS 13 or later. Swift and Objective-C.
  • No third-party dependencies.
  • No advertising identifier (IDFA), no IDFV, and no AdSupport or App Tracking Transparency.
  • Events are kept on disk and sent in batches, so nothing is lost offline.

You need the write key of an App source. See Get a write key.

Install#

Swift Package Manager

In Xcode, choose File > Add Package Dependencies... and enter:

Text
https://github.com/LemuAI/lemu-sdks

Choose Up to Next Major Version from 1.0.0 and add the LemuAnalytics library to your app target.

In a Package.swift:

swift
dependencies: [
    .package(url: "https://github.com/LemuAI/lemu-sdks", from: "1.0.0"),
],
targets: [
    .target(name: "MyApp", dependencies: [
        .product(name: "LemuAnalytics", package: "lemu-sdks"),
    ]),
]

CocoaPods

Ruby
pod 'LemuAnalytics', '~> 1.0'

Then run pod install.

Set up#

Call setup once, as early as possible, so the first app open is recorded.

SwiftUI

swift
import LemuAnalytics
import SwiftUI
 
@main
struct BrandApp: App {
    init() {
        Lemu.setup(writeKey: "lpk_...")
    }
 
    var body: some Scene {
        WindowGroup {
            ContentView()
                .onOpenURL { url in Lemu.trackDeepLink(url) }
        }
    }
}

UIKit

swift
import LemuAnalytics
 
func application(_ application: UIApplication,
                 didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    Lemu.setup(writeKey: "lpk_...")
    return true
}

Objective-C

objc
@import LemuAnalytics;
 
LemuOptions *options = [LemuOptions new];
options.debug = YES;
[Lemu setupWithWriteKey:@"lpk_..." options:options];

Every Lemu method can be called from any thread, and none of them throws. A bad argument, such as an empty event name or a value JSON can't hold, is skipped and logged when debug is on.

If the source lists Allowed apps, add your app's bundle identifier, for example com.brand.app. Events from any other bundle id are refused.

Options#

Pass options with Lemu.setup(writeKey: "lpk_...", options: LemuOptions(debug: true)). All are optional:

OptionDefaultWhat it does
apiHosthttps://app.lemuai.comWhere to send events. Change it only if your source's setup steps show another host
debugfalseLogs every call, request and response
requireConsentfalseSends and stores nothing until Lemu.setConsent(true)
flushAt20Sends once this many events are queued
flushInterval30Sends queued events every this many seconds
maxQueueSize1000The most events kept on the device while offline
trackLifecycletrueapp_installed, app_updated, app_opened, app_backgrounded
trackDeepLinkstruedeep_link_opened from Lemu.trackDeepLink(_:)

Send events#

swift
Lemu.track(LemuEvent.addToCart, properties: [
    "value": 999,
    "currency": "INR",
    "content_ids": ["SKU1"],
])
 
Lemu.track("wishlist_shared", properties: ["list_size": 4])

Any event name works. For Meta's standard events, use the LemuEvent constants (viewContent, addToCart, initiateCheckout, purchase and the rest) so the names match exactly. If you already send these events to Meta, the same properties work here. See the event reference.

Keep contact details out of event properties. Lemu removes keys such as email, phone, address and password; send contact details with identify instead.

Purchases#

swift
Lemu.purchase(
    value: 1499.5,
    currency: "INR",
    orderId: "1042",
    contents: [LemuContent(id: "SKU1", quantity: 1, itemPrice: 1499.5, title: "Kurta")],
    properties: ["payment_method": "cod", "coupon": "DIWALI10"]
)

purchase sends a Purchase event straight away instead of waiting for the next batch. content_ids and num_items are filled in from contents when you don't pass them.

Always pass orderId. Lemu counts one conversion per order. The same order is often reported more than once: by the app, your website, a Shopify webhook, or the app again after a retry. With the order id these count as one order, so journey and campaign revenue isn't counted twice. value and currency are needed to show revenue at all. See Conversion events.

Identify users#

When someone signs in or gives you their contact details:

swift
Lemu.identify(userId: "cust_8812", traits: [
    "email": "asha@example.com",
    "phone": "+919876543210",
    "first_name": "Asha",
    "last_name": "Rao",
])

userId is your own id for the customer. It's stored and sent with every later event until reset(). Send phone numbers in international format. On logout:

swift
Lemu.reset() // new anonymous id, user id cleared

Lemu.anonymousId returns the id Lemu uses for this install, for example to pass to your backend so server-side events join up with the app's.

Screens#

SwiftUI

swift
CheckoutView()
    .lemuScreen("Checkout")
 
ProductView(product: product)
    .lemuScreen("Product", properties: ["product_id": product.id])

UIKit

Turn on automatic screen tracking (it's off by default):

swift
Lemu.enableAutomaticScreenTracking()

Each of your view controllers sends a screen when it appears, named after its class without the ViewController suffix (CheckoutViewController becomes Checkout). Navigation, tab bar, split and page controllers, Apple's own controllers, SwiftUI hosting controllers and child controllers embedded in your own are skipped. To rename a screen, or skip one:

swift
extension CheckoutViewController: LemuScreenNameProviding {
    var lemuScreenName: String? { "Checkout" } // return nil to send nothing
}

Anywhere

swift
Lemu.screen("Checkout", properties: ["step": 2])

Screens are stored as screen_viewed.

Pass every URL that opens the app to trackDeepLink. It sends deep_link_opened with the url, and keeps utm_source, utm_medium, utm_campaign, utm_term, utm_content, gclid and fbclid with this and every later event in the session, so a purchase made after tapping a campaign link is credited to that campaign.

swift
// SwiftUI
WindowGroup { ContentView().onOpenURL { Lemu.trackDeepLink($0) } }
 
// UIKit, AppDelegate
func application(_ app: UIApplication, open url: URL,
                 options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
    Lemu.trackDeepLink(url, referrer: options[.sourceApplication] as? String)
    return true
}
 
// UIKit, SceneDelegate
func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
    URLContexts.forEach { Lemu.trackDeepLink($0.url, referrer: $0.options.sourceApplication) }
}
 
// Universal links
func scene(_ scene: UIScene, continue userActivity: NSUserActivity) {
    if let url = userActivity.webpageURL { Lemu.trackDeepLink(url) }
}

For a cold launch from a link with scenes, also pass the URLs in scene(_:willConnectTo:options:) (connectionOptions.urlContexts and connectionOptions.userActivities). The next app_opened carries the link as url.

App lifecycle events#

Sent for you unless you set trackLifecycle: false:

EventWhenProperties
app_installedFirst launch with the SDKversion, build
app_updatedFirst launch after the version or build changedversion, build, previous_version, previous_build
app_openedEvery time the app comes to the foregroundfrom_background, and url when a link opened the app
app_backgroundedThe app goes to the background

If your app had users before you added the SDK, each of them sends app_installed once after updating, because the SDK has no record of an earlier version.

If you must ask before collecting data, start with requireConsent:

swift
Lemu.setup(writeKey: "lpk_...", options: LemuOptions(requireConsent: true))
 
// later, from your consent prompt
Lemu.setConsent(true)   // sends events held since launch, and remembers the answer
Lemu.setConsent(false)  // discards held and queued events

Until consent, nothing is sent and nothing is written to the device, not even the anonymous id. Up to 50 events are held in memory and sent if consent is given. A granted consent is remembered across launches; call setConsent(false) to withdraw it.

To let people turn tracking off in your settings screen:

swift
Lemu.optOut()  // stops everything, clears the queue, remembered across launches
Lemu.optIn()   // turns it back on
Lemu.isOptedOut

Debug logging#

swift
Lemu.setup(writeKey: "lpk_...", options: LemuOptions(debug: true))

Every call, request body and response is logged with os_log under the subsystem com.lemuai.analytics. Watch it in the Xcode console, or in Console.app filtered by that subsystem. Turn debug off in release builds.

Delivery#

  • Events are kept in Application Support/Lemu, excluded from iCloud and device backups, and survive restarts.
  • They are sent every 30 seconds, when 20 are queued, when the app goes to the background, and right after a purchase. Lemu.flush() sends now.
  • Each request carries up to 50 events. Failed requests are retried with increasing waits, up to 5 minutes apart, for up to 20 hours. Events older than 7 days are dropped.
  • The queue holds at most 1,000 events. When it's full, the oldest event that isn't a purchase is dropped first.

App Store privacy#

Privacy manifest#

The SDK ships its own privacy manifest (PrivacyInfo.xcprivacy, in the package and in the CocoaPods resource bundle LemuAnalyticsPrivacy). Xcode adds it to your app's privacy report. It declares:

  • NSPrivacyTracking: false, with no tracking domains.
  • Required reason API: UserDefaults, reason CA92.1. The SDK keeps its anonymous id, user id, opt-out, consent and the last app version in its own UserDefaults suite.
  • Collected data, all linked to the user and none used for tracking:
Data typeWhy it's collectedPurposes
User IDThe anonymous install id, and your userId from identifyAnalytics, Developer's Advertising or Marketing
Email address, phone number, nameOnly if you pass them to identifyAnalytics, Developer's Advertising or Marketing
Product interactionEvents, screens, app opensAnalytics, Developer's Advertising or Marketing
Purchase historypurchase() and other commerce eventsAnalytics, Developer's Advertising or Marketing
Other usage dataLifecycle and custom eventsAnalytics

App Privacy answers in App Store Connect#

Your app's privacy label covers all the data your app collects, including through Lemu. For the data that goes to Lemu:

  • Data used to track you: No. Lemu doesn't use advertising identifiers, doesn't share data with data brokers, and doesn't link your app's data with other companies' data for advertising. See the note below if you forward data to ad networks.
  • Data linked to you, for each type you actually send:
    • Contact Info > Email Address, Phone Number, Name: if you call identify with them.
    • Identifiers > User ID: yes. The SDK always sends an anonymous id, plus your own user id.
    • Purchases > Purchase History: if you call purchase() or send commerce events.
    • Usage Data > Product Interaction: yes (app opens, screens, events).
    • Usage Data > Other Usage Data: if you send custom events.
  • Purposes: Analytics, plus Developer's Advertising or Marketing if you message these customers through Lemu journeys or campaigns. Add App Functionality if your app relies on Lemu data to work.
  • Not collected by the SDK: location, device ids (IDFA or IDFV), diagnostics, contacts, health, financial info, browsing history, and search history unless you send search terms as events (then also declare Search History).

Forwarding to ad networks. If you send Lemu events to an advertising platform, for example through a Meta Conversions API connection, Apple counts that as tracking. Then answer "Data used to track you: Yes" for the shared types, ask permission with App Tracking Transparency first, and only call identify with an email or phone after the user allows it.

Objective-C#

objc
@import LemuAnalytics;
 
[Lemu track:LemuEvent.addToCart properties:@{@"value": @999, @"currency": @"INR"}];
[Lemu identifyWithUserId:@"cust_8812" traits:@{@"email": @"asha@example.com"}];
[Lemu purchaseWithValue:1499.5 currency:@"INR" orderId:@"1042"
               contents:@[[[LemuContent alloc] initWithId:@"SKU1" quantity:1 itemPrice:@1499.5 title:nil]]
             properties:nil];
[Lemu trackDeepLink:url referrer:nil];
[Lemu setConsent:YES];

Flutter

Add Lemu to a Flutter app on Android, iOS, web and desktop with lemu_analytics: events, purchases, known users, screens, app lifecycle and deep links

https://docs.lemuai.com/sdks/flutter

The Flutter SDK (lemu_analytics) sends events, purchases, known users, app lifecycle events, deep links and screens from your Flutter app.

  • Pure Dart, with no platform channels of its own. Works on Android, iOS, web, macOS, Windows and Linux.
  • Events are kept on the device, sent in batches, retried when the network fails, and kept across restarts.
  • Meta's standard event names, so ad platforms receive conversions unchanged.
  • Consent and opt-out built in. No advertising ids and no hardware ids.

Requires Flutter 3.22 or later (Dart 3.4 or later). You need the write key of an App source. See Get a write key.

Install#

Shell
flutter pub add lemu_analytics

Android and iOS need no extra setup. On macOS, apps are sandboxed and need permission to make network requests. Add this to macos/Runner/DebugProfile.entitlements and macos/Runner/Release.entitlements:

XML
<key>com.apple.security.network.client</key>
<true/>

Set up#

Call setup once in main(), before runApp():

dart
import 'package:flutter/widgets.dart';
import 'package:lemu_analytics/lemu_analytics.dart';
 
Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Lemu.instance.setup('lpk_...');
  runApp(const MyApp());
}

The write key is public, so it's safe to ship in the app. Calls made before setup are ignored. No method ever throws: a bad argument is ignored and, with debug: true, logged.

If the source lists Allowed apps, Lemu refuses events from any other app id. On Android the id is your applicationId, and on iOS and macOS your bundle identifier. Web and desktop builds send a different id: if you ship them, turn on debug mode, find namespace under app in a logged request, and add it to the list too.

Options#

dart
await Lemu.instance.setup(
  'lpk_...',
  options: const LemuOptions(
    debug: false,            // log every call, request and response
    requireConsent: false,   // see "Consent and opt-out"
    flushAt: 20,             // send once this many events are queued (web: 10)
    flushInterval: Duration(seconds: 30), // and at least this often (web: 1 second)
    maxQueueSize: 1000,      // events kept on the device while offline (at most 1,000)
    trackLifecycle: true,    // app_installed, app_updated, app_opened, app_backgrounded
    trackDeepLinks: true,    // deep_link_opened from trackDeepLink()
  ),
);

LemuOptions also takes apiHost. Change it only if your source's setup steps show another host.

Send events#

dart
Lemu.instance.track(LemuEvent.addToCart, {
  'value': 999,
  'currency': 'INR',
  'content_ids': ['SKU1'],
});
 
Lemu.instance.track('wishlist_shared', {'list_id': 'summer'});

Any event name works. For Meta's standard events, use the LemuEvent constants (viewContent, addToCart, initiateCheckout, purchase and the rest), spelled exactly as Meta expects. See the event reference.

Don't put email addresses, phone numbers or other contact details in event properties. Lemu removes them; they belong in identify().

Purchases#

dart
Lemu.instance.purchase(
  value: 1499.5,
  currency: 'INR',
  orderId: '1042',
  contents: const [
    LemuContent(id: 'SKU1', quantity: 1, itemPrice: 999, title: 'Kurta'),
    LemuContent(id: 'SKU7', quantity: 1, itemPrice: 500.5),
  ],
  properties: {'coupon': 'DIWALI10'},
);

purchase() sends a Purchase event right away instead of waiting for the next batch. content_ids and num_items are filled in from contents when you don't pass them.

Always pass the order id from your backend. The same order is often reported by more than one source: the app, your website, your server, Shopify. Lemu counts one conversion per order id, so revenue isn't counted twice and journeys don't fire twice. Without it, every report counts. See Conversion events.

Identify users#

When a user signs in or signs up:

dart
Lemu.instance.identify(
  userId: 'cust_8812',            // your own id for this user
  traits: {
    'email': 'asha@example.com',
    'phone': '+919812345678',     // international format
    'first_name': 'Asha',
    'last_name': 'Rao',
  },
);

The userId is kept and sent with every later event, also after the app restarts. On logout:

dart
Lemu.instance.reset(); // new anonymous id, no user id

Lemu.instance.anonymousId is the id Lemu uses for this install before the user is known.

Screens#

Add LemuNavigatorObserver to your navigator to send a screen each time a named page becomes visible:

Navigator

dart
MaterialApp(
  navigatorObservers: [LemuNavigatorObserver()],
  routes: {...},
);

go_router

dart
final router = GoRouter(
  observers: [LemuNavigatorObserver()],
  routes: [
    GoRoute(name: 'product', path: '/product/:id', builder: ...),
  ],
);

go_router names each page after the GoRoute name, or its path pattern (/product/:id) when it has none. Routes inside a ShellRoute need the observer on that ShellRoute too.

Dialogs, bottom sheets and unnamed routes are skipped. To choose names yourself:

dart
LemuNavigatorObserver(
  nameExtractor: (route) => route.settings.name?.replaceAll('/', ' ').trim(),
)

Or send screens yourself:

dart
Lemu.instance.screen('Checkout', {'step': 2});

Screens are stored as screen_viewed.

Pass each link that opens the app to trackDeepLink. It sends deep_link_opened and keeps the link's utm_source, utm_medium, utm_campaign, utm_term, utm_content, gclid and fbclid with every later event in the session, so later events, including the purchase, are credited to the campaign.

app_links

The app_links stream also delivers the link that launched the app:

dart
final appLinks = AppLinks();
appLinks.uriLinkStream.listen((uri) => Lemu.instance.trackDeepLink(uri));

go_router

Track links in the top-level redirect. It also runs for in-app navigation, so only track URLs that carry campaign parameters, once each:

dart
Uri? lastTrackedLink;
 
final router = GoRouter(
  redirect: (context, state) {
    final uri = state.uri;
    final hasCampaign = uri.queryParameters.keys
        .any((k) => k.startsWith('utm_') || k == 'gclid' || k == 'fbclid');
    if (hasCampaign && uri != lastTrackedLink) {
      lastTrackedLink = uri;
      Lemu.instance.trackDeepLink(uri);
    }
    return null;
  },
  routes: [...],
);

trackDeepLink(uri, referrer: 'com.instagram.android') records where the link came from, when you know it.

App lifecycle events#

Unless you set trackLifecycle: false, the SDK sends:

EventWhenProperties
app_installedFirst launchversion, build
app_updatedFirst launch after the version or build changedversion, build, previous_version, previous_build
app_openedLaunch and every return to the foregroundfrom_background
app_backgroundedThe app goes to the background

Queued events are sent when the app goes to the background, with or without lifecycle events. If you add the SDK to an app people already have, each of them sends app_installed once, on their first launch with the SDK.

If you must ask before tracking, for example under GDPR or the DPDP Act, set requireConsent: true. Nothing is sent and nothing is written to the device, not even the anonymous id, until the user agrees. Up to 50 events are held in memory meanwhile.

dart
await Lemu.instance.setup('lpk_...',
    options: const LemuOptions(requireConsent: true));
 
// later, from your consent screen
Lemu.instance.setConsent(true);  // sends the held events; remembered across launches
Lemu.instance.setConsent(false); // discards held and queued events

To stop all tracking for a user who opts out in your settings screen:

dart
Lemu.instance.optOut(); // clears the queue, remembered across launches
Lemu.instance.optIn();  // resumes

Flutter web#

On the web, the SDK reuses the visitor id of the Lemu website snippet (the _lemu_aid cookie and local storage key) when the Flutter app runs on the same site. A visitor who browses your website and then your Flutter web app is one visitor, and a visitor who opted out on the website stays opted out. Events are sent every second or every 10 events.

Debugging#

dart
await Lemu.instance.setup('lpk_...',
    options: const LemuOptions(debug: true));

Every call, request body and response status is printed with a [Lemu] prefix through debugPrint. Lemu.instance.flush() sends the queue immediately, which helps while testing. To see what Lemu stored, open the source in Settings → Tracking Sources and use Recent events.

How sending works#

  • Events are kept on the device (in shared_preferences) and survive restarts. At most 1,000 are kept; when full, the oldest event that isn't a Purchase is dropped. Events older than 7 days are dropped before sending.
  • Each request carries up to 50 events. Apps send every 30 seconds or 20 events, when going to the background, and right after a purchase. The web sends every second or 10 events.
  • Network errors, timeouts and server errors are retried with increasing waits, up to 5 minutes apart. A batch that keeps failing is dropped 20 hours after it was queued. Refused batches are dropped and the reason is logged in debug mode.
  • Every request has the User-Agent lemu-flutter/<version> (<os> <os version>; <model>), except on the web, where the browser sets its own.

Privacy and store forms#

What the SDK collects:

  • A random anonymous id created on first launch and stored in the app's preferences. It isn't derived from the device and is replaced on reset() or reinstall.
  • The events and properties your code sends, plus the userId and traits you pass to identify().
  • App name, version, build and package name; device manufacturer, model and type; OS name and version; screen size and pixel density; locale; time zone; campaign parameters from deep links.

It doesn't collect advertising ids (IDFA, GAID), hardware or vendor ids (Android ID, identifierForVendor), location, contacts, or anything else you don't send.

Your store answers depend on what your app sends and how your Lemu workspace uses it. The Flutter SDK collects the same data as the native SDKs, so the answers under Google Play data safety and App Privacy answers in App Store Connect apply. The Flutter SDK reads no advertising identifier and doesn't need the App Tracking Transparency prompt to work. If your workspace forwards conversions to ad platforms, for example through the Meta Conversions API, both stores count that as tracking or sharing: declare it, and follow Apple's App Tracking Transparency rules for it.

Event reference

Every event name the Lemu SDKs send, its constant on each platform, the standard parameters, and how Lemu stores events, properties and context

https://docs.lemuai.com/sdks/events

This page lists the event names every Lemu SDK knows, the constant for each one on each platform, and what Lemu keeps from each event. For the fields an order needs and how revenue and ROI are calculated, see Standard and conversion events.

How calls are stored#

CallStored as
page()PageView, with the page's url, path and title
screen(name)screen_viewed, with the screen's name in its properties
track(event) and purchase()The event name: Meta's spelling for a standard event, and lowercase with underscores for any other name
identify()Finds or creates the contact (see Known users). Traits go to the contact, never into event properties

Standard events#

These are Meta's standard events, with Meta's names and parameters. Every SDK has a constant for each one.

EventJavaScript, React, React NativeAndroidiOS, FlutterParameters
PageViewLemuEvent.PageViewLemuEvent.PAGE_VIEWLemuEvent.pageViewnone. On websites, page() sends it
ViewContentLemuEvent.ViewContentLemuEvent.VIEW_CONTENTLemuEvent.viewContentcontent_ids, content_category, content_name, content_type, contents, currency, value
SearchLemuEvent.SearchLemuEvent.SEARCHLemuEvent.searchsearch_string, content_category, content_ids, contents, currency, value
AddToCartLemuEvent.AddToCartLemuEvent.ADD_TO_CARTLemuEvent.addToCartcontent_ids, content_name, content_type, contents, currency, value
AddToWishlistLemuEvent.AddToWishlistLemuEvent.ADD_TO_WISHLISTLemuEvent.addToWishlistcontent_ids, content_name, content_category, contents, currency, value
InitiateCheckoutLemuEvent.InitiateCheckoutLemuEvent.INITIATE_CHECKOUTLemuEvent.initiateCheckoutcontent_ids, content_category, contents, currency, num_items, value
AddPaymentInfoLemuEvent.AddPaymentInfoLemuEvent.ADD_PAYMENT_INFOLemuEvent.addPaymentInfocontent_ids, content_category, contents, currency, value
PurchaseLemuEvent.PurchaseLemuEvent.PURCHASELemuEvent.purchasevalue, currency and order_id (required), content_ids, content_name, content_type, contents, num_items. Use purchase()
LeadLemuEvent.LeadLemuEvent.LEADLemuEvent.leadcontent_category, content_name, currency, value
CompleteRegistrationLemuEvent.CompleteRegistrationLemuEvent.COMPLETE_REGISTRATIONLemuEvent.completeRegistrationcontent_name, currency, status, value
SubscribeLemuEvent.SubscribeLemuEvent.SUBSCRIBELemuEvent.subscribecurrency, predicted_ltv, value
StartTrialLemuEvent.StartTrialLemuEvent.START_TRIALLemuEvent.startTrialcurrency, predicted_ltv, value
ScheduleLemuEvent.ScheduleLemuEvent.SCHEDULELemuEvent.schedule
SubmitApplicationLemuEvent.SubmitApplicationLemuEvent.SUBMIT_APPLICATIONLemuEvent.submitApplication
ContactLemuEvent.ContactLemuEvent.CONTACTLemuEvent.contact
CustomizeProductLemuEvent.CustomizeProductLemuEvent.CUSTOMIZE_PRODUCTLemuEvent.customizeProduct
DonateLemuEvent.DonateLemuEvent.DONATELemuEvent.donate
FindLocationLemuEvent.FindLocationLemuEvent.FIND_LOCATIONLemuEvent.findLocation

With the website snippet, use the event name itself, for example lemu("track", "AddToCart", { ... }). Lemu matches a standard name whatever its case or separators, so add_to_cart is stored as AddToCart. See Matching names.

Parameters#

ParameterTypeMeaning
valuenumberAn amount in major units: 1499.5 is ₹1,499.50. On AddToCart, the value of what was added. On InitiateCheckout, the checkout total. On Purchase, the order total
currencystringAn ISO 4217 code such as INR
order_idstringYour id for the order. Lemu counts one conversion per order id, however many sources report it. Meta's Conversions API has the same field
content_idslist of stringsProduct ids or SKUs
contentslist of objectsItems, each with id and quantity, and optionally item_price, title, brand and category
content_typestringproduct or product_group
content_namestringA name
content_categorystringA category
num_itemsintegerThe number of items
search_stringstringWhat was searched for
predicted_ltvnumberThe expected lifetime value of a subscriber
statusstringThe status of a registration

You can add your own properties next to these, for example payment_method or coupon.

The app SDKs take the order id and items as typed arguments to purchase: orderId and LemuContent(id, quantity, itemPrice, title) on Android, iOS and Flutter. They are sent as order_id and contents with item_price.

Conversion events#

A conversion event counts as an order for revenue and ROI. By default that's Purchase; you can add others under Settings → Sending Limits → Conversion events. Every conversion event needs value, currency and order_id.

Lemu never rejects a conversion event for a missing field. It fixes what it can, counts the rest, and shows the problem on the event in Recent events. See When a field is missing.

App lifecycle events#

The app SDKs (Android, iOS, Flutter and React Native) send these for you. They have no Meta equivalent and are never conversions.

EventJavaScript (React Native)AndroidiOS, FlutterWhenProperties
app_installedLemuEvent.AppInstalledLemuEvent.APP_INSTALLEDLemuEvent.appInstalledThe first launch with the SDKversion, build
app_updatedLemuEvent.AppUpdatedLemuEvent.APP_UPDATEDLemuEvent.appUpdatedThe first launch after the version or build changedversion, build, previous_version, previous_build
app_openedLemuEvent.AppOpenedLemuEvent.APP_OPENEDLemuEvent.appOpenedEvery launch and every return to the foregroundfrom_background, and url when a link opened the app (not on Flutter)
app_backgroundedLemuEvent.AppBackgroundedLemuEvent.APP_BACKGROUNDEDLemuEvent.appBackgroundedThe app goes to the background
deep_link_openedLemuEvent.DeepLinkOpenedLemuEvent.DEEP_LINK_OPENEDLemuEvent.deepLinkOpenedA link opens the appurl, referrer
screen_viewedLemuEvent.ScreenViewedLemuEvent.SCREEN_VIEWEDLemuEvent.screenViewedA screen is shown, when you track screensname, plus your properties
  • screen_viewed is never sent automatically. Call screen(name), or turn on your platform's screen tracking.
  • Turn the first four off with trackLifecycleEvents = false on Android, or trackLifecycle: false on iOS, Flutter and React Native. Turn deep links off with trackDeepLinks.
  • If you add the SDK to an app people already have, each of them sends app_installed once, on their first launch with the SDK.

On Android, the install referrer's campaign is added to app_installed. See Install referrer.

Custom events#

Any name that isn't a standard event is a custom event, for example coupon_applied or wishlist_shared. Custom events are never rejected, and they work in journeys, segments and the Event Log like any other event.

Lemu stores a custom name from an SDK in lowercase with underscores, so "Coupon Applied" is stored as coupon_applied. Use that spelling in journeys and segments, or send it that way to begin with.

Properties Lemu removes#

Contact details belong in identify traits only. Lemu removes these keys from event, page and screen properties, at any depth, whatever their case: email, e_mail, phone, phone_number, mobile, mobile_number, whatsapp, password, otp, card, card_number, cvv, pan, aadhaar and address. The same keys are removed from the query string of page URLs and referrers.

Context#

The SDKs add context to every event. Your code never sets it. Lemu keeps:

ContextWhat it holds
platformweb, ios, android, flutter or react_native
libraryThe SDK's name and version
appThe app's name, version, build and namespace (bundle id or package name)
devicemanufacturer, model, and type (phone, tablet, desktop, tv or other)
osThe OS name and version
screenWidth, height and pixel density
locale, timezoneFor example en-IN and Asia/Kolkata
campaignsource, medium, campaign, term and content from UTM parameters, plus gclid and fbclid, from the landing page, the deep link that opened the app, or the Android install referrer
user_agentThe browser's user agent, or the SDK's, such as lemu-android/1.0.0 (Android 14; Pixel 8)
referrerThe page's referrer, on websites

You can see an event's context in Recent events. No advertising ids and no hardware ids are sent or kept.

Overview

Trigger calls, send events, sync contacts and records, send transactional email and WhatsApp templates with the Lemu AI REST API

https://docs.lemuai.com/api-reference/overview

The Lemu AI REST API covers a small, stable set of tasks:

TaskEndpoint
Place an outbound call with a voice agentTrigger an outbound call
Start journeys when something happens in your systemSend an event
Look up your voice agentsList agents
See the calls a voice agent has madeList calls
See your campaignsList campaigns
Keep contacts in sync with your CRMContacts
Record a person's opt-in or opt-out for email, SMS, WhatsApp or voiceContact consent
See everything a person did, or every message and call they gotContact activity and Contact messages
Send orders, subscriptions or bookings to use in journeys and segmentsCustom records
Send an order, shipping or account emailSend a transactional email
Send a WhatsApp template (order update, reminder, login code, offer) to one numberSend a WhatsApp template
See whether a WhatsApp message was delivered and readGet a WhatsApp message
Check which events reached LemuAIList events

Events, contacts and records find the right person by phone number, external_id (your own customer ID) or email, so a contact without a phone number can still be matched. See how the contact is found.

Everything else (building agents and journeys, running campaigns, recordings and transcripts) is done in the Lemu AI dashboard.

Base URL#

All requests go to:

Text
https://app.lemuai.com/api/v1

The version (v1) is part of the path.

Authentication#

Every request needs an API key from your organization in the X-API-Key header. See Authentication.

cURL

cURL
curl https://app.lemuai.com/api/v1/workflow/fetch \
  -H "X-API-Key: lemu_your_api_key"

JavaScript

JavaScript
const res = await fetch("https://app.lemuai.com/api/v1/workflow/fetch", {
  method: "GET",
  headers: {
    "X-API-Key": process.env.LEMU_API_KEY,
  },
});
if (!res.ok) throw new Error(`LemuAI API ${res.status}: ${await res.text()}`);
const data = await res.json();
console.log(data);

Python

Python
import os
 
import requests
 
response = requests.get(
    "https://app.lemuai.com/api/v1/workflow/fetch",
    headers={
        "X-API-Key": os.environ["LEMU_API_KEY"],
    },
    timeout=30,
)
response.raise_for_status()
print(response.json())

Request and response format#

Send request bodies as JSON with the Content-Type: application/json header. Responses are JSON. Errors return a detail field; see Errors.

Getting call results#

The recommended way to receive the outcome of a call (what was said, what the agent captured, how it ended) is to add a Webhook node to your agent. Lemu AI then posts the result to your system when the call finishes, so you don't need to poll.

Connecting an AI assistant such as Claude or Cursor? Use the MCP server instead of this REST API. It lets an assistant list your agents and place calls on your behalf, with permissions you approve.

Quickstart

Make your first LemuAI API calls in five minutes: create a key, add a contact, send an order event and start a call.

https://docs.lemuai.com/api-reference/quickstart

Everything goes to https://app.lemuai.com/api/v1 with your key in the X-API-Key header and JSON bodies. The examples below read the key from the LEMU_API_KEY environment variable.

1. Create an API key#

In the app, open Settings → API Keys and create a key. It starts with lemu_. Store it as a secret on your server; never put it in a website or mobile app (use Tracking Sources write keys there instead).

Shell
export LEMU_API_KEY="lemu_..."

2. Add or update a contact#

cURL

cURL
curl -X POST https://app.lemuai.com/api/v1/contacts/upsert \
  -H "X-API-Key: $LEMU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"phone": "+919876543210", "first_name": "Priya", "email": "priya@example.com", "list_name": "API quickstart"}'

JavaScript

JavaScript
const res = await fetch("https://app.lemuai.com/api/v1/contacts/upsert", {
  method: "POST",
  headers: { "X-API-Key": process.env.LEMU_API_KEY, "Content-Type": "application/json" },
  body: JSON.stringify({ phone: "+919876543210", first_name: "Priya", email: "priya@example.com", list_name: "API quickstart" }),
});
console.log(res.status, await res.json());

Python

Python
import os, requests
 
r = requests.post(
    "https://app.lemuai.com/api/v1/contacts/upsert",
    headers={"X-API-Key": os.environ["LEMU_API_KEY"]},
    json={"phone": "+919876543210", "first_name": "Priya", "email": "priya@example.com", "list_name": "API quickstart"},
    timeout=30,
)
print(r.status_code, r.json())

The contact is matched by phone, so sending the same phone again updates them instead of adding a duplicate. list_name is required (the list is created if new). See Upsert a Contact for every field.

3. Send an order event#

Orders sent as Purchase events count toward revenue and can start journeys.

cURL

cURL
curl -X POST https://app.lemuai.com/api/v1/events \
  -H "X-API-Key: $LEMU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"event_type": "Purchase", "phone": "+919876543210", "data": {"order_id": "A-1001", "value": 1499, "currency": "INR"}}'

JavaScript

JavaScript
await fetch("https://app.lemuai.com/api/v1/events", {
  method: "POST",
  headers: { "X-API-Key": process.env.LEMU_API_KEY, "Content-Type": "application/json" },
  body: JSON.stringify({
    event_type: "Purchase",
    phone: "+919876543210",
    data: { order_id: "A-1001", value: 1499, currency: "INR" },
  }),
});

Python

Python
requests.post(
    "https://app.lemuai.com/api/v1/events",
    headers={"X-API-Key": os.environ["LEMU_API_KEY"]},
    json={"event_type": "Purchase", "phone": "+919876543210",
          "data": {"order_id": "A-1001", "value": 1499, "currency": "INR"}},
    timeout=30,
).raise_for_status()

Check it arrived: Insights → Event Log in the app, or List Events. See Send an Event.

4. Start a call#

In the app, open a voice agent and add an API Trigger step; it shows the agent's trigger URL (with a UUID). Then:

cURL
curl -X POST https://app.lemuai.com/api/v1/public/agent/YOUR_TRIGGER_UUID \
  -H "X-API-Key: $LEMU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"phone_number": "+919876543210", "initial_context": {"first_name": "Priya", "order_id": "A-1001"}}'

The answer includes the run id. Get the result with List Calls, or have the agent push it to you with a Webhook. See Trigger an Outbound Call for the exact URL and fields.

Next#

Authentication

Authenticate Lemu AI API requests with an organization API key

https://docs.lemuai.com/api-reference/authentication

API keys#

Every request is authenticated with an API key that belongs to your organization. Anything you read or create with a key belongs to that organization.

Create a key#

Create keys in the Lemu AI dashboard under Settings → API Keys (see API Keys). The full key is shown only once, when you create it. Store it straight away in a secrets manager or an environment variable. Keys start with lemu_.

You can also archive a key from the same page. An archived key stops working immediately.

Send the key#

Pass the key in the X-API-Key header:

cURL

cURL
curl https://app.lemuai.com/api/v1/workflow/fetch \
  -H "X-API-Key: lemu_your_api_key"

JavaScript

JavaScript
const res = await fetch("https://app.lemuai.com/api/v1/workflow/fetch", {
  method: "GET",
  headers: {
    "X-API-Key": process.env.LEMU_API_KEY,
  },
});
if (!res.ok) throw new Error(`LemuAI API ${res.status}: ${await res.text()}`);
const data = await res.json();
console.log(data);

Python

Python
import os
 
import requests
 
response = requests.get(
    "https://app.lemuai.com/api/v1/workflow/fetch",
    headers={
        "X-API-Key": os.environ["LEMU_API_KEY"],
    },
    timeout=30,
)
response.raise_for_status()
print(response.json())

The Authorization: Bearer lemu_your_api_key header is also accepted, except on Trigger an outbound call, which only reads X-API-Key. Use X-API-Key everywhere to keep things simple.

What a key can do#

An API key acts for your organization, not for a team member, so team roles don't limit it: a key can use every endpoint in this reference. One exception: the contacts endpoints show full phone numbers only if the team member who created the key may view personal data.

An API key can act on your whole organization. Keep it on your server. Never put it in a browser, a mobile app, or a public repository.

Authentication errors#

StatusMeaning
401 UnauthorizedThe key is missing, wrong, or archived
403 ForbiddenThe key is valid, but the resource belongs to another organization
JSON
{
  "detail": "Invalid API key"
}

Conventions

How the LemuAI API pages through results, which limits apply, how to retry safely, and how to avoid counting the same order twice.

https://docs.lemuai.com/api-reference/conventions

Requests and responses#

  • Base URL https://app.lemuai.com/api/v1, HTTPS only.
  • Authenticate with the X-API-Key header (Authentication).
  • Send JSON with Content-Type: application/json; answers are JSON.
  • Times are ISO 8601. Times LemuAI returns are in UTC.
  • Phone numbers are international format with country code: +919876543210.
  • Money is in major units (1499.5 rupees, not paise) with an ISO 4217 currency (INR).

Paging through results#

List endpoints use one of three styles. Each endpoint's page lists its own parameters.

StyleParametersNext pageUsed by
Page numberpage (from 1), limitpage + 1 until page reaches total_pages (or a page comes back short)List Contacts (limit up to 500), List Contact Lists (up to 100), List Contacts in a List (up to 1,000), List Calls
Offsetlimit, offsetoffset + limit until offset reaches totalList Events (limit up to 500)
Cursor (newest first)limit, before / before_idPass next_before / next_before_id from the last answer; stop when it's nullContact Activity, Contact Messages (limit up to 200)

Example, all contacts in pages of 500:

Python
import os, requests
 
page, contacts = 1, []
while True:
    r = requests.get(
        "https://app.lemuai.com/api/v1/contacts",
        headers={"X-API-Key": os.environ["LEMU_API_KEY"]},
        params={"page": page, "limit": 500},
        timeout=30,
    )
    r.raise_for_status()
    body = r.json()
    contacts += body["contacts"]
    if page >= body["total_pages"]:
        break
    page += 1

Sizes and limits#

WhatLimit
Bulk Upsert Contacts5,000 contacts per request
Create or Update Records in Bulk1,000 records per request
One custom record16 KB of data, key up to 255 characters, text values up to 2,000 characters
Event name1 to 100 characters
Segment rules30 per segment; is in lists up to 500 values

The REST API has no fixed per-key request rate today, but be a good citizen: use the bulk endpoints for imports instead of one request per row, and keep to a few requests per second per key. Website and app events sent with a tracking-source write key are rate limited per source and per device, and answer 429 Too many requests when exceeded.

Retries#

  • Retry on network errors, 429, and 5xx, with a growing wait (1 s, 2 s, 4 s… up to about a minute) and a little randomness.
  • Don't retry 400, 401, 403, 404 or 422 without changing the request: they won't succeed as sent. The detail field says why (Errors).

Sending the same thing twice#

RequestSafe to repeat?
Upsert a contact, bulk upsert, create or update a recordYes. They match on phone / key and update; repeating changes nothing
Send an event (Purchase and other conversion events)Orders count once per order_id. Always send order_id, so a retried order isn't counted twice. Each event still starts journeys that listen for it, so avoid resending non-order events
Trigger an outbound callNo. Each request places a call. Retry only when you're sure the first request failed (a network error before any answer, or a 4xx/5xx)
Send a transactional emailNo. Each request sends an email

OpenAPI#

The public endpoints are described in an OpenAPI 3 file: /openapi.json. Import it into Postman or Insomnia, generate a client, or give it to your coding assistant.

Webhooks

Get call results pushed to your system after each call, and start journeys from your system with a signed webhook.

https://docs.lemuai.com/api-reference/webhooks

There are two directions:

DirectionWhatSet up in
LemuAI → youAfter each call, a voice agent sends the result (variables it captured, duration, recording, transcript) to your URLA Webhook step in the voice agent
You → LemuAIYour system starts a journey for someone by posting to the journey's webhook URLA journey with the Webhook trigger

To send events (orders, sign-ups) that start any journey listening for them, use Send an Event instead; it needs your API key and links the event to a contact.

Receive call results#

Add a Webhook step to the voice agent (Voice Agents → Agents, open the agent). Set the HTTP Method, Endpoint URL, optional Auth and Custom Headers, and a Payload Template (JSON) using these variables:

VariableValue
{{workflow_run_id}}The call's run id
{{workflow_id}}, {{workflow_name}}The agent
{{initial_context.<name>}}Values the call started with (from the API, a journey or a campaign)
{{gathered_context.<name>}}Variables the agent extracted
{{cost_info.call_duration_seconds}}Call duration
{{recording_url}}, {{transcript_url}}Recording and transcript links

Example payload template:

JSON
{
  "call_id": "{{workflow_run_id}}",
  "order_id": "{{initial_context.order_id}}",
  "confirmed": "{{gathered_context.confirmed}}",
  "duration": "{{cost_info.call_duration_seconds}}",
  "recording_url": "{{recording_url}}"
}

Your endpoint should answer with a 2xx status quickly. See Webhook (voice agent).

Start a journey with a webhook#

Create a journey with the Webhook trigger. Its panel shows the URL to post to:

Text
POST https://app.lemuai.com/api/v1/workflow-execution/webhooks/{trigger_id}

The JSON body becomes the run's starting context, so later steps can use {{context.<field>}}. Include the person's phone so steps that call or message have someone to reach. No API key is needed: the URL is the secret. For extra safety, set a secret on the trigger and sign each request.

Signing requests#

When the trigger has a secret, every request must carry:

Text
X-Webhook-Signature: sha256=<hex HMAC-SHA256 of the raw request body, keyed with the secret>

Sign the exact bytes you send. Re-serialising the JSON after signing (different spacing or key order) breaks the signature.

cURL

cURL
BODY='{"phone":"+919876543210","order_id":"A-1001","amount":1499}'
SIG=$(printf '%s' "$BODY" | openssl dgst -sha256 -hmac "$WEBHOOK_SECRET" | sed 's/^.* //')
curl -X POST "https://app.lemuai.com/api/v1/workflow-execution/webhooks/123" \
  -H "Content-Type: application/json" \
  -H "X-Webhook-Signature: sha256=$SIG" \
  --data-raw "$BODY"

JavaScript

JavaScript
import crypto from "node:crypto";
 
const body = JSON.stringify({ phone: "+919876543210", order_id: "A-1001", amount: 1499 });
const sig = crypto.createHmac("sha256", process.env.WEBHOOK_SECRET).update(body).digest("hex");
 
const res = await fetch("https://app.lemuai.com/api/v1/workflow-execution/webhooks/123", {
  method: "POST",
  headers: { "Content-Type": "application/json", "X-Webhook-Signature": `sha256=${sig}` },
  body,
});
console.log(res.status, await res.json());

Python

Python
import hashlib, hmac, json, os, requests
 
body = json.dumps({"phone": "+919876543210", "order_id": "A-1001", "amount": 1499}).encode()
sig = hmac.new(os.environ["WEBHOOK_SECRET"].encode(), body, hashlib.sha256).hexdigest()
 
r = requests.post(
    "https://app.lemuai.com/api/v1/workflow-execution/webhooks/123",
    data=body,
    headers={"Content-Type": "application/json", "X-Webhook-Signature": f"sha256={sig}"},
    timeout=30,
)
print(r.status_code, r.json())

Responses#

StatusMeaning
200The run started. The body includes the trigger and run details
401"Invalid webhook signature": missing or wrong X-Webhook-Signature
404"Trigger {id} not found": the trigger was deleted, or the id is wrong
400"Trigger {id} is not active", "Trigger {id} is not a webhook trigger", a request that doesn't match the trigger's settings (method, content type, required headers), or a journey that isn't live

See Journeys troubleshooting for each message.

Errors

HTTP status codes and error formats returned by the Lemu AI API

https://docs.lemuai.com/api-reference/errors

Error format#

Errors return a JSON body with a detail field:

JSON
{
  "detail": "Agent trigger not found"
}

When the request itself is invalid (status 422), detail is a list that points at each field that failed:

JSON
{
  "detail": [
    {
      "loc": ["body", "phone_number"],
      "msg": "Field required",
      "type": "missing"
    }
  ]
}

loc shows where the problem is: body for the JSON body, query for a query parameter, path for a value in the URL.

Some endpoints return detail as an object with a fixed error word your code can check and a message for people, for example Send a WhatsApp Template:

JSON
{
  "detail": {
    "error": "balance_too_low",
    "message": "Your WhatsApp balance is too low. Recharge to keep sending."
  }
}

Status codes#

StatusMeaningCommon causes
400Bad requestTelephony isn't set up for your organization, the carrier rejected the call, or a filter value is malformed
401UnauthorizedMissing, wrong, or archived API key
402Payment requiredYour plan's call minutes or contact limit is used up, or your WhatsApp balance is too low
403ForbiddenThe resource belongs to another organization, or a filter you sent isn't allowed
404Not foundThe id doesn't exist in your organization, or an API Trigger was removed or turned off
409ConflictA contact with the same external_id already exists
422Unprocessable entityThe body or a query parameter failed validation (see the format above)
500Internal server errorSomething went wrong on our side
502Bad gatewayWhatsApp or the email service refused the message. detail holds their reason

Handling errors#

  • Retry 500 responses with exponential backoff. They are usually temporary.
  • Don't retry 4xx responses without changing the request. They describe a problem with the request, the key, or your plan.
  • On 422, read the loc of each entry to find the field to fix.
  • On 401 for a key that used to work, check whether it was archived in Settings → API Keys.

Trigger an Outbound Call

Place an outbound phone call with a voice agent through its API Trigger

https://docs.lemuai.com/api-reference/calls/trigger

Starts an outbound call to one phone number using a voice agent. This is the endpoint to call from your CRM, n8n, Zapier, or your own backend.

The uuid in the path identifies an API Trigger node in your agent, not the agent itself. Add an API Trigger node to the agent in the editor, save it, and copy the endpoint URL shown in the node's settings. The trigger must be active and still present in the agent's workflow.

Your organization's telephony provider must be set up before calls can connect. See Telephony.

POST/api/v1/public/agent/{uuid}

Headers#

NameRequiredDescription
X-API-KeyYesAn API key from the same organization as the agent. This endpoint only accepts the key in this header.
Content-TypeYesapplication/json

Path parameters#

NameTypeRequiredDescription
uuidstringYesThe trigger id of the agent's API Trigger node (the last part of the endpoint URL shown in the node).

Request body#

FieldTypeRequiredDescription
phone_numberstringYesThe number to call, in international format with the country code, for example +919876543210.
initial_contextobjectNoData for this call, such as the customer's name or order id. Each key becomes a template variable the agent can use in its prompts (see below).

Example request:

cURL

cURL
curl -X POST https://app.lemuai.com/api/v1/public/agent/4f1c2b7e-9a3d-4e21-b6a0-2d5f8c9e1a77 \
  -H "X-API-Key: lemu_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "phone_number": "+919876543210",
    "initial_context": {
      "customer_name": "Priya",
      "order_id": "ORD-1042",
      "delivery_date": "28 October"
    }
  }'

JavaScript

JavaScript
const res = await fetch("https://app.lemuai.com/api/v1/public/agent/4f1c2b7e-9a3d-4e21-b6a0-2d5f8c9e1a77", {
  method: "POST",
  headers: {
    "X-API-Key": process.env.LEMU_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "phone_number": "+919876543210",
    "initial_context": {
      "customer_name": "Priya",
      "order_id": "ORD-1042",
      "delivery_date": "28 October"
    }
  }),
});
if (!res.ok) throw new Error(`LemuAI API ${res.status}: ${await res.text()}`);
const data = await res.json();
console.log(data);

Python

Python
import os
 
import requests
 
response = requests.post(
    "https://app.lemuai.com/api/v1/public/agent/4f1c2b7e-9a3d-4e21-b6a0-2d5f8c9e1a77",
    headers={
        "X-API-Key": os.environ["LEMU_API_KEY"],
    },
    json={
        "phone_number": "+919876543210",
        "initial_context": {
            "customer_name": "Priya",
            "order_id": "ORD-1042",
            "delivery_date": "28 October",
        },
    },
    timeout=30,
)
response.raise_for_status()
print(response.json())

Using initial context#

Values in initial_context are available to the agent as template variables. With the request above, a prompt like:

Text
Hi {{customer_name}}, I'm calling about your order {{order_id}}, due on {{delivery_date}}.

is spoken as "Hi Priya, I'm calling about your order ORD-1042, due on 28 October." See Template Variables for fallbacks and nested values.

Response#

200: the call was handed to your telephony provider.

JSON
{
  "status": "initiated",
  "workflow_run_id": 18234,
  "workflow_run_name": "WR-API-4821"
}
FieldTypeDescription
statusstringAlways initiated on success. The call is dialing; it has not been answered yet.
workflow_run_idintegerThe id of this call. It appears in List calls, in the dashboard, and in your Webhook node payload.
workflow_run_namestringA short label for the call, shown in the dashboard.

To receive the outcome when the call ends, add a Webhook node to the agent.

Errors#

StatusWhen
400Telephony isn't set up for your organization, or the provider refused the call (the reason is in detail)
401The API key is missing or invalid
402Your plan has no call minutes left
403The API key belongs to a different organization than the agent
404No trigger with this uuid, the trigger is turned off, or it was removed from the agent
422phone_number is missing or the body isn't valid JSON

Send an Event

Send an event from your own system to record what a person did and start journeys for them

https://docs.lemuai.com/api-reference/events/trigger

Sends an event that happened in your own system, such as an abandoned cart, a placed order or a submitted form. LemuAI stores it, links it to the right contact, and starts every active journey whose API Events trigger listens for the same event_type.

Use this to start a journey, for example a WhatsApp message or a follow-up call an hour after a cart is abandoned. To call one number straight away with a voice agent, use Trigger an outbound call instead.

POST/api/v1/events

Headers#

NameRequiredDescription
X-API-KeyYesAn API key from your organization. See Authentication.
Content-TypeYesapplication/json

Request body#

FieldTypeRequiredDescription
event_typestringYesThe name of the event, 1 to 100 characters, for example Purchase, InitiateCheckout or your own cart_abandoned. Journeys whose API Events trigger uses the same event_type start for this contact. See Event names.
phonestringNoThe person's phone number in international format, for example +919876543210, up to 50 characters.
emailstringNoThe person's email address, up to 254 characters.
external_idstringNoYour own id for the person, for example a CRM or customer id, up to 255 characters.
anonymous_idstringNoThe visitor id set by the LemuAI website snippet or an app SDK (see Tracking Sources), up to 512 characters. Send it to tie website or app activity to the person once they sign up or check out.
list_namestringNoA contact list name, up to 255 characters. The contact is added to this list, and the list is created if it doesn't exist yet.
dataobjectNoAny details about the event, such as order id, amount or product. Journeys started by this event can use these values (see below). For a Purchase, include value, currency and order_id (see Orders and revenue).

Send at least one of phone, email, external_id or anonymous_id to link the event to a person. An event with none of them is stored but not linked to a contact.

If data contains first_name and last_name (or name, full_name, contact_name or customer_name), the name is saved on the contact.

Event names#

Use Meta's standard event names where one fits, such as Purchase, AddToCart, InitiateCheckout or Lead. They are matched whatever the case or separators: purchase, PURCHASE and Purchase are all stored as Purchase, and add_to_cart as AddToCart. Any other name is a custom event and is stored as you sent it.

Older names such as order_placed and cart_added still match Purchase and InitiateCheckout in journeys and segments. See Standard and conversion events for the full list.

Orders and revenue#

A Purchase (or any other event listed under Conversion events in Sending Limits) counts as an order for journey and campaign revenue and ROI. Include these fields in data:

FieldTypeDescription
valuenumberThe order total in major units, for example 1499.5
currencystringAn ISO 4217 code, for example INR
order_idstringYour id for the order. The same order reported more than once, by this API, your website, your app or Shopify, counts once

The event is never rejected for a missing field. An order without a value counts with no revenue, a missing currency is replaced by your workspace currency, and an order without an order_id counts every time it is sent.

cURL

cURL
curl -X POST https://app.lemuai.com/api/v1/events \
  -H "X-API-Key: lemu_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "event_type": "Purchase",
    "phone": "+919876543210",
    "data": {
      "value": 1499.5,
      "currency": "INR",
      "order_id": "1042",
      "content_ids": ["SKU1"]
    }
  }'

JavaScript

JavaScript
const res = await fetch("https://app.lemuai.com/api/v1/events", {
  method: "POST",
  headers: {
    "X-API-Key": process.env.LEMU_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "event_type": "Purchase",
    "phone": "+919876543210",
    "data": {
      "value": 1499.5,
      "currency": "INR",
      "order_id": "1042",
      "content_ids": [
        "SKU1"
      ]
    }
  }),
});
if (!res.ok) throw new Error(`LemuAI API ${res.status}: ${await res.text()}`);
const data = await res.json();
console.log(data);

Python

Python
import os
 
import requests
 
response = requests.post(
    "https://app.lemuai.com/api/v1/events",
    headers={
        "X-API-Key": os.environ["LEMU_API_KEY"],
    },
    json={
        "event_type": "Purchase",
        "phone": "+919876543210",
        "data": {
            "value": 1499.5,
            "currency": "INR",
            "order_id": "1042",
            "content_ids": [
                "SKU1",
            ],
        },
    },
    timeout=30,
)
response.raise_for_status()
print(response.json())

How the contact is found#

LemuAI looks up every identifier you send (phone, email, external_id and anonymous_id) and works out which person they belong to:

  1. One match. If the identifiers point to one existing contact, the event is linked to it, and any new identifiers you sent are added to that contact.
  2. Several matches. If they point to two or more contacts that are clearly the same person (for example the phone matches one contact and the email matches another, and nothing conflicts), those contacts are merged into one and the event is linked to it. Contacts are not merged when that would join two different people, for example two contacts that each have a different email. In that case the event is linked to the main matching contact and nothing is merged.
  3. No match. A new contact is created, but only when you sent a phone or an email. An external_id or anonymous_id on its own links to an existing contact or to none; it never creates one.

A website visitor id that was linked to another person before moves to the person in this event.

Example request:

cURL

cURL
curl -X POST https://app.lemuai.com/api/v1/events \
  -H "X-API-Key: lemu_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "event_type": "cart_abandoned",
    "phone": "+919876543210",
    "email": "priya@example.com",
    "external_id": "cust-58214",
    "list_name": "Abandoned carts",
    "data": {
      "first_name": "Priya",
      "cart_amount": 2499,
      "product_name": "Running shoes"
    }
  }'

JavaScript

JavaScript
const res = await fetch("https://app.lemuai.com/api/v1/events", {
  method: "POST",
  headers: {
    "X-API-Key": process.env.LEMU_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "event_type": "cart_abandoned",
    "phone": "+919876543210",
    "email": "priya@example.com",
    "external_id": "cust-58214",
    "list_name": "Abandoned carts",
    "data": {
      "first_name": "Priya",
      "cart_amount": 2499,
      "product_name": "Running shoes"
    }
  }),
});
if (!res.ok) throw new Error(`LemuAI API ${res.status}: ${await res.text()}`);
const data = await res.json();
console.log(data);

Python

Python
import os
 
import requests
 
response = requests.post(
    "https://app.lemuai.com/api/v1/events",
    headers={
        "X-API-Key": os.environ["LEMU_API_KEY"],
    },
    json={
        "event_type": "cart_abandoned",
        "phone": "+919876543210",
        "email": "priya@example.com",
        "external_id": "cust-58214",
        "list_name": "Abandoned carts",
        "data": {
            "first_name": "Priya",
            "cart_amount": 2499,
            "product_name": "Running shoes",
        },
    },
    timeout=30,
)
response.raise_for_status()
print(response.json())

Response#

201: the event was stored and matching journeys were queued.

JSON
{
  "event_id": 90412,
  "contact_id": 5531,
  "triggered_workflows": 0
}
FieldTypeDescription
event_idintegerThe id of the stored event. It appears in the Event Log.
contact_idinteger or nullThe contact the event was linked to. null when no identifier was sent, when only an external_id or anonymous_id was sent and no contact has it, or when your plan's contact limit stopped a new contact being created.
triggered_workflowsintegerAlways 0. Journeys are started in the background just after the response, so the count isn't known yet. Check the Event Log or the journey's runs to see what ran.

Using event data in a journey#

A journey started by this event gets phone, event_type and event_id, plus every field from data (or only the fields picked in the trigger's context mapping). With the request above, a call step in the journey can use {{first_name}}, {{cart_amount}} and {{product_name}} in the agent's prompt.

On the journey's API Events trigger you can also:

  • wait before running, for example 60 minutes after cart_abandoned;
  • cancel the run if another event arrives for the same contact first, for example Purchase;
  • only run for contacts in a chosen list.

See Journey nodes and triggers for the full trigger settings.

A new contact created from an event is tagged event and counts toward your plan's contact limit. If you've reached the limit, the event is still stored, but no contact is created and contact_id is null.

Errors#

StatusWhen
401The API key is missing or not valid.
422event_type is missing or too long, or another field is too long or has the wrong type.

See Errors for the error format.

List Events

List your organization's events from every source, newest first

https://docs.lemuai.com/api-reference/events/list

Returns your organization's events, newest first. This is the same data as the Event Log page. It includes events you sent with Send an event and events from other sources, such as Shopify, your tracking sources, segments and custom records.

GET/api/v1/events

Headers#

NameRequiredDescription
X-API-KeyYesAn API key from your organization. See Authentication.

Query parameters#

NameTypeRequiredDescription
event_typestringNoOnly return events of this type, for example Purchase. A Meta standard event name also returns events stored under its older names, so Purchase includes order_placed and checkout_completed. See Standard and conversion events.
sourcestringNoOnly return events from this source. See Event sources below.
include_message_updatesbooleanNoAlso return message status updates, such as message_sent or message_delivered. Default false. Only works when the event store is on (see store below).
searchstringNoMatch against the phone number, the contact's name or the event type.
start_datestringNoEarliest event to include, as YYYY-MM-DD or a full ISO date and time.
end_datestringNoLatest event to include, as YYYY-MM-DD (the whole day is included) or a full ISO date and time.
limitintegerNoHow many events to return, 1 to 500. Default 100.
offsetintegerNoHow many events to skip, for paging. Default 0.

Event sources#

SourceWhere the event came from
apiSend an event
shopifyYour connected Shopify store
pixelA tracking source: the LemuAI website snippet or an app SDK, including visits by people who aren't known yet
messagingStatus changes of messages and calls on any channel
segmentsA contact entering or leaving a segment
recordsA custom record being created, updated or deleted
backfillOlder events copied in when the event store was turned on

Example request:

cURL

cURL
curl "https://app.lemuai.com/api/v1/events?source=api&event_type=cart_abandoned&start_date=2026-10-01&limit=50" \
  -H "X-API-Key: lemu_your_api_key"

JavaScript

JavaScript
const res = await fetch("https://app.lemuai.com/api/v1/events?source=api&event_type=cart_abandoned&start_date=2026-10-01&limit=50", {
  method: "GET",
  headers: {
    "X-API-Key": process.env.LEMU_API_KEY,
  },
});
if (!res.ok) throw new Error(`LemuAI API ${res.status}: ${await res.text()}`);
const data = await res.json();
console.log(data);

Python

Python
import os
 
import requests
 
response = requests.get(
    "https://app.lemuai.com/api/v1/events?source=api&event_type=cart_abandoned&start_date=2026-10-01&limit=50",
    headers={
        "X-API-Key": os.environ["LEMU_API_KEY"],
    },
    timeout=30,
)
response.raise_for_status()
print(response.json())

Response#

200

JSON
{
  "events": [
    {
      "id": 90412,
      "event_id": "3f6c2a9e-8d1b-5c7a-9e42-1b7d0c5a6f13",
      "event_type": "cart_abandoned",
      "source": "api",
      "phone": "+919876543210",
      "contact_id": 5531,
      "contact_name": "Priya Sharma",
      "anonymous_id": null,
      "event_data": {
        "first_name": "Priya",
        "cart_amount": 2499,
        "product_name": "Running shoes"
      },
      "created_at": "2026-10-27T09:14:02.511000+00:00"
    }
  ],
  "total": 1,
  "store": "clickhouse"
}
FieldTypeDescription
eventsarrayThe events on this page, newest first.
events[].idintegerThe event's number in LemuAI. This is the event_id returned by Send an event. It is 0 for events that are only kept in the event store, such as page views by website visitors.
events[].event_idstringA unique id (UUID) for the event. Every event has one, so use it when you need a stable id.
events[].event_typestringThe event name.
events[].sourcestringWhere the event came from. See Event sources.
events[].phonestring or nullThe phone number sent with the event.
events[].contact_idinteger or nullThe contact the event is linked to.
events[].contact_namestring or nullThat contact's name, if known.
events[].anonymous_idstring or nullThe website visitor id, for activity by a visitor who isn't linked to a contact yet.
events[].event_dataobjectThe details sent with the event.
events[].created_atstringWhen the event happened, in ISO 8601 (UTC).
totalintegerHow many events match your filters in total, for paging with limit and offset.
storestringWhere the events were read from: clickhouse (the event store, which holds every source including anonymous website visits) or postgres (the main database, used when the event store isn't on).

API keys see full phone numbers here. In the dashboard, team members without permission to view personal data see them partly hidden.

Errors#

StatusWhen
401The API key is missing or not valid.
422A query parameter has the wrong type, or limit is outside 1 to 500.

See Errors for the error format.

List Agents

List the voice agents in your organization

https://docs.lemuai.com/api-reference/agents/list

Returns every voice agent in your organization with a few summary numbers. Use it to find an agent's id for List calls.

GET/api/v1/workflow/fetch

Query parameters#

NameTypeRequiredDescription
statusstringNoactive, archived, or both separated by a comma (active,archived). Leave it out to get all agents. Any other value returns 422.

Example request:

cURL

cURL
curl "https://app.lemuai.com/api/v1/workflow/fetch?status=active" \
  -H "X-API-Key: lemu_your_api_key"

JavaScript

JavaScript
const res = await fetch("https://app.lemuai.com/api/v1/workflow/fetch?status=active", {
  method: "GET",
  headers: {
    "X-API-Key": process.env.LEMU_API_KEY,
  },
});
if (!res.ok) throw new Error(`LemuAI API ${res.status}: ${await res.text()}`);
const data = await res.json();
console.log(data);

Python

Python
import os
 
import requests
 
response = requests.get(
    "https://app.lemuai.com/api/v1/workflow/fetch?status=active",
    headers={
        "X-API-Key": os.environ["LEMU_API_KEY"],
    },
    timeout=30,
)
response.raise_for_status()
print(response.json())

Response#

200: a list of agents.

JSON
[
  {
    "id": 412,
    "name": "Order Delivery Confirmation",
    "status": "active",
    "created_at": "2026-09-14T08:21:47Z",
    "total_runs": 1284,
    "workflow_uuid": "8d0e6c2a-51f4-4b0e-9f7c-3c2a1e6b9d40",
    "last_run_at": "2026-10-23T11:05:12Z",
    "success_rate": 87.4
  }
]
FieldTypeDescription
idintegerThe agent's id. Use it in other endpoints.
namestringThe agent's name as shown in the dashboard.
statusstringactive or archived.
created_atstringWhen the agent was created (ISO 8601, UTC).
total_runsintegerHow many calls the agent has made or received.
workflow_uuidstring or nullA stable public identifier for the agent. This is not the id used by Trigger an outbound call; that endpoint needs the API Trigger node's id.
last_run_atstring or nullWhen the agent's most recent call started, or null if it has none.
success_ratenumber or nullPercentage of the agent's calls that ran to completion, from 0 to 100 (one decimal place). null if it has no calls yet.

List Calls

List the calls (runs) made or received by one voice agent

https://docs.lemuai.com/api-reference/agents/runs/list

Returns the calls for one voice agent, newest first, a page at a time. Each call is called a run. Use it to check whether a call you triggered has finished and what the agent captured.

If you need each result as soon as a call ends, add a Webhook node to the agent instead of polling this endpoint.

GET/api/v1/workflow/{workflow_id}/runs

Path parameters#

NameTypeRequiredDescription
workflow_idintegerYesThe agent's id from List agents.

Query parameters#

NameTypeRequiredDescription
pageintegerNoPage number, starting at 1. Default 1.
limitintegerNoCalls per page. Default 50.
sort_bystringNocreated_at (default) or duration.
sort_orderstringNodesc (default) or asc.
filtersstringNoA JSON array of filters, URL-encoded. See below.

Filters#

filters is a JSON array. Each item has an attribute, a type, and a value:

AttributeTypeValueMatches calls
dateRangedateRange{"from": "2026-10-01T00:00:00", "to": "2026-10-31T23:59:59"}Started between the two times (ISO 8601). Either end can be left out.
statusradio{"status": "completed"} or {"status": "in_progress"}That have finished, or are still going
dispositionCodemultiSelect{"codes": ["INTERESTED", "CALLBACK"]}Ended with one of these disposition codes
durationnumberRange{"min": 30, "max": 600}Lasted between these numbers of seconds

Any other attribute returns 403. A filters value that isn't valid JSON returns 400.

Example request (completed calls from October):

cURL

cURL
curl -G "https://app.lemuai.com/api/v1/workflow/412/runs" \
  -H "X-API-Key: lemu_your_api_key" \
  --data-urlencode 'limit=20' \
  --data-urlencode 'filters=[{"attribute":"status","type":"radio","value":{"status":"completed"}},{"attribute":"dateRange","type":"dateRange","value":{"from":"2026-10-01T00:00:00"}}]'

JavaScript

JavaScript
const params = new URLSearchParams({
  "limit": "20",
  "filters": "[{\"attribute\":\"status\",\"type\":\"radio\",\"value\":{\"status\":\"completed\"}},{\"attribute\":\"dateRange\",\"type\":\"dateRange\",\"value\":{\"from\":\"2026-10-01T00:00:00\"}}]",
});
const res = await fetch(`https://app.lemuai.com/api/v1/workflow/412/runs?${params}`, {
  method: "GET",
  headers: {
    "X-API-Key": process.env.LEMU_API_KEY,
  },
});
if (!res.ok) throw new Error(`LemuAI API ${res.status}: ${await res.text()}`);
const data = await res.json();
console.log(data);

Python

Python
import os
 
import requests
 
response = requests.get(
    "https://app.lemuai.com/api/v1/workflow/412/runs",
    headers={
        "X-API-Key": os.environ["LEMU_API_KEY"],
    },
    params={
        "limit": "20",
        "filters": "[{\"attribute\":\"status\",\"type\":\"radio\",\"value\":{\"status\":\"completed\"}},{\"attribute\":\"dateRange\",\"type\":\"dateRange\",\"value\":{\"from\":\"2026-10-01T00:00:00\"}}]",
    },
    timeout=30,
)
response.raise_for_status()
print(response.json())

Response#

200

JSON
{
  "runs": [
    {
      "id": 18234,
      "workflow_id": 412,
      "name": "WR-API-4821",
      "mode": "plivo",
      "created_at": "2026-10-23T11:05:12Z",
      "is_completed": true,
      "call_type": "outbound",
      "definition_id": 1907,
      "initial_context": {
        "phone_number": "+919876543210",
        "customer_name": "Priya",
        "order_id": "ORD-1042"
      },
      "gathered_context": {
        "delivery_confirmed": true,
        "preferred_time": "after 5 pm",
        "mapped_call_disposition": "CONFIRMED"
      },
      "cost_info": {
        "billed_minutes": 2,
        "call_duration_seconds": 94
      },
      "recording_url": "recordings/18234.wav",
      "transcript_url": "transcripts/18234.txt"
    }
  ],
  "total_count": 1284,
  "page": 1,
  "limit": 20,
  "total_pages": 65,
  "applied_filters": [
    { "attribute": "status", "type": "radio", "value": { "status": "completed" } }
  ]
}
FieldTypeDescription
runsarrayThe calls on this page. Fields of each call are below.
total_countintegerCalls matching your filters across all pages.
pageintegerThe page returned.
limitintegerCalls per page.
total_pagesintegerNumber of pages at this limit.
applied_filtersarray or nullThe filters that were applied, or null if none.

Each call:

FieldTypeDescription
idintegerThe call's id. Matches workflow_run_id from Trigger an outbound call.
workflow_idintegerThe agent that handled the call.
namestringThe call's label in the dashboard.
modestringHow the call was connected: the telephony provider (for example twilio, plivo, exotel), or webrtc / textchat for browser tests.
created_atstringWhen the call started (ISO 8601, UTC).
is_completedbooleantrue once the call has ended.
call_typestringoutbound or inbound.
definition_idinteger or nullThe version of the agent that ran this call.
initial_contextobject or nullThe data the call started with, including phone_number and anything you sent in initial_context.
gathered_contextobject or nullWhat the agent captured during the call, plus mapped_call_disposition (the disposition code the call ended with). Empty until the call has finished.
cost_infoobject or nullcall_duration_seconds and billed_minutes for the call. null until the call has ended.
recording_url, transcript_urlstring or nullInternal references to the stored recording and transcript. Open recordings and transcripts from the call in the dashboard; they are not downloadable through the API.

Phone numbers and other personal details in initial_context and gathered_context may be partly hidden, depending on whether the person who created the API key is allowed to view personal data in your organization.

List Campaigns

List the calling campaigns in your organization and their progress

https://docs.lemuai.com/api-reference/campaigns/list

Returns every campaign in your organization with its state and progress counts. Campaigns are created and run from the dashboard; see Campaigns.

GET/api/v1/campaign/

This endpoint takes no parameters.

Example request:

cURL

cURL
curl https://app.lemuai.com/api/v1/campaign/ \
  -H "X-API-Key: lemu_your_api_key"

JavaScript

JavaScript
const res = await fetch("https://app.lemuai.com/api/v1/campaign/", {
  method: "GET",
  headers: {
    "X-API-Key": process.env.LEMU_API_KEY,
  },
});
if (!res.ok) throw new Error(`LemuAI API ${res.status}: ${await res.text()}`);
const data = await res.json();
console.log(data);

Python

Python
import os
 
import requests
 
response = requests.get(
    "https://app.lemuai.com/api/v1/campaign/",
    headers={
        "X-API-Key": os.environ["LEMU_API_KEY"],
    },
    timeout=30,
)
response.raise_for_status()
print(response.json())

Response#

200

JSON
{
  "campaigns": [
    {
      "id": 57,
      "name": "October payment reminders",
      "workflow_id": 412,
      "workflow_name": "Payment Reminder",
      "state": "running",
      "source_type": "contact-list",
      "source_id": "23",
      "total_rows": 1200,
      "processed_rows": 640,
      "failed_rows": 12,
      "created_at": "2026-10-20T09:00:00Z",
      "started_at": "2026-10-21T04:30:00Z",
      "completed_at": null,
      "retry_config": {
        "enabled": true,
        "max_retries": 2,
        "retry_delay_seconds": 120,
        "retry_on_busy": true,
        "retry_on_no_answer": true,
        "retry_on_voicemail": false
      },
      "schedule_config": {
        "enabled": true,
        "timezone": "Asia/Kolkata",
        "slots": [
          { "day_of_week": 0, "start_time": "10:00", "end_time": "18:00" }
        ]
      },
      "circuit_breaker": {
        "enabled": true,
        "failure_threshold": 0.5,
        "window_seconds": 120,
        "min_calls_in_window": 5
      }
    }
  ]
}

Each campaign:

FieldTypeDescription
idintegerThe campaign's id.
namestringThe campaign's name.
workflow_idintegerThe voice agent the campaign calls with.
workflow_namestringThat agent's name.
statestringcreated, syncing, running, paused, completed, or failed.
source_typestringWhere the numbers come from: contact-list, google-sheet, or csv.
source_idstringThe contact list id, Google Sheet URL, or uploaded file reference.
total_rowsinteger or nullContacts in the campaign, once the source has been read.
processed_rowsintegerContacts already called.
failed_rowsintegerContacts whose call could not be placed.
created_atstringWhen the campaign was created (ISO 8601, UTC).
started_atstring or nullWhen it was first started.
completed_atstring or nullWhen it finished.
retry_configobjectWhether and how unanswered calls are retried: enabled, max_retries, retry_delay_seconds, and which outcomes trigger a retry (retry_on_busy, retry_on_no_answer, retry_on_voicemail).
schedule_configobject or nullThe calling windows: timezone and slots (day_of_week from 0 Monday to 6 Sunday, start_time and end_time as HH:MM). null if the campaign calls at any time.
circuit_breakerobject or nullAutomatic pause when too many calls fail: failure_threshold (share of failures, 0 to 1) within window_seconds, once at least min_calls_in_window calls were made.

Overview

Keep your Lemu AI contacts and contact lists in sync with your CRM

https://docs.lemuai.com/api-reference/contacts/overview

A contact is a person you call or message. Contacts are grouped into contact lists, which campaigns and journeys use as their audience. One contact can be in several lists.

The contacts API is for keeping Lemu AI in step with your own system (a CRM, a spreadsheet, a signup form):

MethodEndpointPurpose
POST/contacts/upsertAdd or update one contact and put it in a list
POST/contacts/bulk-upsertAdd or update up to 5,000 contacts in one list
GET/contactsList and search contacts
GET/contacts/{contact_id}Get one contact and the lists it is in
GET/contacts/listsList your contact lists
GET/contacts/lists/{list_id}/contactsList the contacts in one list
GET/contacts/{contact_id}/consentsGet a contact's consent for each channel
PUT/contacts/{contact_id}/consents/{channel}Record an opt-in or opt-out
GET/contacts/{contact_id}/activityGet a contact's activity from every source
GET/contacts/{contact_id}/messagesList a contact's messages and calls

Editing lists, deleting contacts, and importing from Google Sheets are done in the dashboard under Contacts.

Contact fields#

FieldTypeDescription
idintegerThe contact's id in Lemu AI.
organization_idintegerYour organization's id.
phonestring or nullPhone number in international format, for example +919876543210. Used to match existing contacts when upserting.
phone_last4string or nullThe last four digits of the phone number.
phone_maskedbooleantrue if phone is partly hidden (see below).
external_idstring or nullYour own id for this person, for example the CRM record id. Must be unique in your organization.
emailstring or nullEmail address.
first_name, last_namestring or nullName.
companystring or nullCompany name.
titlestring or nullJob title.
tagsarray of strings or nullLabels for grouping and filtering.
custom_fieldsobjectAny other values you store on the contact, as key-value pairs. Agents can use them as template variables when calling the contact.
created_at, updated_atstringTimestamps (ISO 8601, UTC).

Hidden phone numbers#

Phone numbers are personal data. If the person who created the API key isn't allowed to view personal data in your organization, responses show the number partly hidden (for example •••• 3210) and set phone_masked to true. Organization owners and admins, and team members with permission to view personal data, see full numbers.

Plan limits#

Your plan sets how many contacts your organization can store. Requests that would go over the limit return 402.

Upsert a Contact

Create or update one contact by phone number and add it to a contact list

https://docs.lemuai.com/api-reference/contacts/upsert

Adds one contact to a contact list, creating whatever doesn't exist yet:

  • The contact is matched by phone in your organization. The match ignores formatting, so +91 98765 43210 and +919876543210 are the same number. If a match is found, the fields you send are updated; if not, a new contact is created.
  • The list is matched by list_name. If no list has that name, it is created.

Use this endpoint when a record is created or changes in your CRM.

POST/api/v1/contacts/upsert

Request body#

FieldTypeRequiredDescription
list_namestringYesThe contact list to add the contact to (1 to 255 characters). Created if it doesn't exist.
phonestringOne of phone or external_idPhone number in international format. This is what existing contacts are matched on.
external_idstringOne of phone or external_idYour own id for the person. Stored on the contact, but not used for matching: a request with only external_id always creates a new contact.
emailstringNoA valid email address.
first_namestringNoUp to 100 characters.
last_namestringNoUp to 100 characters.
companystringNoUp to 255 characters.
titlestringNoJob title, up to 255 characters.
tagsarray of stringsNoReplaces the contact's tags.
custom_fieldsobjectNoExtra values. Merged into the contact's existing custom fields: keys you send are updated, others are kept.

When updating, fields you leave out (or send as null) keep their current value.

Example request:

cURL

cURL
curl -X POST https://app.lemuai.com/api/v1/contacts/upsert \
  -H "X-API-Key: lemu_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "list_name": "October renewals",
    "phone": "+919876543210",
    "external_id": "crm-58213",
    "first_name": "Priya",
    "last_name": "Sharma",
    "tags": ["renewal", "gold"],
    "custom_fields": { "plan": "Gold", "renewal_date": "2026-11-05" }
  }'

JavaScript

JavaScript
const res = await fetch("https://app.lemuai.com/api/v1/contacts/upsert", {
  method: "POST",
  headers: {
    "X-API-Key": process.env.LEMU_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "list_name": "October renewals",
    "phone": "+919876543210",
    "external_id": "crm-58213",
    "first_name": "Priya",
    "last_name": "Sharma",
    "tags": [
      "renewal",
      "gold"
    ],
    "custom_fields": {
      "plan": "Gold",
      "renewal_date": "2026-11-05"
    }
  }),
});
if (!res.ok) throw new Error(`LemuAI API ${res.status}: ${await res.text()}`);
const data = await res.json();
console.log(data);

Python

Python
import os
 
import requests
 
response = requests.post(
    "https://app.lemuai.com/api/v1/contacts/upsert",
    headers={
        "X-API-Key": os.environ["LEMU_API_KEY"],
    },
    json={
        "list_name": "October renewals",
        "phone": "+919876543210",
        "external_id": "crm-58213",
        "first_name": "Priya",
        "last_name": "Sharma",
        "tags": [
            "renewal",
            "gold",
        ],
        "custom_fields": {
            "plan": "Gold",
            "renewal_date": "2026-11-05",
        },
    },
    timeout=30,
)
response.raise_for_status()
print(response.json())

Response#

200

JSON
{
  "contact": {
    "id": 901,
    "organization_id": 7,
    "external_id": "crm-58213",
    "phone": "+919876543210",
    "phone_last4": "3210",
    "phone_masked": false,
    "email": null,
    "first_name": "Priya",
    "last_name": "Sharma",
    "company": null,
    "title": null,
    "tags": ["renewal", "gold"],
    "custom_fields": { "plan": "Gold", "renewal_date": "2026-11-05" },
    "created_at": "2026-10-20T10:00:00Z",
    "updated_at": "2026-10-24T09:12:40Z"
  },
  "contact_list": {
    "id": 55,
    "organization_id": 7,
    "name": "October renewals",
    "description": null,
    "metadata": {},
    "column_schema": [],
    "created_at": "2026-10-24T09:12:40Z",
    "updated_at": "2026-10-24T09:12:40Z"
  },
  "contact_created": false,
  "list_created": true
}
FieldTypeDescription
contactobjectThe contact after the update. See contact fields.
contact_listobjectThe list the contact was added to: id, name, description, and timestamps.
contact_createdbooleantrue if a new contact was created, false if an existing one was updated.
list_createdbooleantrue if the list was created by this request.

Errors#

StatusWhen
402Your plan's contact limit is reached
422Neither phone nor external_id was sent, list_name is missing, or a field is too long or not valid (for example email)

Bulk Upsert Contacts

Create or update up to 5,000 contacts in one contact list in a single request

https://docs.lemuai.com/api-reference/contacts/bulk-upsert

Loads or refreshes a contact list in one request. For each contact:

  1. Lemu AI looks for an existing contact with the same phone, then with the same external_id. A row that has neither a phone nor an external_id is matched by email instead (ignoring upper and lower case), so sending the same email-only rows again updates them rather than creating duplicates.
  2. If one is found, it is updated with the fields you send. If not, a new contact is created.
  3. The contact is added to the list named list_name, which is created if it doesn't exist.

Each contact is handled on its own, so one bad row doesn't stop the rest. Rows that fail are reported in errors.

This endpoint matches rows by phone, external_id and email only. It does not merge contacts. To link activity from several identifiers (for example a website visitor id) to one person, use Send an event.

Bulk matching compares phone numbers exactly as stored. Send every number in the same international format (for example +919876543210) so existing contacts are found instead of duplicated.

POST/api/v1/contacts/bulk-upsert

Headers#

NameRequiredDescription
X-API-KeyYesAn API key from your organization. See Authentication.
Content-TypeYesapplication/json

Request body#

FieldTypeRequiredDescription
list_namestringYesThe list to put the contacts in (1 to 255 characters). Created if it doesn't exist.
contactsarrayYesBetween 1 and 5,000 contacts. Each one accepts the fields below.

Each contact:

FieldTypeDescription
phonestringPhone number in international format.
external_idstringYour own id for the person.
emailstringEmail address.
first_name, last_namestringName. A single name (or full_name) is also accepted and split into first and last name.
companystringCompany name.
titlestringJob title.
tagsarray of stringsReplaces the contact's tags.
custom_fieldsobjectExtra values, merged into the contact's custom fields.
any other keyanyStored in custom_fields, so you can send a row from a spreadsheet or CRM as it is. A mobile key is used as phone and an id key as external_id when those aren't set.

Example request:

cURL

cURL
curl -X POST https://app.lemuai.com/api/v1/contacts/bulk-upsert \
  -H "X-API-Key: lemu_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "list_name": "October renewals",
    "contacts": [
      { "phone": "+919876543210", "first_name": "Priya", "plan": "Gold" },
      { "phone": "+919812345678", "name": "Rahul Verma", "id": "crm-58214", "tags": ["renewal"] },
      { "phone": "+919876543210", "first_name": "Priya S." }
    ]
  }'

JavaScript

JavaScript
const res = await fetch("https://app.lemuai.com/api/v1/contacts/bulk-upsert", {
  method: "POST",
  headers: {
    "X-API-Key": process.env.LEMU_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "list_name": "October renewals",
    "contacts": [
      {
        "phone": "+919876543210",
        "first_name": "Priya",
        "plan": "Gold"
      },
      {
        "phone": "+919812345678",
        "name": "Rahul Verma",
        "id": "crm-58214",
        "tags": [
          "renewal"
        ]
      },
      {
        "phone": "+919876543210",
        "first_name": "Priya S."
      }
    ]
  }),
});
if (!res.ok) throw new Error(`LemuAI API ${res.status}: ${await res.text()}`);
const data = await res.json();
console.log(data);

Python

Python
import os
 
import requests
 
response = requests.post(
    "https://app.lemuai.com/api/v1/contacts/bulk-upsert",
    headers={
        "X-API-Key": os.environ["LEMU_API_KEY"],
    },
    json={
        "list_name": "October renewals",
        "contacts": [
            {
                "phone": "+919876543210",
                "first_name": "Priya",
                "plan": "Gold",
            },
            {
                "phone": "+919812345678",
                "name": "Rahul Verma",
                "id": "crm-58214",
                "tags": [
                    "renewal",
                ],
            },
            {
                "phone": "+919876543210",
                "first_name": "Priya S.",
            },
        ],
    },
    timeout=30,
)
response.raise_for_status()
print(response.json())

Response#

200

JSON
{
  "created": 1,
  "updated": 1,
  "failed": 1,
  "errors": [
    { "index": 2, "error": "Duplicate phone +919876543210 in batch, skipped" }
  ],
  "list_created": false,
  "list_id": 42,
  "contacts": [
    {
      "id": 901,
      "organization_id": 7,
      "external_id": "crm-58213",
      "phone": "+919876543210",
      "phone_last4": "3210",
      "phone_masked": false,
      "email": null,
      "first_name": "Priya",
      "last_name": "Sharma",
      "company": null,
      "title": null,
      "tags": ["renewal", "gold"],
      "custom_fields": { "plan": "Gold" },
      "created_at": "2026-10-20T10:00:00Z",
      "updated_at": "2026-10-24T09:20:03Z"
    }
  ]
}
FieldTypeDescription
createdintegerContacts created.
updatedintegerExisting contacts updated.
failedintegerRows that were skipped.
errorsarrayOne entry per failed row: index (its position in your contacts array, starting at 0) and error (why). A phone number, external_id or email (for email-only rows) repeated within the same request is skipped after its first appearance.
list_createdbooleantrue if the list was created by this request.
list_idintegerThe id of the list. Use it with List the contacts in one list, or to pick the list as a journey or campaign audience.
contactsarrayThe contacts that were created or updated. See contact fields.

Errors#

StatusWhen
401The API key is missing or not valid
402The contacts would take your organization over its plan's contact limit
422list_name is missing, contacts is empty or has more than 5,000 items, or a field is too long

List Contacts

List and search the contacts in your organization

https://docs.lemuai.com/api-reference/contacts/list

Returns your contacts a page at a time, newest first, with optional search and filters.

GET/api/v1/contacts

Query parameters#

NameTypeRequiredDescription
pageintegerNoPage number, starting at 1. Default 1.
limitintegerNoContacts per page, 1 to 500. Default 50.
searchstringNoText to look for in first, last or full name, email, company, external ID and phone. A phone-like value also matches the last 4 digits, and the full number with or without the country code (9876543210, +919876543210).
tagsstringNoComma-separated tags. Returns contacts with any of them.
has_emailbooleanNotrue for contacts with an email, false for contacts without one.
has_phonebooleanNotrue for contacts with a phone number, false for contacts without one.
list_idintegerNoOnly contacts in this list.
sort_bystringNocreated_at (default), first_name, last_name, phone, email, company, title, opted_out or id.
sort_dirstringNodesc (default) or asc.

Example request:

cURL

cURL
curl -G https://app.lemuai.com/api/v1/contacts \
  -H "X-API-Key: lemu_your_api_key" \
  --data-urlencode "search=Priya" \
  --data-urlencode "tags=renewal,gold" \
  --data-urlencode "limit=25"

JavaScript

JavaScript
const params = new URLSearchParams({
  "search": "Priya",
  "tags": "renewal,gold",
  "limit": "25",
});
const res = await fetch(`https://app.lemuai.com/api/v1/contacts?${params}`, {
  method: "GET",
  headers: {
    "X-API-Key": process.env.LEMU_API_KEY,
  },
});
if (!res.ok) throw new Error(`LemuAI API ${res.status}: ${await res.text()}`);
const data = await res.json();
console.log(data);

Python

Python
import os
 
import requests
 
response = requests.get(
    "https://app.lemuai.com/api/v1/contacts",
    headers={
        "X-API-Key": os.environ["LEMU_API_KEY"],
    },
    params={
        "search": "Priya",
        "tags": "renewal,gold",
        "limit": "25",
    },
    timeout=30,
)
response.raise_for_status()
print(response.json())

Response#

200

JSON
{
  "contacts": [
    {
      "id": 901,
      "organization_id": 7,
      "external_id": "crm-58213",
      "phone": "+919876543210",
      "phone_last4": "3210",
      "phone_masked": false,
      "email": "priya@example.com",
      "first_name": "Priya",
      "last_name": "Sharma",
      "company": "Sharma Traders",
      "title": "Owner",
      "tags": ["renewal", "gold"],
      "custom_fields": { "plan": "Gold" },
      "created_at": "2026-10-20T10:00:00Z",
      "updated_at": "2026-10-24T09:12:40Z"
    }
  ],
  "total_count": 1,
  "page": 1,
  "limit": 25,
  "total_pages": 1
}
FieldTypeDescription
contactsarrayThe contacts on this page. See contact fields.
total_countintegerContacts matching your filters across all pages.
pageintegerThe page returned.
limitintegerContacts per page.
total_pagesintegerNumber of pages at this limit.

Get a Contact

Get one contact and the contact lists it belongs to

https://docs.lemuai.com/api-reference/contacts/get

Returns one contact by its Lemu AI id, including the lists it is in.

GET/api/v1/contacts/{contact_id}

Path parameters#

NameTypeRequiredDescription
contact_idintegerYesThe contact's id, from List contacts or an upsert response.

Example request:

cURL

cURL
curl https://app.lemuai.com/api/v1/contacts/901 \
  -H "X-API-Key: lemu_your_api_key"

JavaScript

JavaScript
const res = await fetch("https://app.lemuai.com/api/v1/contacts/901", {
  method: "GET",
  headers: {
    "X-API-Key": process.env.LEMU_API_KEY,
  },
});
if (!res.ok) throw new Error(`LemuAI API ${res.status}: ${await res.text()}`);
const data = await res.json();
console.log(data);

Python

Python
import os
 
import requests
 
response = requests.get(
    "https://app.lemuai.com/api/v1/contacts/901",
    headers={
        "X-API-Key": os.environ["LEMU_API_KEY"],
    },
    timeout=30,
)
response.raise_for_status()
print(response.json())

Response#

200

JSON
{
  "id": 901,
  "organization_id": 7,
  "external_id": "crm-58213",
  "phone": "+919876543210",
  "phone_last4": "3210",
  "phone_masked": false,
  "email": "priya@example.com",
  "first_name": "Priya",
  "last_name": "Sharma",
  "company": "Sharma Traders",
  "title": "Owner",
  "tags": ["renewal", "gold"],
  "custom_fields": { "plan": "Gold" },
  "created_at": "2026-10-20T10:00:00Z",
  "updated_at": "2026-10-24T09:12:40Z",
  "lists": [
    { "id": 55, "name": "October renewals" },
    { "id": 23, "name": "All customers" }
  ]
}

The response has all the contact fields, plus:

FieldTypeDescription
listsarrayThe lists this contact is in, each with id and name.

Errors#

StatusWhen
404No contact with this id in your organization

List Contact Lists

List the contact lists in your organization with their sizes

https://docs.lemuai.com/api-reference/contacts/lists

Returns your contact lists a page at a time, with how many contacts each holds.

GET/api/v1/contacts/lists

Query parameters#

NameTypeRequiredDescription
pageintegerNoPage number, starting at 1. Default 1.
limitintegerNoLists per page, 1 to 100. Default 50.

Example request:

cURL

cURL
curl https://app.lemuai.com/api/v1/contacts/lists \
  -H "X-API-Key: lemu_your_api_key"

JavaScript

JavaScript
const res = await fetch("https://app.lemuai.com/api/v1/contacts/lists", {
  method: "GET",
  headers: {
    "X-API-Key": process.env.LEMU_API_KEY,
  },
});
if (!res.ok) throw new Error(`LemuAI API ${res.status}: ${await res.text()}`);
const data = await res.json();
console.log(data);

Python

Python
import os
 
import requests
 
response = requests.get(
    "https://app.lemuai.com/api/v1/contacts/lists",
    headers={
        "X-API-Key": os.environ["LEMU_API_KEY"],
    },
    timeout=30,
)
response.raise_for_status()
print(response.json())

Response#

200

JSON
{
  "lists": [
    {
      "id": 55,
      "organization_id": 7,
      "name": "October renewals",
      "description": "Gold and silver plans renewing in November",
      "metadata": {},
      "column_schema": [],
      "created_at": "2026-10-24T09:12:40Z",
      "updated_at": "2026-10-24T09:12:40Z",
      "member_count": 1240
    }
  ],
  "total_count": 1,
  "page": 1,
  "limit": 50,
  "total_pages": 1
}

Each list:

FieldTypeDescription
idintegerThe list's id. Use it with List the contacts in a list.
organization_idintegerYour organization's id.
namestringThe list's name. This is what list_name matches when upserting.
descriptionstring or nullThe list's description.
metadataobjectExtra information stored on the list.
column_schemaarrayThe extra columns this list has (from imported files or sheets).
created_at, updated_atstringTimestamps (ISO 8601, UTC).
member_countintegerHow many contacts are in the list.

The page fields total_count, page, limit, and total_pages work as in List contacts.

List Contacts in a List

Page through, sort, and search the contacts in one contact list

https://docs.lemuai.com/api-reference/contacts/list-members

Returns the contacts in one list. Unlike List contacts, you can sort the results and fetch up to 1,000 contacts per page.

GET/api/v1/contacts/lists/{list_id}/contacts

Path parameters#

NameTypeRequiredDescription
list_idintegerYesThe list's id from List contact lists.

Query parameters#

NameTypeRequiredDescription
pageintegerNoPage number, starting at 1. Default 1.
limitintegerNoContacts per page, 1 to 1000. Default 25.
sort_bystringNoColumn to sort by. Default added_at (when the contact joined the list).
sort_dirstringNodesc (default) or asc.
searchstringNoText to look for in name, phone, email, and company.

Example request:

cURL

cURL
curl -G https://app.lemuai.com/api/v1/contacts/lists/55/contacts \
  -H "X-API-Key: lemu_your_api_key" \
  --data-urlencode "limit=500" \
  --data-urlencode "sort_dir=asc"

JavaScript

JavaScript
const params = new URLSearchParams({
  "limit": "500",
  "sort_dir": "asc",
});
const res = await fetch(`https://app.lemuai.com/api/v1/contacts/lists/55/contacts?${params}`, {
  method: "GET",
  headers: {
    "X-API-Key": process.env.LEMU_API_KEY,
  },
});
if (!res.ok) throw new Error(`LemuAI API ${res.status}: ${await res.text()}`);
const data = await res.json();
console.log(data);

Python

Python
import os
 
import requests
 
response = requests.get(
    "https://app.lemuai.com/api/v1/contacts/lists/55/contacts",
    headers={
        "X-API-Key": os.environ["LEMU_API_KEY"],
    },
    params={
        "limit": "500",
        "sort_dir": "asc",
    },
    timeout=30,
)
response.raise_for_status()
print(response.json())

Response#

200: the same shape as List contacts: contacts, total_count, page, limit, and total_pages.

Errors#

StatusWhen
404No list with this id in your organization

Contact Consent

Read and record a contact's opt-in or opt-out for email, SMS, WhatsApp and voice

https://docs.lemuai.com/api-reference/contacts/consents

Each contact has a consent status for every channel. LemuAI checks it before a journey or campaign sends a message or places a call, so recording opt-ins and opt-outs from your own system (a signup form, a preference center, a support ticket) keeps your messages within what each person agreed to.

Every channel has one of three states:

StatusMeaning
subscribedThe person opted in to this channel.
unsubscribedThe person opted out of this channel. On WhatsApp this stops marketing: replies in a chat they start, utility templates and authentication codes still go.
null (unknown)Nothing has been recorded for this channel yet.

What happens when the status is unknown depends on the channel:

ChannelUnknown means
voiceAllowed
whatsappAllowed
emailNot allowed for marketing email
smsNot allowed

The contact's opted_out flag is a separate "do not contact" switch. When it is true, no channel is allowed, whatever the per-channel status says. Recording a channel status with this API doesn't change opted_out.

Each response includes can_contact for every channel, which applies all of these rules for you.

For marketing email, your workspace's email settings can also allow sending when consent is unknown. Transactional email (order and account updates sent with Send a transactional email) doesn't need consent, but is never sent to an address on your suppression list, for example after a hard bounce, a spam complaint or an unsubscribe.

Returns the consent state for all four channels, including channels with nothing recorded.

GET/api/v1/contacts/{contact_id}/consents

Headers#

NameRequiredDescription
X-API-KeyYesAn API key from your organization. See Authentication.

Path parameters#

NameTypeRequiredDescription
contact_idintegerYesThe contact's id, from List contacts or an upsert response.

Example request:

cURL

cURL
curl https://app.lemuai.com/api/v1/contacts/901/consents \
  -H "X-API-Key: lemu_your_api_key"

JavaScript

JavaScript
const res = await fetch("https://app.lemuai.com/api/v1/contacts/901/consents", {
  method: "GET",
  headers: {
    "X-API-Key": process.env.LEMU_API_KEY,
  },
});
if (!res.ok) throw new Error(`LemuAI API ${res.status}: ${await res.text()}`);
const data = await res.json();
console.log(data);

Python

Python
import os
 
import requests
 
response = requests.get(
    "https://app.lemuai.com/api/v1/contacts/901/consents",
    headers={
        "X-API-Key": os.environ["LEMU_API_KEY"],
    },
    timeout=30,
)
response.raise_for_status()
print(response.json())

Response#

200

JSON
{
  "contact_id": 901,
  "opted_out": false,
  "consents": [
    {
      "channel": "email",
      "status": "subscribed",
      "source": "signup_form",
      "source_detail": { "form": "footer-newsletter" },
      "updated_at": "2026-10-20T08:12:44Z",
      "can_contact": true
    },
    {
      "channel": "sms",
      "status": null,
      "source": null,
      "source_detail": {},
      "updated_at": null,
      "can_contact": false
    },
    {
      "channel": "whatsapp",
      "status": "unsubscribed",
      "source": "manual",
      "source_detail": {},
      "updated_at": "2026-10-22T11:03:10Z",
      "can_contact": false
    },
    {
      "channel": "voice",
      "status": null,
      "source": null,
      "source_detail": {},
      "updated_at": null,
      "can_contact": true
    }
  ]
}
FieldTypeDescription
contact_idintegerThe contact.
opted_outbooleanThe contact's "do not contact" switch. When true, can_contact is false for every channel.
consentsarrayOne entry per channel: email, sms, whatsapp and voice.
consents[].channelstringThe channel.
consents[].statusstring or nullsubscribed, unsubscribed, or null when nothing has been recorded.
consents[].sourcestring or nullWhere the latest status came from, as sent when it was recorded (for example manual, signup_form or checkout).
consents[].source_detailobjectAny extra details sent with the latest status.
consents[].updated_atstring or nullWhen the status was last recorded, in ISO 8601 (UTC).
consents[].can_contactbooleanWhether a message or call on this channel may go to this contact right now.

Sets the status for one channel. Every change is also kept in the contact's consent history.

PUT/api/v1/contacts/{contact_id}/consents/{channel}

Headers (record)#

NameRequiredDescription
X-API-KeyYesAn API key from your organization. See Authentication.
Content-TypeYesapplication/json

Path parameters (record)#

NameTypeRequiredDescription
contact_idintegerYesThe contact's id.
channelstringYesemail, sms, whatsapp or voice.

Request body#

FieldTypeRequiredDescription
statusstringYessubscribed or unsubscribed.
sourcestringNoWhere the decision came from, 1 to 64 characters, for example signup_form, checkout or support. Default manual.
source_detailobjectNoAny extra details you want kept with the decision, such as a form name or the text the person agreed to.

Example request:

cURL

cURL
curl -X PUT https://app.lemuai.com/api/v1/contacts/901/consents/whatsapp \
  -H "X-API-Key: lemu_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "status": "subscribed",
    "source": "checkout",
    "source_detail": { "order_id": "SO-10422", "checkbox": "Send me order updates on WhatsApp" }
  }'

JavaScript

JavaScript
const res = await fetch("https://app.lemuai.com/api/v1/contacts/901/consents/whatsapp", {
  method: "PUT",
  headers: {
    "X-API-Key": process.env.LEMU_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "status": "subscribed",
    "source": "checkout",
    "source_detail": {
      "order_id": "SO-10422",
      "checkbox": "Send me order updates on WhatsApp"
    }
  }),
});
if (!res.ok) throw new Error(`LemuAI API ${res.status}: ${await res.text()}`);
const data = await res.json();
console.log(data);

Python

Python
import os
 
import requests
 
response = requests.put(
    "https://app.lemuai.com/api/v1/contacts/901/consents/whatsapp",
    headers={
        "X-API-Key": os.environ["LEMU_API_KEY"],
    },
    json={
        "status": "subscribed",
        "source": "checkout",
        "source_detail": {
            "order_id": "SO-10422",
            "checkbox": "Send me order updates on WhatsApp",
        },
    },
    timeout=30,
)
response.raise_for_status()
print(response.json())

Response (record)#

200: the full consent state for the contact, in the same shape as Get a contact's consent.

Errors#

StatusWhen
401The API key is missing or not valid.
404No contact with this id in your organization.
422channel isn't one of the four channels, status isn't subscribed or unsubscribed, or source is empty or too long.

See Errors for the error format.

Contact Activity

Get everything one contact did, from every source, newest first

https://docs.lemuai.com/api-reference/contacts/activity

Returns a contact's activity timeline, newest first: events you sent, Shopify orders, website visits, message status changes, segment changes and custom record changes. It is the same timeline as the Activity tab on the contact's page.

The timeline covers the whole person:

  • events stored against contacts that were later merged into this one;
  • website visits made before the person was identified, through the visitor ids linked to the contact.

Setup required. Activity is read from the event store. If the event store isn't turned on for your workspace, the response has enabled: false and no events. Use List events in that case.

GET/api/v1/contacts/{contact_id}/activity

Headers#

NameRequiredDescription
X-API-KeyYesAn API key from your organization. See Authentication.

Path parameters#

NameTypeRequiredDescription
contact_idintegerYesThe contact's id, from List contacts or an upsert response.

Query parameters#

NameTypeRequiredDescription
limitintegerNoHow many events to return, 1 to 200. Default 50.
beforestringNoOnly return events before this time, in ISO 8601. To get the next page, pass the next_before value from the previous response.

Example request:

cURL

cURL
curl "https://app.lemuai.com/api/v1/contacts/901/activity?limit=20" \
  -H "X-API-Key: lemu_your_api_key"

JavaScript

JavaScript
const res = await fetch("https://app.lemuai.com/api/v1/contacts/901/activity?limit=20", {
  method: "GET",
  headers: {
    "X-API-Key": process.env.LEMU_API_KEY,
  },
});
if (!res.ok) throw new Error(`LemuAI API ${res.status}: ${await res.text()}`);
const data = await res.json();
console.log(data);

Python

Python
import os
 
import requests
 
response = requests.get(
    "https://app.lemuai.com/api/v1/contacts/901/activity?limit=20",
    headers={
        "X-API-Key": os.environ["LEMU_API_KEY"],
    },
    timeout=30,
)
response.raise_for_status()
print(response.json())

Response#

200

JSON
{
  "enabled": true,
  "events": [
    {
      "event_id": "3f6c2a9e-8d1b-5c7a-9e42-1b7d0c5a6f13",
      "event_type": "Purchase",
      "occurred_at": "2026-10-27T09:14:02.511000Z",
      "source": "api",
      "contact_id": 901,
      "anonymous_id": null,
      "properties": { "order_id": "SO-10422", "value": 2499, "currency": "INR" }
    },
    {
      "event_id": "a81d4c0e-27f3-4b0a-9a55-6c1e2f7b9d40",
      "event_type": "PageView",
      "occurred_at": "2026-10-27T09:02:40.118000Z",
      "source": "pixel",
      "contact_id": null,
      "anonymous_id": "6b1e2c4f-9a7d-4e3b-8c21-0f5d7a9e3b12",
      "properties": { "url": "https://shop.example.com/products/running-shoes" }
    }
  ],
  "next_before": null
}
FieldTypeDescription
enabledbooleanfalse when the event store isn't turned on. events is then empty.
eventsarrayThe events on this page, newest first.
events[].event_idstringThe event's unique id (UUID).
events[].event_typestringThe event name, for example Purchase, PageView or message_delivered. Events stored before Lemu switched to Meta's standard event names keep their older name, such as order_placed or page_viewed.
events[].occurred_atstringWhen it happened, in ISO 8601 (UTC).
events[].sourcestringWhere it came from: api, shopify, pixel, messaging, segments, records or backfill. See Event sources.
events[].contact_idinteger or nullThe contact the event was stored against: this contact or one merged into it. null for website activity from before the person was identified.
events[].anonymous_idstring or nullThe website or app visitor id, for events from a tracking source.
events[].propertiesobjectThe details of the event.
next_beforestring or nullPass this as before to get the next page. null on the last page.

Errors#

StatusWhen
401The API key is missing or not valid.
404No contact with this id in your organization.
503The event store couldn't be read right now. Try again shortly.

See Errors for the error format.

Contact Messages

List every message and call to or from one contact, on any channel, with delivery status

https://docs.lemuai.com/api-reference/contacts/messages

Returns every message sent to or received from a contact, newest first, on every channel: WhatsApp, email, SMS and voice calls. Each entry shows where the message is in its life (sent, delivered, read, failed) and what sent it.

GET/api/v1/contacts/{contact_id}/messages

Headers#

NameRequiredDescription
X-API-KeyYesAn API key from your organization. See Authentication.

Path parameters#

NameTypeRequiredDescription
contact_idintegerYesThe contact's id, from List contacts or an upsert response.

Query parameters#

NameTypeRequiredDescription
limitintegerNoHow many messages to return, 1 to 200. Default 50.
before_idintegerNoOnly return messages older than the message with this id. To get the next page, pass the next_before_id value from the previous response.

Example request:

cURL

cURL
curl "https://app.lemuai.com/api/v1/contacts/901/messages?limit=20" \
  -H "X-API-Key: lemu_your_api_key"

JavaScript

JavaScript
const res = await fetch("https://app.lemuai.com/api/v1/contacts/901/messages?limit=20", {
  method: "GET",
  headers: {
    "X-API-Key": process.env.LEMU_API_KEY,
  },
});
if (!res.ok) throw new Error(`LemuAI API ${res.status}: ${await res.text()}`);
const data = await res.json();
console.log(data);

Python

Python
import os
 
import requests
 
response = requests.get(
    "https://app.lemuai.com/api/v1/contacts/901/messages?limit=20",
    headers={
        "X-API-Key": os.environ["LEMU_API_KEY"],
    },
    timeout=30,
)
response.raise_for_status()
print(response.json())

Response#

200

JSON
{
  "messages": [
    {
      "id": 77120,
      "channel": "whatsapp",
      "direction": "outbound",
      "status": "read",
      "provider": "meta",
      "provider_status": "read",
      "template_name": "cart_reminder",
      "text": "Hi Priya, you left something in your cart. Complete your order here: https://le2.in/abc123",
      "source_type": "automation",
      "source_id": 3318,
      "workflow_run_id": null,
      "error": null,
      "meta": {},
      "created_at": "2026-10-27T10:14:05Z",
      "sent_at": "2026-10-27T10:14:06Z",
      "delivered_at": "2026-10-27T10:14:09Z",
      "read_at": "2026-10-27T10:20:31Z",
      "failed_at": null
    },
    {
      "id": 77064,
      "channel": "voice",
      "direction": "outbound",
      "status": "delivered",
      "provider": "plivo",
      "provider_status": "completed",
      "template_name": null,
      "source_type": "campaign",
      "source_id": 214,
      "workflow_run_id": 51290,
      "error": null,
      "meta": { "duration": 94 },
      "created_at": "2026-10-26T15:02:11Z",
      "sent_at": "2026-10-26T15:02:12Z",
      "delivered_at": "2026-10-26T15:02:20Z",
      "read_at": null,
      "failed_at": null
    }
  ],
  "next_before_id": null
}
FieldTypeDescription
messagesarrayThe messages on this page, newest first.
messages[].idintegerThe message's id.
messages[].channelstringwhatsapp, email, sms or voice. A call is one message on the voice channel.
messages[].directionstringoutbound (sent to the contact) or inbound (received from the contact).
messages[].statusstringWhere the message is now. See Message status.
messages[].providerstring or nullThe service that carried the message, for example the WhatsApp, email or telephony provider.
messages[].provider_statusstring or nullThe provider's own last status word, before LemuAI mapped it to status.
messages[].template_namestring or nullThe WhatsApp or email template used, if any.
messages[].textstring or nullThe message's text, up to 1,000 characters: what was written, or a template's filled-in text. null for calls and messages with no text.
messages[].source_typestring or nullWhat sent it: automation (a journey), campaign, voice_agent (an agent during a call), transactional (the transactional email API), inbox (a team member replying in the Inbox), manual (a call placed by hand or through the API), inbound_call, customer (a message the contact sent you) or test.
messages[].source_idinteger or nullThe id of what sent it, such as the journey run, the campaign or the call.
messages[].workflow_run_idinteger or nullThe call this message is (voice), or the call it was sent during (for example a WhatsApp message sent by an agent tool).
messages[].errorstring or nullWhy the message failed, when status is failed.
messages[].metaobjectExtra details about the message, for example a call's duration in seconds.
messages[].created_atstringWhen the message was created, in ISO 8601 (UTC).
messages[].sent_at, delivered_at, read_at, failed_atstring or nullWhen the message reached each status. null if it hasn't.
next_before_idinteger or nullPass this as before_id to get the next page. null on the last page.

Message status#

Outbound messages move forward through these statuses, or end as failed:

StatusMeaning
queuedWaiting to be sent.
sentHanded to the provider.
deliveredReached the person. For a call, the call was answered.
readThe person opened it. For email, the email was opened.
clickedFor email, the person clicked a tracked link.
failedIt couldn't be sent or delivered. See error.
receivedAn inbound message from the contact.

Errors#

StatusWhen
401The API key is missing or not valid.
404No contact with this id in your organization.
422limit is outside 1 to 200, or before_id isn't a number.

See Errors for the error format.

Overview

Send custom records such as orders, subscriptions or bookings from your system to Lemu AI

https://docs.lemuai.com/api-reference/records/overview

Custom records hold data about your contacts that doesn't fit on the contact itself, such as orders, subscriptions, bookings or policies. You define each record type and its fields in the dashboard under Records. See Custom Records for how to set one up and how journeys, segments and messages use records.

The records API keeps those records in step with your own system:

MethodEndpointPurpose
PUT/objects/{api_name}/records/{key}Create or update one record
POST/objects/{api_name}/records/batchCreate or update up to 1,000 records in one request

Creating record types, changing their fields, importing CSV files and deleting records are done in the dashboard.

Key ideas#

TermMeaning
api_nameThe record type's API name, for example subscription. It is made from the record type's name when you create it, in lower case with underscores.
Record keyThe value that identifies a record within its type, for example a subscription id. Sending the same key again updates that record instead of creating a new one.
OwnerThe contact a record belongs to. Every record of a normal record type has one owner. A catalog (such as products) has no owner.
dataThe record's fields, as an object of field name and value. Only fields defined on the record type are accepted.

How updates work#

Records are merged, not replaced:

  • fields you send replace the stored value;
  • fields you don't send keep their stored value;
  • a field sent as null or an empty string is cleared.

Each change records an object_created or object_updated event on the owner's timeline (source records), so journeys and segments can react to it. Personal fields aren't copied into the event.

Field values#

Field typeSend
TextA string, up to 2,000 characters.
NumberA number, or a string that is a number.
True or falsetrue or false (also "yes", "no", "1", "0").
DateA date, for example "2026-11-30".
Date and timeAn ISO 8601 date and time, for example "2026-11-30T18:00:00Z".
ChoiceOne of the field's options. Upper and lower case are ignored.
LinkAn http or https link, up to 2,000 characters.

A record can be at most 16 KB once saved. Fields marked as required must have a value.

Fields marked as personal are partly hidden (•••) in the dashboard for team members without permission to view personal data. API keys always see the full values.

Plan limits#

Your plan sets how many record types and records your organization can store. A request that would create more records than your plan allows returns 402.

Create or Update a Record

Create or update one custom record by its key, and set the contact it belongs to

https://docs.lemuai.com/api-reference/records/upsert

Creates a record, or updates it if a record with the same key already exists. Fields you send replace the stored values, fields you don't send are kept, and null clears a field. See how updates work.

PUT/api/v1/objects/{api_name}/records/{key}

Headers#

NameRequiredDescription
X-API-KeyYesAn API key from your organization. See Authentication.
Content-TypeYesapplication/json

Path parameters#

NameTypeRequiredDescription
api_namestringYesThe record type's API name, for example subscription.
keystringYesThe record's key, for example SUB-1042. If data also contains the key field, it must have the same value.

Request body#

FieldTypeRequiredDescription
dataobjectNoThe record's fields, as field name and value. Only fields defined on the record type are accepted. See field values.
phonestringNoThe owner's phone number in international format.
emailstringNoThe owner's email address.
external_idstringNoYour own id for the owner.
shopify_customer_idstringNoThe owner's Shopify customer id.
contact_idintegerNoThe owner's Lemu AI contact id. If that contact was merged into another, the record goes to the contact it was merged into.

Choosing the owner#

Records of a normal record type belong to one contact. A catalog has no owner, so these fields are ignored for it.

  1. If you send contact_id, that contact is the owner.
  2. Otherwise, if you send phone, email, external_id or shopify_customer_id, Lemu AI finds the contact the same way as Send an event. A new contact (tagged record) is only created from a phone or email.
  3. If you send no owner fields and the record already exists, it keeps its owner.
  4. A new record with no owner fields is rejected.

Sending a different owner for an existing record moves the record to that contact.

Example request:

cURL

cURL
curl -X PUT https://app.lemuai.com/api/v1/objects/subscription/records/SUB-1042 \
  -H "X-API-Key: lemu_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "priya@example.com",
    "data": {
      "plan": "Gold",
      "status": "active",
      "renews_on": "2026-11-30",
      "monthly_amount": 499
    }
  }'

JavaScript

JavaScript
const res = await fetch("https://app.lemuai.com/api/v1/objects/subscription/records/SUB-1042", {
  method: "PUT",
  headers: {
    "X-API-Key": process.env.LEMU_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "email": "priya@example.com",
    "data": {
      "plan": "Gold",
      "status": "active",
      "renews_on": "2026-11-30",
      "monthly_amount": 499
    }
  }),
});
if (!res.ok) throw new Error(`LemuAI API ${res.status}: ${await res.text()}`);
const data = await res.json();
console.log(data);

Python

Python
import os
 
import requests
 
response = requests.put(
    "https://app.lemuai.com/api/v1/objects/subscription/records/SUB-1042",
    headers={
        "X-API-Key": os.environ["LEMU_API_KEY"],
    },
    json={
        "email": "priya@example.com",
        "data": {
            "plan": "Gold",
            "status": "active",
            "renews_on": "2026-11-30",
            "monthly_amount": 499,
        },
    },
    timeout=30,
)
response.raise_for_status()
print(response.json())

Response#

200

JSON
{
  "status": "created",
  "record": {
    "id": 18342,
    "key": "SUB-1042",
    "contact_id": 901,
    "data": {
      "subscription_id": "SUB-1042",
      "plan": "Gold",
      "status": "active",
      "renews_on": "2026-11-30",
      "monthly_amount": 499
    },
    "created_at": "2026-10-27T09:30:12Z",
    "updated_at": "2026-10-27T09:30:12Z",
    "deleted_at": null
  }
}
FieldTypeDescription
statusstringcreated (new record, or a deleted one brought back), updated (a field or the owner changed) or unchanged (nothing changed).
record.idintegerThe record's id in Lemu AI.
record.keystringThe record's key.
record.contact_idinteger or nullThe owner. null for catalog records.
record.dataobjectAll of the record's fields after the update, including the key field.
record.created_at, record.updated_atstringTimestamps, in ISO 8601 (UTC).
record.deleted_atstring or nullWhen the record was deleted. Always null here.

Errors#

StatusWhen
400There's no record type with this api_name, the record type is archived, the record has no owner, no contact matches the owner, a new owner contact couldn't be created because your plan's contact limit is reached, a field is unknown or has a value of the wrong type, a required field is missing, the key in data doesn't match the path, or the record is larger than 16 KB. detail lists every problem.
401The API key is missing or not valid.
402Creating the record would take your organization over its plan's record limit.
422The body isn't valid JSON, or an owner field is too long.

See Errors for the error format.

Create or Update Records in Bulk

Create or update up to 1,000 custom records of one record type in a single request

https://docs.lemuai.com/api-reference/records/batch

Creates or updates up to 1,000 records of one record type. Each record works the same way as Create or update a record, and each one succeeds or fails on its own, so one bad row doesn't stop the rest.

POST/api/v1/objects/{api_name}/records/batch

Headers#

NameRequiredDescription
X-API-KeyYesAn API key from your organization. See Authentication.
Content-TypeYesapplication/json

Path parameters#

NameTypeRequiredDescription
api_namestringYesThe record type's API name, for example subscription.

Request body#

FieldTypeRequiredDescription
recordsarrayYesBetween 1 and 1,000 records. Each one accepts the fields below.

Each record:

FieldTypeDescription
keystringThe record's key. If you leave it out, the value of the key field in data is used.
dataobjectThe record's fields. See field values.
phone, email, external_id, shopify_customer_id, contact_idThe owner, as in Choosing the owner. Needed for a new record of a normal record type.

If the same key appears more than once in one request, the last one is saved and the earlier ones are reported as errors.

Example request:

cURL

cURL
curl -X POST https://app.lemuai.com/api/v1/objects/subscription/records/batch \
  -H "X-API-Key: lemu_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "records": [
      {
        "key": "SUB-1042",
        "email": "priya@example.com",
        "data": { "plan": "Gold", "status": "active", "renews_on": "2026-11-30" }
      },
      {
        "phone": "+919812345678",
        "data": { "subscription_id": "SUB-1043", "plan": "Silver", "status": "paused" }
      },
      {
        "key": "SUB-1044",
        "data": { "plan": "Platinum" }
      }
    ]
  }'

JavaScript

JavaScript
const res = await fetch("https://app.lemuai.com/api/v1/objects/subscription/records/batch", {
  method: "POST",
  headers: {
    "X-API-Key": process.env.LEMU_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "records": [
      {
        "key": "SUB-1042",
        "email": "priya@example.com",
        "data": {
          "plan": "Gold",
          "status": "active",
          "renews_on": "2026-11-30"
        }
      },
      {
        "phone": "+919812345678",
        "data": {
          "subscription_id": "SUB-1043",
          "plan": "Silver",
          "status": "paused"
        }
      },
      {
        "key": "SUB-1044",
        "data": {
          "plan": "Platinum"
        }
      }
    ]
  }),
});
if (!res.ok) throw new Error(`LemuAI API ${res.status}: ${await res.text()}`);
const data = await res.json();
console.log(data);

Python

Python
import os
 
import requests
 
response = requests.post(
    "https://app.lemuai.com/api/v1/objects/subscription/records/batch",
    headers={
        "X-API-Key": os.environ["LEMU_API_KEY"],
    },
    json={
        "records": [
            {
                "key": "SUB-1042",
                "email": "priya@example.com",
                "data": {
                    "plan": "Gold",
                    "status": "active",
                    "renews_on": "2026-11-30",
                },
            },
            {
                "phone": "+919812345678",
                "data": {
                    "subscription_id": "SUB-1043",
                    "plan": "Silver",
                    "status": "paused",
                },
            },
            {
                "key": "SUB-1044",
                "data": {
                    "plan": "Platinum",
                },
            },
        ],
    },
    timeout=30,
)
response.raise_for_status()
print(response.json())

Response#

200: the request was processed. Check each result to see which records were saved.

JSON
{
  "results": [
    { "key": "SUB-1042", "status": "updated", "record_id": 18342, "contact_id": 901 },
    { "key": "SUB-1043", "status": "created", "record_id": 18343, "contact_id": 1207 },
    {
      "key": "SUB-1044",
      "status": "error",
      "error": "A new record needs its owner: phone, email, external_id, shopify_customer_id or contact_id"
    }
  ],
  "counts": { "updated": 1, "created": 1, "error": 1 }
}
FieldTypeDescription
resultsarrayOne entry per record you sent, in the same order.
results[].keystringThe record's key. Missing when the row had no key at all.
results[].statusstringcreated, updated, unchanged or error.
results[].record_idintegerThe record's id. Not included for rows with an error.
results[].contact_idintegerThe record's owner. Not included for catalog records or rows with an error.
results[].errorstringWhy the row failed. Only included when status is error.
countsobjectHow many rows ended with each status.

Errors#

These apply to the whole request. Problems with a single record are reported in results instead.

StatusWhen
400There's no record type with this api_name, or the record type is archived.
401The API key is missing or not valid.
402The new records would take your organization over its plan's record limit. Nothing is saved.
422records is missing, empty or has more than 1,000 items, or a field has the wrong type.

See Errors for the error format.

Send a Transactional Email

Send an order, shipping or account email to one person from a saved email template

https://docs.lemuai.com/api-reference/email/send

Sends one transactional email, such as an order confirmation, a shipping update or a password reset, from an email template you built in the dashboard. Values you send in data fill the template's merge tags.

Use this only for messages the person needs. Marketing email (offers, newsletters, reminders to buy) goes through email campaigns and journeys, which check consent and add an unsubscribe link.

Setup required. Before you can send, your account needs:

  • LemuAI's email service turned on. Contact hello@lemuai.com to enable it.
  • A verified sending domain and at least one sender. See Email Setup.
  • A saved template. Transactional templates are best marked as transactional in the editor.
POST/api/v1/email/send

Headers#

NameRequiredDescription
X-API-KeyYesAn API key from your organization. See Authentication.
Content-TypeYesapplication/json

Request body#

FieldTypeRequiredDescription
template_idintegerYesThe template to send. It is the number at the end of the template's address when you open it in the dashboard, for example /email/templates/42.
tostringYesThe recipient's email address, 3 to 320 characters.
dataobjectNoValues for the template's merge tags, such as order id, items or total. See below.
sender_idintegerNoThe sender (From name and address) to use. Default: your default sender from Email Setup.
template_versionintegerNoA saved version of the template to send. Default: the latest saved version.
subjectstringNoA subject line to use instead of the template's, up to 998 characters. Merge tags work here too.

What the template can use#

Merge tagFilled with
{{ event.order_id }} or {{ data.order_id }}A value from the data you sent. Both names work, so templates built for journeys with event.* tags can be reused here.
{{ contact.first_name }}, {{ contact.custom.plan }}The contact whose email is to, if there is one. Empty if no contact has that address.
{{ organization.name }}, {{ organization.address }}Your organization's name and postal address.

Use | default("there") for values that may be missing, and | money("INR") to format prices. See Personalize with merge tags.

Example request:

cURL

cURL
curl -X POST https://app.lemuai.com/api/v1/email/send \
  -H "X-API-Key: lemu_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "template_id": 42,
    "to": "priya@example.com",
    "data": {
      "order_id": "SO-10422",
      "total": 2499,
      "items": [
        { "title": "Running shoes", "quantity": 1, "price": 2499 }
      ],
      "tracking_url": "https://track.example.com/SO-10422"
    }
  }'

JavaScript

JavaScript
const res = await fetch("https://app.lemuai.com/api/v1/email/send", {
  method: "POST",
  headers: {
    "X-API-Key": process.env.LEMU_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "template_id": 42,
    "to": "priya@example.com",
    "data": {
      "order_id": "SO-10422",
      "total": 2499,
      "items": [
        {
          "title": "Running shoes",
          "quantity": 1,
          "price": 2499
        }
      ],
      "tracking_url": "https://track.example.com/SO-10422"
    }
  }),
});
if (!res.ok) throw new Error(`LemuAI API ${res.status}: ${await res.text()}`);
const data = await res.json();
console.log(data);

Python

Python
import os
 
import requests
 
response = requests.post(
    "https://app.lemuai.com/api/v1/email/send",
    headers={
        "X-API-Key": os.environ["LEMU_API_KEY"],
    },
    json={
        "template_id": 42,
        "to": "priya@example.com",
        "data": {
            "order_id": "SO-10422",
            "total": 2499,
            "items": [
                {
                    "title": "Running shoes",
                    "quantity": 1,
                    "price": 2499,
                },
            ],
            "tracking_url": "https://track.example.com/SO-10422",
        },
    },
    timeout=30,
)
response.raise_for_status()
print(response.json())

Response#

200: the email was handed to the sending service.

JSON
{
  "message_id": 77341,
  "provider_message_id": "0109019a2c5e1f4b-6f1d8c2a-9b7e-4f3a-8d21-5e0c7b9a1d34-000000"
}
FieldTypeDescription
message_idintegerThe message's id in LemuAI. Its delivery status (delivered, opened, clicked, bounced) appears in the contact's messages when to belongs to a contact.
provider_message_idstringThe sending service's id for the email.

Transactional email doesn't need the person's email consent, and it is sent even when your marketing email is paused. It is still never sent to an address on your suppression list (for example after a hard bounce, a spam complaint or an unsubscribe). Those requests return 422 with skipped set to suppressed.

Errors#

StatusWhen
400The template has never been saved, you have no sender (add one in Email Setup), or to isn't a valid email address.
401The API key is missing or not valid.
404No template with this template_id in your organization.
422Nothing was sent. detail.skipped says why: domain_not_verified (the sender's domain isn't verified), suppressed (the address is on your suppression list), render_failed (a merge tag couldn't be filled, see detail.message) or no_address. Also returned when a field is missing or has the wrong type.
502The sending service refused the email. It is logged as failed.

See Errors for the error format.

Send a WhatsApp Template

Send an approved WhatsApp template to one phone number from your own system, with values for its variables

https://docs.lemuai.com/api-reference/whatsapp/send-template

Sends one approved WhatsApp template to one phone number from your own system, for example an order update, a payment reminder or a login code. You say which template to send, the number to send it to, and the values for the template's variables. It works like the "send template message" API of WATI, Interakt or AiSensy.

Any approved template can be sent: marketing, utility and authentication. To send to a list of people at once, use a broadcast or a journey in the dashboard instead.

Setup required. Before you can send, your workspace needs:

  • WhatsApp connected under WhatsApp → Setup, with at least one number under WhatsApp → Numbers.
  • An approved template under WhatsApp → Templates.
  • Money in your WhatsApp balance. Recharge under Usage & Plan → Usage & balances.
  • An API key from Settings → API Keys. See Authentication.
POST/api/v1/whatsapp/messages/template

Headers#

NameRequiredDescription
X-API-KeyYesAn API key from your workspace. See Authentication.
Content-TypeYesapplication/json

Request body#

Name the template with template_id, or with template_name and language.

FieldTypeRequiredDescription
tostringYesThe number to send to, with its country code: +919876543210 or 919876543210. Spaces and dashes are fine. A 10-digit number without a country code is refused.
template_idintegerOne of template_id or template_nameLemuAI's id for the template, a number such as 44. Open WhatsApp → Templates and click the template: its side panel shows Template ID with a copy button. It is not the Meta template ID shown next to it.
template_namestringOne of template_id or template_nameThe template's name exactly as shown under WhatsApp → Templates, for example order_shipped.
languagestringWith template_name, when the template has more than one languageThe template's language code, for example en, en_US or hi. en also finds en_US when that is the template's only English version. Ignored with template_id, which already points at one language.
variablesobjectWhen the template has variablesThe values for the template's variables, as text or numbers. See Variables. Up to 100 entries.
header_textstringWhen the template's text header has a variableThe value for the header's variable, up to 60 characters. Templates with named variables can give it in variables instead.
header_media_urlstringWhen the template's header is an image, video or documentA public https:// link to the file. WhatsApp downloads it when it sends the message.
header_filenamestringNoThe file name WhatsApp shows for a document header, for example Invoice-10422.pdf. Default: the file name the link ends in, when it ends in one (…/Invoice-10422.pdf).
button_url_valuestringWhen a link button's address ends with a variableThe part that goes in place of the variable. For a button to https://shop.example.com/track/{{1}}, send SO-10422. For a button made with Count clicks on this button, send the whole page address to open; see Link Click Tracking.
coupon_codestringWhen the template has a copy-code buttonThe code the button copies, up to 15 characters.
product_retailer_idsarray of stringsFor a multi-product templateThe content IDs (SKUs) of the products to show, from your WhatsApp catalog. Up to 30.
thumbnail_product_retailer_idstringNoFor a catalog template: the content ID (SKU) of the product whose photo shows on the message.
fromstringNoWhich of your WhatsApp numbers sends the message, as shown under WhatsApp → Numbers (for example +91 98111 12222). Default: your default number.
referencestringNoYour own id for this message, up to 100 characters, for example your order id. It comes back in the response and in Get a WhatsApp Message.

A field that isn't in this table is refused with 422, so a typo in a field name doesn't go unnoticed.

Variables#

variables holds one value for each variable in the template's header and body. The keys depend on how the template was written:

The template's variables look likeSend
{{1}}, {{2}} (positional){"1": "Priya", "2": "SO-10422"}
{{first_name}}, {{order_id}} (named){"first_name": "Priya", "order_id": "SO-10422"}
An authentication template (login or verification code)The code: {"1": "482913"}, up to 15 characters. It fills the message and the template's copy-code or autofill button.
  • Every variable needs a value. If one is missing, nothing is sent and the error lists the keys to send.
  • "1" and "{{1}}" both work as keys. Numbers are sent as text: 2499 becomes 2499.
  • WhatsApp doesn't allow a new line, a tab or more than four spaces in a row inside a value. Such a value is refused before sending.
  • A text header with a variable takes its value from header_text. In a template with positional variables, the header's {{1}} is separate from the body's {{1}}.
  • Keys the template doesn't use are ignored.

Example request: the template order_shipped has the header "Order {{1}}", the body "Hi {{1}}, your order {{2}} is on its way." and a Track button that opens https://shop.example.com/track/{{1}}.

cURL

cURL
curl -X POST https://app.lemuai.com/api/v1/whatsapp/messages/template \
  -H "X-API-Key: lemu_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "+919876543210",
    "template_id": 44,
    "variables": { "1": "Priya", "2": "SO-10422" },
    "header_text": "SO-10422",
    "button_url_value": "SO-10422",
    "reference": "order-10422"
  }'

JavaScript

JavaScript
const res = await fetch("https://app.lemuai.com/api/v1/whatsapp/messages/template", {
  method: "POST",
  headers: {
    "X-API-Key": process.env.LEMU_API_KEY,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    to: "+919876543210",
    template_id: 44,
    variables: { 1: "Priya", 2: "SO-10422" },
    header_text: "SO-10422",
    button_url_value: "SO-10422",
    reference: "order-10422",
  }),
});
if (!res.ok) throw new Error(`LemuAI API ${res.status}: ${await res.text()}`);
const data = await res.json();
console.log(data.message_id);

Python

Python
import os
 
import requests
 
response = requests.post(
    "https://app.lemuai.com/api/v1/whatsapp/messages/template",
    headers={
        "X-API-Key": os.environ["LEMU_API_KEY"],
    },
    json={
        "to": "+919876543210",
        "template_id": 44,
        "variables": {"1": "Priya", "2": "SO-10422"},
        "header_text": "SO-10422",
        "button_url_value": "SO-10422",
        "reference": "order-10422",
    },
    timeout=30,
)
response.raise_for_status()
print(response.json()["message_id"])

More examples of the body:

JSON
{
  "to": "919876543210",
  "template_name": "plan_renewal",
  "language": "en",
  "variables": { "first_name": "Priya", "plan": "Growth" }
}
JSON
{
  "to": "+919876543210",
  "template_name": "invoice_ready",
  "language": "en",
  "variables": { "1": "INV-10422" },
  "header_media_url": "https://files.example.com/invoices/INV-10422.pdf",
  "header_filename": "Invoice-10422.pdf",
  "from": "+91 98111 13333"
}
JSON
{
  "to": "+919876543210",
  "template_name": "login_code",
  "language": "en",
  "variables": { "1": "482913" }
}

Response#

200: WhatsApp accepted the message.

JSON
{
  "message_id": 90311,
  "provider_message_id": "wamid.HBgMOTE5ODc2NTQzMjEwFQIAERgSNkQ5QjE0RjU2QzM0RTI3QjdBAA==",
  "status": "sent",
  "to": "+919876543210",
  "contact_id": 5821,
  "template": {
    "id": 44,
    "name": "order_shipped",
    "language": "en",
    "category": "utility"
  },
  "reference": "order-10422"
}
FieldTypeDescription
message_idintegerThe message's id in LemuAI. Pass it to Get a WhatsApp Message to see whether it was delivered and read.
provider_message_idstringWhatsApp's id for the message (wamid…). Get a WhatsApp Message accepts it too.
statusstringAlways sent here: WhatsApp accepted the message. Delivered, read or failed comes later.
tostringThe number it was sent to, in + and digits form.
contact_idintegerThe contact the message belongs to. A contact is created when no contact has this number yet.
templateobjectThe template that was sent: id, name, language and category (marketing, utility or authentication).
referencestring or nullThe reference you sent.

What happens with the message#

  • Cost: each message is paid from your WhatsApp balance at WhatsApp's rate for the template's category and the recipient's country. A message WhatsApp refuses is refunded.
  • Inbox and contact: the message shows in the contact's conversation in the Inbox, labelled API, and in the contact's messages. When the person replies, the reply lands in the same conversation and opens WhatsApp's 24-hour window, like any other reply.
  • Delivery: sent means WhatsApp accepted it. Whether it was delivered or read, or why it failed, shows a few seconds later in Get a WhatsApp Message, in the Inbox and in Contact Messages.
  • Opt-out: a contact who opted out of all messages is never sent anything, and a marketing template isn't sent to a contact who stopped WhatsApp marketing (STOP, Stop promotions or Stop marketing in WhatsApp). Utility and authentication templates still go. The request returns 422 with opted_out.
  • Sending limits: the per-channel limits under Settings → Sending Limits apply to journeys and campaigns, not to this API. Your system decides how often a person gets a message.
  • Marketing templates: WhatsApp limits how many marketing messages one person gets from all businesses. When it holds one back, the message's status becomes failed with WhatsApp's reason.

Errors#

Nothing is charged or sent when the request has a problem. The body is:

JSON
{
  "detail": {
    "error": "missing_values",
    "message": "Missing a value for {{2}}. Send variables: {\"2\": \"...\"}.",
    "missing": ["2"],
    "variables": ["1", "2"]
  }
}

error is a fixed word your code can check. message is a sentence that says what to change. missing_values also lists the missing keys and every key the template takes in variables.

Statusdetail.errorWhen
400whatsapp_not_readyWhatsApp isn't connected, setup isn't finished, payment setup with Meta is still pending, Meta restricted the account, or marketing messages are paused on the sending number. detail.message says which.
400template_not_approvedThe template is pending, rejected, paused or disabled. detail.template_status holds its status.
401The API key is missing or not valid.
402balance_too_lowThe WhatsApp balance is too low. Recharge under Usage & Plan → Usage & balances.
404template_not_foundNo template with this template_id in your workspace, no template with this name on the sending number's WhatsApp account, or no version in this language (detail.languages lists the template's languages).
422template_requiredNeither template_id nor template_name was sent.
422language_requiredtemplate_name matches the template in more than one language. Send language.
422missing_valuesA variable, the header value, header_media_url, button_url_value, coupon_code or product_retailer_ids is missing.
422invalid_valuesA value has a new line, a tab or more than four spaces in a row, is too long, or isn't text or a number, or a click-counting button got something other than a full https:// address.
422invalid_numberto isn't a phone number, or has no country code.
422unknown_from_numberfrom isn't one of your numbers under WhatsApp → Numbers.
422opted_outThe contact opted out of all messages, or stopped WhatsApp marketing and this is a marketing template.
422A field is missing, has the wrong type, or isn't a field of this endpoint. detail is then a list of the fields to fix.
502send_failedWhatsApp refused the message when it was sent. detail.message holds WhatsApp's reason. It shows as failed in the Inbox and is refunded. A number without WhatsApp is usually accepted first and then turns failed in Get a WhatsApp Message.

See Errors for the general error format.

Get a WhatsApp Message

See whether a WhatsApp message was delivered and read, or why it failed

https://docs.lemuai.com/api-reference/whatsapp/get-message

Returns one WhatsApp message with its status: sent, delivered, read or failed, with the time of each step and WhatsApp's reason when it failed. Use it after Send a WhatsApp Template to check that the message reached the person.

It works for any WhatsApp message of your workspace, including ones sent by journeys, broadcasts or the Inbox, and replies people sent you.

GET/api/v1/whatsapp/messages/{message_id}

Headers#

NameRequiredDescription
X-API-KeyYesAn API key from your workspace. See Authentication.

Path parameters#

NameTypeDescription
message_idstringThe message_id that Send a WhatsApp Template returned (a number, for example 90311), or WhatsApp's id for the message (provider_message_id, starting with wamid.).

Example request:

cURL

cURL
curl https://app.lemuai.com/api/v1/whatsapp/messages/90311 \
  -H "X-API-Key: lemu_your_api_key"

JavaScript

JavaScript
const res = await fetch("https://app.lemuai.com/api/v1/whatsapp/messages/90311", {
  headers: { "X-API-Key": process.env.LEMU_API_KEY },
});
if (!res.ok) throw new Error(`LemuAI API ${res.status}: ${await res.text()}`);
const message = await res.json();
console.log(message.status);

Python

Python
import os
 
import requests
 
response = requests.get(
    "https://app.lemuai.com/api/v1/whatsapp/messages/90311",
    headers={"X-API-Key": os.environ["LEMU_API_KEY"]},
    timeout=30,
)
response.raise_for_status()
print(response.json()["status"])

Response#

200

JSON
{
  "message_id": 90311,
  "provider_message_id": "wamid.HBgMOTE5ODc2NTQzMjEwFQIAERgSNkQ5QjE0RjU2QzM0RTI3QjdBAA==",
  "direction": "outbound",
  "status": "read",
  "to": "+919876543210",
  "contact_id": 5821,
  "template_name": "order_shipped",
  "source": "api",
  "reference": "order-10422",
  "error": null,
  "text": "Order SO-10422\n\nHi Priya, your order SO-10422 is on its way.\n\n▸ Track",
  "created_at": "2026-12-04T10:15:02.118Z",
  "sent_at": "2026-12-04T10:15:02.118Z",
  "delivered_at": "2026-12-04T10:15:04.530Z",
  "read_at": "2026-12-04T10:16:41.002Z",
  "clicked_at": null,
  "failed_at": null
}
FieldTypeDescription
message_idintegerThe message's id in LemuAI.
provider_message_idstring or nullWhatsApp's id for the message.
directionstringoutbound for a message you sent, inbound for one the person sent you.
statusstringWhere the message is now. See the table below.
tostring or nullThe number it was sent to. Null for an inbound message.
contact_idinteger or nullThe contact the message belongs to.
template_namestring or nullThe template's name, for a template message.
sourcestring or nullWhat sent it: api for this API, automation for a journey, broadcast, inbox for your team, ai_assistant and others.
referencestring or nullThe reference sent with Send a WhatsApp Template.
errorstring or nullWhy the message failed, as WhatsApp gave it.
textstring or nullWhat the person sees: the template's text with its values filled in, then its button labels. Up to 1,000 characters.
created_atstringWhen LemuAI recorded the message (ISO 8601, UTC).
sent_at, delivered_at, read_at, clicked_at, failed_atstring or nullWhen the message reached each step. Null for a step it hasn't reached.

Statuses#

statusMeaning
sentWhatsApp accepted the message.
deliveredIt reached the person's phone.
readThe person opened it. Only shows when the person has read receipts turned on in WhatsApp; otherwise it stays delivered.
clickedThe person opened a link in it that counts clicks.
failedWhatsApp couldn't deliver it. error says why, for example the number has no WhatsApp account or WhatsApp held back a marketing message. A failed template message is refunded.
receivedA message the person sent you.

Statuses only move forward: a message that was read doesn't go back to delivered. WhatsApp usually reports delivery within seconds, but a phone that is off reports it when it comes back online. If you check in a loop, wait at least 30 seconds between checks.

Errors#

StatusWhen
401The API key is missing or not valid.
404No WhatsApp message with this id in your workspace. detail.error is message_not_found.

See Errors for the error format.

Overview

Create and work LemuTickets tickets from your ERP or other systems with the LemuTickets REST API

https://docs.lemuai.com/tickets-api/overview

LemuTickets is the service desk in the Lemu family: complaints, requests, tasks and incidents become tickets with an owner, a status, a deadline and a full history. The app at tickets.lemuai.com is built on this same API, so anything your team does in the app, your own systems can do too.

This reference covers what an ERP or back-office system usually needs:

TaskEndpoint
Raise a ticket when something goes wrong in your systemCreate a ticket
Show a customer's tickets, or a queue, in your own screensList and search tickets with TQL
Read one ticket with its status, SLA and fieldsGet a ticket
Change the priority, assignee, labels or custom fieldsUpdate a ticket
Move a ticket through its workflow (start work, resolve, close)List available transitions and Transition a ticket
Reply to the customer or add an internal noteAdd a comment
Record time spentLog work
Keep customers in sync with your recordsRequesters and Accounts
Attach files, such as invoices or photosUpload an attachment
Hear about changes as they happenWebhooks
Show tickets inside your ERP without building screensEmbedding in your ERP

Setting up projects, workflows, SLAs, automations and teams is done in the LemuTickets app.

Base URL#

All requests go to:

Text
https://api.tickets.lemuai.com/v1

The version (v1) is part of the path. Changes within v1 only add things: new endpoints, new optional fields and new response fields. Write your code so it ignores response fields it does not know.

Authentication#

Send an API key in the Authorization header. Create keys in LemuTickets under Settings → API keys and webhooks. See Authentication for scopes and OAuth apps.

Your first request#

Find the key of the project you want to create tickets in:

cURL
curl https://api.tickets.lemuai.com/v1/projects \
  -H "Authorization: Bearer ltk_live_your_api_key"
JSON
{
  "data": [
    {
      "id": "3b0f6c1e-8a2d-4f5b-9c71-0e4d2a6b8f13",
      "key": "SUP",
      "name": "Customer Support",
      "open_tickets": 128
    }
  ]
}

The response above is shortened. Then create a ticket in that project:

cURL
curl -X POST https://api.tickets.lemuai.com/v1/tickets \
  -H "Authorization: Bearer ltk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: erp-complaint-58213" \
  -d '{
    "project": "SUP",
    "title": "Refund not received for order 58213",
    "priority": "p2",
    "requester": { "name": "Priya Sharma", "email": "priya@example.com" }
  }'

The response is the new ticket, with its key (for example SUP-1042). Use the key or the id in every other ticket endpoint.

Request and response format#

  • Send request bodies as JSON with Content-Type: application/json. The one exception is Upload an attachment, which takes a file as multipart/form-data.
  • Responses are JSON. Times are ISO 8601 in UTC, for example 2026-11-25T09:12:40.512000+00:00. Ids are UUIDs.
  • Lists return {"data": [...]}, and paged lists add next_cursor. See Conventions.
  • Errors always have the same shape. See Errors.
  • Every response has an X-Request-Id header. Include it when you contact support about a request.

Authentication

Authenticate LemuTickets API requests with a scoped API key or an OAuth app

https://docs.lemuai.com/tickets-api/authentication

There are two ways to call the LemuTickets API:

UseWhen
API keyYour own server talks to LemuTickets, for example your ERP syncing tickets. This is the usual choice.
OAuth appYou build an app that acts for a person who approves it (authorization code), or a server integration that should not use a long-lived key (client credentials).

Both are sent as a bearer token in the Authorization header.

API keys, client secrets and access tokens act on your organization's data. Keep them on your server. Never put them in a browser, a mobile app or a public repository. To show tickets in a browser, use an embed token instead.

API keys#

Create a key#

  1. In LemuTickets, open Settings → API keys and webhooks and stay on the API keys tab.
  2. Click Create key.
  3. Fill in the form:
    • Name: where the key is used, for example ERP sync.
    • Mode: Live keys start with ltk_live_, Test keys with ltk_test_. The mode only labels the key; both work on the same organization and data.
    • Scopes: pick a preset (Read only, Agent or Full access) or Custom to choose scopes one by one. See scopes below.
    • Projects: limit the key to some projects. Empty means every project.
    • Requests per minute: the key's rate limit. The default is 600.
    • Allowed IP addresses: single addresses or CIDR ranges the key may be used from. Empty means any address.
    • Expires: never, or on a date you choose.
  4. Copy the key. The full key is shown only once. Store it straight away in a secrets manager or an environment variable.

You need the api_keys.manage permission to see this page (organization owners and admins have it). You cannot give a key a scope you do not have yourself.

To stop a key working, revoke it on the same page. A revoked or expired key is rejected at once.

Send the key#

cURL
curl https://api.tickets.lemuai.com/v1/projects \
  -H "Authorization: Bearer ltk_live_your_api_key"

The X-API-Key: ltk_live_your_api_key header also works.

Who the key acts as#

Each key acts as its own user, named API: followed by the key's name (for example API: ERP sync). Tickets the key creates show this user as the reporter, and comments it writes show it as the author.

A key does not see restricted tickets unless they are shared with that user, and it only sees the projects you chose when you created it.

Scopes#

Scopes are the same permissions team members have. A request that needs a scope the key does not have fails with 403 and the code missing_capability.

ScopeAllows
tickets.readSee tickets in projects the key can access
tickets.writeCreate and edit tickets, comment, transition
tickets.deleteDelete and merge tickets
tickets.assignAssign tickets to others
tickets.bulkBulk update tickets
comments.internalRead and write internal notes
requesters.readSee requesters and accounts
requesters.writeCreate and edit requesters and accounts
pii.readSee unmasked phone numbers and emails
projects.readSee projects
projects.adminCreate projects, edit workflows, types and fields
config.adminSLAs, escalations, automations, assignment, calendars, macros
teams.adminManage teams, skills and shifts
integrations.adminConnect Slack, email, Lemu, Jira and other integrations
api_keys.manageCreate and revoke API keys and webhooks
reports.readSee reports and dashboards
audit.readSee and export the audit log
security.adminRoles, SSO, IP allowlist, retention, sandboxes
data.exportExport and import data
copilot.useUse the Copilot
approvals.decideApprove or reject approval requests
assets.readSee assets
assets.writeCreate and edit assets
field_service.dispatchSchedule and dispatch field visits
kb.writeWrite knowledge base articles

The presets give a key these scopes:

PresetScopes
Read onlytickets.read, requesters.read, projects.read, reports.read
Agenttickets.read, tickets.write, tickets.assign, tickets.bulk, comments.internal, requesters.read, requesters.write, pii.read, projects.read, reports.read, copilot.use, assets.read, assets.write, kb.write
Full accessEvery scope

Without pii.read, emails and phone numbers in responses are partly hidden, for example p•••@example.com and +91•••••••210.

OAuth apps#

Register an OAuth app when someone other than your own server needs access, or when you want short-lived tokens instead of a key.

Register an app#

  1. Open Settings → API keys and webhooks and select the OAuth apps tab.
  2. Click Register app and fill in App name, an optional Logo URL and Description, the Redirect URIs, and the scopes it can ask for.
  3. Leave Can keep a secret on for apps with a server. Turn it off for mobile or single-page apps: they get no client secret and must use PKCE.
  4. Copy the client ID (ltc_...) and, for apps that can keep a secret, the client secret (ltcs_...). The secret is shown only once.

Redirect URIs must match exactly and use https (http is allowed only for localhost).

Authorization code with PKCE#

Use this when your app acts for a LemuTickets user. The token can never do more than that user can do now, and only within the scopes they approved.

1. Send the user to the consent screen. Create a random code_verifier (43 to 128 characters) and its SHA-256 code_challenge (base64url, no padding), then open:

Text
https://tickets.lemuai.com/oauth/authorize
  ?response_type=code
  &client_id=ltc_your_client_id
  &redirect_uri=https://erp.example.com/oauth/callback
  &scope=tickets.read tickets.write
  &state=af0ifjsldkj
  &code_challenge=E9Melhoa2OwvFrEMTJguCHaoeK1t8URWbuGJSstw-cM
  &code_challenge_method=S256

The URL is split over lines here to make it easier to read; send it as one line with the values URL-encoded. PKCE with S256 is required for every app. scope is a space-separated list; leave it out to ask for all of the app's scopes. After the user approves, they return to your redirect_uri with code and your state. The code expires after 5 minutes and works once.

2. Exchange the code for tokens:

cURL
curl -X POST https://api.tickets.lemuai.com/v1/oauth/token \
  -u "ltc_your_client_id:ltcs_your_client_secret" \
  -d grant_type=authorization_code \
  -d code=ltac_code_from_the_redirect \
  -d redirect_uri=https://erp.example.com/oauth/callback \
  -d code_verifier=your_code_verifier

Apps without a secret send client_id in the body instead of -u, and no secret.

JSON
{
  "access_token": "lto_9kq2...",
  "token_type": "Bearer",
  "expires_in": 3600,
  "scope": "tickets.read tickets.write",
  "refresh_token": "ltr_X4b7..."
}

3. Call the API with Authorization: Bearer lto_.... Access tokens last 1 hour.

4. Refresh before the access token expires. Refresh tokens last 30 days and change every time you use one: store the new one each time. Using an old refresh token again ends the whole grant, and the user has to approve the app again.

cURL
curl -X POST https://api.tickets.lemuai.com/v1/oauth/token \
  -u "ltc_your_client_id:ltcs_your_client_secret" \
  -d grant_type=refresh_token \
  -d refresh_token=ltr_X4b7...

You can send a smaller scope when refreshing, but not a wider one.

Client credentials#

Use this for a server integration that acts for your organization, not for a person. It needs an app that can keep a secret.

cURL
curl -X POST https://api.tickets.lemuai.com/v1/oauth/token \
  -u "ltc_your_client_id:ltcs_your_client_secret" \
  -d grant_type=client_credentials \
  -d "scope=tickets.read tickets.write"

The response has an access_token that lasts 1 hour and no refresh token: ask for a new one when it expires. Leave out scope to get all of the app's scopes.

A client credentials token is not tied to a user, so endpoints that record a person need one in the request. For example, Log work needs user_id.

Token endpoint details#

Token URLPOST https://api.tickets.lemuai.com/v1/oauth/token
Revoke URLPOST https://api.tickets.lemuai.com/v1/oauth/revoke with token=...
Client authenticationHTTP Basic (client_secret_basic), or client_id and client_secret in the body (client_secret_post)
Body formatapplication/x-www-form-urlencoded or JSON
Server metadatahttps://api.tickets.lemuai.com/.well-known/oauth-authorization-server

Token endpoint errors use the OAuth format, not the API's usual error shape:

JSON
{
  "error": "invalid_grant",
  "error_description": "The code expired"
}
errorMeaning
invalid_clientUnknown client, wrong secret, or a secret sent for an app that has none (401)
invalid_grantThe code or refresh token is unknown, used, expired or revoked, or the PKCE check or redirect_uri does not match
invalid_scopeThe app may not ask for these scopes
unauthorized_clientClient credentials asked for by an app without a secret
unsupported_grant_typegrant_type is not authorization_code, refresh_token or client_credentials

Removing an app in Settings → API keys and webhooks revokes all of its tokens.

Authentication errors#

StatusCodeMeaning
401unauthenticatedNo key or token was sent
401invalid_api_keyThe key is wrong, revoked or expired
401invalid_tokenThe OAuth access token is wrong, revoked or expired, or the app was removed
403ip_not_allowedThe request came from an IP address the key, or your organization, does not allow
403missing_capabilityThe key or token does not have the scope this endpoint needs
JSON
{
  "error": {
    "type": "unauthorized",
    "code": "invalid_api_key",
    "message": "Invalid API key",
    "request_id": "4f1d9c2b7a6e4e0f8c3b1a2d5e6f7a8b"
  }
}

Conventions

Pagination, idempotency keys, ticket versions with If-Match, and rate limits in the LemuTickets API

https://docs.lemuai.com/tickets-api/conventions

These rules work the same way on every endpoint that uses them.

Pagination#

List endpoints that can return many items use cursors. Send limit to choose the page size, and pass the next_cursor from one response as cursor in the next request. Keep every other parameter the same.

cURL
curl -G https://api.tickets.lemuai.com/v1/tickets \
  -H "Authorization: Bearer ltk_live_your_api_key" \
  --data-urlencode "q=project = SUP ORDER BY created ASC" \
  --data-urlencode "limit=100"
JSON
{
  "data": [ ... ],
  "next_cursor": "eyJvIjogMTAwfQ",
  "total": null
}
FieldDescription
dataThe items on this page.
next_cursorPass it as cursor to get the next page. null on the last page.
totalOnly on List and search tickets: the number of matching tickets when you send with_total=true, otherwise null.

Treat the cursor as an opaque string. It is a position in the result list, so if tickets change while you page through them, a ticket can show up twice or move to a page you already read. For a full sync, sort by a field that does not change (ORDER BY created ASC) and de-duplicate by id.

Shorter lists (comments on a ticket, transitions, projects, webhooks) return everything at once as {"data": [...]}, without a cursor.

Idempotency keys#

Networks fail. If you send a request and get no answer, you cannot tell whether it worked. An idempotency key lets you send it again safely.

Add an Idempotency-Key header with a value that is unique to the action, for example your own record id:

cURL
curl -X POST https://api.tickets.lemuai.com/v1/tickets \
  -H "Authorization: Bearer ltk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: erp-complaint-58213" \
  -d '{ "project": "SUP", "title": "Refund not received for order 58213" }'
  • The first request runs normally and its response is saved.
  • A later request with the same key and the same body gets the saved response back, with the header Idempotent-Replayed: true. Nothing is created twice.
  • The same key with a different body fails with 409 and the code idempotency_mismatch.

Keys are kept per organization and per endpoint path for 24 hours. Keys can be up to 200 characters; a longer key fails with 422 and the code idempotency_key_too_long.

The Idempotency-Key header is honored by Create a ticket and Add a comment. Other endpoints ignore it.

Tickets have two more ways to avoid duplicates, which work without the header:

  • source_ref: if a ticket with the same source and source_ref already exists, creating it again returns the existing ticket with status 200 instead of 201.
  • external_id: must be unique. Creating a second ticket with the same external_id fails with 409 and the code duplicate_external_id.

Versions and If-Match#

Every ticket has a version number. It goes up every time the ticket changes, including when someone comments, logs work, transitions it, or an automation updates it. The current version is in the ticket's version field and in the ETag header of Get a ticket, Create a ticket and Update a ticket.

To make sure you do not overwrite someone else's change, send the version you last read in an If-Match header on Update a ticket and Transition a ticket:

cURL
curl -X PATCH https://api.tickets.lemuai.com/v1/tickets/SUP-1042 \
  -H "Authorization: Bearer ltk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -H "If-Match: 7" \
  -d '{ "priority": "p1" }'

If the ticket changed since then, nothing is saved and you get 412:

JSON
{
  "error": {
    "type": "precondition_failed",
    "code": "version_mismatch",
    "message": "The ticket changed since you loaded it",
    "request_id": "4f1d9c2b7a6e4e0f8c3b1a2d5e6f7a8b",
    "data": { "current_version": 8 }
  }
}

Get the ticket again, decide whether your change still makes sense, and retry with the new version. If-Match accepts the plain number (7) or the quoted forms ("7", W/"7"). Without If-Match, the change is applied to whatever is current.

Rate limits#

Each API key has its own limit per minute, set when the key is created (600 by default). OAuth tokens that act for a user share that user's limit of 1,200 requests per minute. The window slides, so a short burst does not lock you out for a full minute.

Responses carry the current state:

HeaderDescription
RateLimit-LimitRequests allowed per minute.
RateLimit-RemainingRequests left in the current window.

Over the limit, requests fail with 429. The Retry-After header and the error's data.retry_after both say how many seconds to wait:

JSON
{
  "error": {
    "type": "rate_limited",
    "code": "rate_limited",
    "message": "Too many requests. Try again in 12 seconds.",
    "request_id": "9a0b1c2d3e4f40a1b2c3d4e5f6a7b8c9",
    "data": { "retry_after": 12, "limit": 600, "window": 60 }
  }
}

If you need a higher limit for a key, create a new key with a higher Requests per minute value.

Request ids#

Every response has an X-Request-Id header, and every error repeats it as request_id. You can send your own X-Request-Id and it is used instead, which makes it easy to match your logs with ours.

Errors

The error shape, HTTP status codes and common error codes returned by the LemuTickets API

https://docs.lemuai.com/tickets-api/errors

Error format#

Every error from the LemuTickets API has the same shape:

JSON
{
  "error": {
    "type": "validation_error",
    "code": "invalid_fields",
    "message": "Some fields are invalid",
    "field_errors": {
      "title": "Field required",
      "requester.email": "Input should be a valid string"
    },
    "request_id": "4f1d9c2b7a6e4e0f8c3b1a2d5e6f7a8b"
  }
}
FieldDescription
typeThe kind of error. One type per HTTP status (see the table below).
codeA stable, specific reason, for example version_mismatch or duplicate_external_id. Use this in your code.
messageA plain-language description for people. It can change; do not match on it.
field_errorsOnly when specific fields are wrong: an object from field name to problem. Nested fields use dots, for example custom_fields.order_id.
dataOnly on some errors: extra details, such as current_version on a version conflict or retry_after on a rate limit.
request_idThe id of this request, also in the X-Request-Id header. Include it when you contact support.

The OAuth token endpoint is the one exception: it returns errors in the standard OAuth format.

Status codes#

StatustypeMeaning
401unauthorizedNo credentials, or the key or token is wrong, revoked or expired
403forbiddenThe credentials are valid but not allowed to do this
404not_foundThe id or key does not exist, or you are not allowed to see it
409conflictThe request clashes with something that already exists
412precondition_failedThe ticket changed since you read it (If-Match)
422validation_errorThe body or a parameter is invalid
429rate_limitedToo many requests; see rate limits
500Something went wrong on our side

A ticket in a project you cannot access returns 404, not 403, so the API never confirms that it exists.

Common error codes#

StatuscodeWhen
401unauthenticatedNo API key or token was sent
401invalid_api_keyThe API key is wrong, revoked or expired
401invalid_tokenThe OAuth access token is wrong, revoked or expired
403missing_capabilityThe key or token lacks a scope. data.missing lists the scopes needed
403ip_not_allowedThe request came from an IP address that is not allowed
403transition_forbiddenThe workflow only lets certain roles, or the assignee, make this transition
403transition_conditionThe ticket does not meet the transition's conditions
404ticket_not_foundNo ticket with this key or id that you can see
404project_not_foundNo project with this key or id
404attachment_not_foundNo attachment with this id that you can see
404webhook_not_foundNo webhook with this id
409duplicate_external_idA ticket with this external_id already exists. data has its ticket_id and key
409idempotency_mismatchAn Idempotency-Key was reused with a different body
412version_mismatchThe ticket's version is not the one in If-Match. data.current_version has the current one
422invalid_fieldsThe body or a query parameter failed validation. See field_errors
422missing_titleThe ticket title is empty
422project_archivedThe project is archived and takes no new tickets
422invalid_typeThe ticket type does not exist in this project
422invalid_statusThe status does not exist in this ticket's workflow
422invalid_priorityPriority is not p1, p2, p3 or p4
422invalid_sourcesource is not one of the allowed values
422invalid_assigneeThe assignee is not an active member of your organization
422invalid_teamThe team does not exist
422invalid_requesterThe requester does not exist
422invalid_custom_fieldsOne or more custom field values are wrong. See field_errors
422invalid_if_matchIf-Match is not a version number
422invalid_transitionThe ticket cannot move to that status from its current status
422transition_validationThe transition needs fields or a comment you did not send. See field_errors
422missing_targetA transition request had neither to_status nor transition_id
422empty_commentThe comment body is empty
422invalid_linkA ticket cannot link to itself
422invalid_minutesLogged minutes are not between 1 and 1440
422missing_userThe caller is not a user (for example a client credentials token), so user_id is required
422file_too_largeThe file is over 25 MB
422blocked_file_typeThe file is an executable or script type that is not allowed
422invalid_eventsA webhook event name or pattern matches no event
422invalid_urlA webhook URL is not http:// or https://
422private_addressA webhook URL points at a private or local address
422tql_syntaxThe TQL query could not be parsed. data.position points at the problem
422tql_fieldThe TQL query uses a field that does not exist
429rate_limitedToo many requests. The Retry-After header and data.retry_after say how many seconds to wait

New codes can be added over time. Handle unknown codes by falling back to the HTTP status.

Handling errors#

  • Retry 429 after the number of seconds in Retry-After.
  • Retry 500 and other 5xx responses with exponential backoff. They are usually temporary. A 5xx can come back without the JSON body above, so check the status before parsing. Use an idempotency key on creates so a retry never makes a duplicate.
  • On 412, get the ticket again, check that your change still applies, and retry with the new version.
  • On 409 duplicate_external_id, the ticket already exists: use the key in data instead of creating another.
  • Do not retry other 4xx responses without changing the request. Read code and field_errors to see what to fix.

Searching with TQL

Find tickets with the Ticket Query Language: fields, operators, dates, sorting and examples

https://docs.lemuai.com/tickets-api/tql

TQL (Ticket Query Language) is how you search tickets. It is the same language the LemuTickets app uses for filters, queues and saved views, so a filter you build in the app works in the API too.

Send a query as the q parameter of List and search tickets:

cURL
curl -G https://api.tickets.lemuai.com/v1/tickets \
  -H "Authorization: Bearer ltk_live_your_api_key" \
  --data-urlencode 'q=project = SUP AND status_category != done AND priority in (p1, p2) ORDER BY sla.next_due ASC'

How a query is built#

A query is one or more conditions joined with AND and OR, followed by an optional ORDER BY:

Text
field operator value [AND|OR field operator value ...] [ORDER BY field [ASC|DESC], ...]
  • AND binds tighter than OR. Use parentheses to group: (priority = p1 OR sla.breached = true) AND project = SUP.
  • Two conditions side by side without a keyword are joined with AND.
  • NOT in front of a condition or group negates it: NOT labels in (spam).
  • Keywords (AND, OR, NOT, IN, IS, EMPTY, ORDER BY, ASC, DESC) are not case sensitive. Field names are not case sensitive.
  • Put values with spaces or special characters in double or single quotes: status = "Waiting on customer".
  • A quoted text or a word on its own is a full-text search of the title and description: "refund not received". A ticket key on its own, like SUP-1042, finds that ticket.

Operators#

OperatorMeaningExample
=Equalspriority = p1
!=Does not equal (also matches tickets where the field is empty)status_category != done
> >= < <=Greater or less than (dates, numbers, priority)created >= -7d
~Contains (case insensitive)title ~ invoice
!~Does not containtitle !~ test
IN (...)Any of the valuespriority in (p1, p2)
NOT IN (...)None of the valuessource not in (email, slack)
IS EMPTYHas no valueassignee is empty
IS NOT EMPTYHas a valuedue is not empty

For priority, "greater" means more urgent: priority >= p2 finds p1 and p2.

Fields#

FieldWhat it matchesValues
projectThe projectKey (SUP), name or id
keyThe ticket keySUP-1042
typeThe ticket typeName (Complaint) or id
statusThe exact statusName ("In progress") or id
status_categoryThe status groupnew, open, waiting, done
priorityPriorityp1, p2, p3, p4
severitySeverityText
sourceWhere the ticket came fromvoice, whatsapp, web_chat, email, slack, teams, api, portal, web_form, manual, lemu_copilot, automation, journey
assigneeThe assigned personme(), email, name or user id
reporterWho created the ticketme(), email, name or user id
teamThe assigned teamName or id
requesterThe customer who raised itEmail, phone, name or requester id
accountThe customer's accountName or id
account.tierThe account's tierFor example enterprise
requester.vipRequester is marked VIPtrue or false
labelsLabels on the ticketLabel text. labels in (refund, urgent) matches tickets with any of them
titleThe titleText (use ~ to search inside it)
descriptionThe descriptionText
textFull-text search of title and descriptionText
createdWhen it was createdDate
updatedLast changeDate
resolvedWhen it was resolvedDate
closedWhen it was closedDate
dueThe due dateDate
first_responseFirst public replyDate
status_changedLast status changeDate
sla.next_dueThe next SLA deadlineDate
sla.breachedAn SLA target was missedtrue or false
escalation_levelHow many times it was escalatedNumber
reopenedHow many times it was reopenedNumber
csatThe customer's satisfaction scoreNumber
time_spentLogged work, in minutesNumber
restrictedVisible only to some peopletrue or false
parentThe parent ticketTicket key
watcherA user watching the ticketUser id
external_idYour own id for the ticketText
cf.<key>A custom fieldDepends on the field. Numbers can use > and <
ai.<key>A value the AI set during triage, such as ai.categoryText

status_category is usually better than status in integrations: each project names its statuses differently, but every status belongs to one of the four categories.

Dates#

Date fields accept:

  • Relative times from now: -30m, -12h, -7d, -2w for the past, +1d for the future. created >= -7d is "created in the last 7 days".
  • ISO dates and times: 2026-11-01 or 2026-11-01T09:00:00+05:30. Times without a zone are read as UTC.
  • Functions: now(), startOfDay(), endOfDay(), startOfWeek() (Monday), startOfMonth(). These use UTC.

Functions#

FunctionValue
me() or currentUser()The calling user. For an API key, the key's own user
now()The current time
startOfDay(), endOfDay()Start or end of today (UTC)
startOfWeek()Monday 00:00 of this week (UTC)
startOfMonth()The first of this month, 00:00 (UTC)

Sorting#

Add ORDER BY at the end with one or more fields, each ASC (default) or DESC. Empty values sort last. Without ORDER BY, the most recently updated tickets come first.

You can sort by created, updated, resolved, due, sla.next_due, key (or number), title, priority, status (or status_category), escalation_level, csat and status_changed.

Examples#

You wantQuery
Open tickets in one project, most urgent firstproject = SUP AND status_category != done ORDER BY priority ASC, created ASC
Breached or about to breach todaysla.breached = true OR sla.next_due <= endOfDay()
Unassigned high-priority ticketsassignee is empty AND priority >= p2 AND status_category in (new, open)
One customer's tickets this monthrequester = "priya@example.com" AND created >= startOfMonth()
Enterprise accounts waiting on youaccount.tier = enterprise AND status_category = open
Complaints from WhatsApp last weektype = Complaint AND source = whatsapp AND created >= -1w
A custom field valuecf.order_id = "58213"
Ticket synced from your ERPexternal_id = "ERP-CMP-58213"
Free text"refund not received" AND project = SUP

Checking a query#

Send a query to POST /v1/tql/validate to check it before you save it in your system:

cURL
curl -X POST https://api.tickets.lemuai.com/v1/tql/validate \
  -H "Authorization: Bearer ltk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{ "q": "project = SUP AND priorty = p1" }'
JSON
{
  "valid": false,
  "message": "Unknown field priorty",
  "data": { "field": "priorty" },
  "fields": ["project", "key", "type", "status", "..."]
}

A valid query returns "valid": true and the same fields list. When a query in List and search tickets is invalid, the request fails with 422 and a tql_* error code.

Webhooks

Get signed LemuTickets events at your endpoint: subscribing, the event list, payloads, verifying signatures and retries

https://docs.lemuai.com/tickets-api/webhooks

Webhooks tell your system when something happens in LemuTickets, such as a new ticket, a status change or a customer reply, so you don't have to poll. LemuTickets sends an HTTPS POST with a JSON body to your URL for every event you subscribe to.

Subscribe#

Either in the app:

  1. Open Settings → API keys and webhooks and select the Webhooks tab.
  2. Click Add webhook.
  3. Enter the Endpoint URL, an optional Description, the Events to send (use area.* for every event of that kind, for example ticket.*), and optionally the Projects to send events for. Empty means all projects.
  4. Copy the signing secret. It is shown only once.

Or with the API: Create a webhook.

The URL must be public. Private, local and internal addresses are refused.

On the same tab you can see each webhook's Deliveries with the response your endpoint gave, Send again a delivery, Send test event, and Rotate secret. The old secret stops working as soon as you rotate it.

Events#

EventWhen
ticket.createdA ticket was created
ticket.updatedFields on a ticket changed
ticket.transitionedA ticket moved to another status
ticket.assignedThe assignee or team changed
ticket.resolvedA ticket reached a resolved status
ticket.reopenedA resolved or closed ticket was reopened
ticket.closedA ticket was closed
ticket.deletedA ticket was deleted
ticket.mergedA ticket was merged into another
ticket.escalatedA ticket was escalated
ticket.linkedA link between tickets was added
ticket.major_incidentA ticket was flagged or unflagged as a major incident
comment.createdA reply or internal note was added
comment.delivery_updatedA reply's delivery status changed (for example, the email or WhatsApp message was delivered or failed)
sla.warningAn SLA target is close to breach
sla.breachedAn SLA target was breached
csat.submittedA requester rated a ticket
approval.requestedAn approval was requested
approval.decidedAn approval was approved or rejected
worklog.createdTime was logged on a ticket
requester.createdA requester was created
requester.updatedA requester was updated
account.updatedAn account was created or updated
assignment.unassignedA ticket stayed unassigned longer than the project allows
asset.createdAn asset was created
asset.updatedAn asset changed
problem.createdA problem record was created
problem.updatedA problem record changed
change.createdA change request was created
change.updatedA change request changed status or was voted on
visit.updatedA field visit was scheduled or changed
visit.reminderA field visit is due tomorrow
ai.triagedThe AI classified a new ticket
autopilot.action_proposedAutopilot proposed an action (inside its review window)
autopilot.action_doneAutopilot carried out an action
lemu.issue_suggestedLemu AI found an issue in a conversation and it is waiting for review
webhook.disabledA webhook subscription was turned off after repeated failures

GET /v1/events/catalog returns the same list as {"data": [{"type", "description"}]}.

Patterns use * as a wildcard: ticket.* matches every ticket event, * matches everything. Each pattern must match at least one event.

When a webhook is limited to some projects, it only gets events that belong to a ticket in those projects. Events that are not about a ticket (requesters, accounts, webhook.disabled) are only sent to webhooks without a project filter.

Payload#

Every delivery has the same envelope:

JSON
{
  "id": "evt_48213",
  "type": "ticket.transitioned",
  "created_at": "2026-11-25T09:30:02.114210+00:00",
  "org_id": "5e7a9c1b-3d2f-4a6e-8b0c-2d4f6a8c0e1b",
  "data": {
    "actor": {
      "type": "user",
      "id": "0e2a4c6b-8d1f-4a3e-9b5c-7d9f1a3c5e7b",
      "name": "Arjun Mehta"
    },
    "ticket": {
      "id": "2f9c7e1a-5b3d-4c8e-9a6f-1d0e2b4c6a8f",
      "key": "SUP-1042",
      "title": "Refund not received for order 58213",
      "status": { "id": "6e1f2a3b-8c4d-4f5e-a6b7-c8d9e0f1a2b3", "name": "In progress", "category": "open", "color": "blue" },
      "status_category": "open",
      "priority": "p2",
      "external_id": "ERP-CMP-58213",
      "version": 4
    },
    "changes": {},
    "details": {
      "from": "Open",
      "to": "In progress",
      "from_category": "open",
      "to_category": "open",
      "transition": "Start work"
    }
  }
}
FieldDescription
idThe event id. It stays the same on every retry and redelivery, so use it to ignore events you have already handled.
typeThe event name from the list above.
created_atWhen the event was queued.
org_idYour organization's id.
data.actorWho caused it: type is user, api_key, integration, requester, automation, ai or system, with id and name.
data.ticketFor ticket and comment events: the whole ticket as it is when the event is sent. See the ticket object. Shortened above.
data.changesFor ticket.updated: each changed field as [old, new], for example {"priority": ["p3", "p1"]}. Empty for other events.
data.commentFor comment.* events: the comment, in the same shape as List comments.
data.detailsEvent-specific details, for example the from and to status of a transition, or the minutes of a worklog.

Events that are not about a ticket put their fields directly in data, for example {"actor": {"type": "system"}, "requester_id": "8b4d6f2a-..."} for requester.created. Fetch the full object with the API if you need it.

comment.created is sent for internal notes too. Check data.comment.visibility (public or internal) before showing a comment to a customer.

Headers#

HeaderValue
Content-Typeapplication/json
User-AgentLemuTickets-Webhooks/1.0
X-LemuTickets-EventThe event type, for example ticket.created
X-LemuTickets-DeliveryThe delivery id. A manual Send again gets a new one
X-LemuTickets-Signaturet=<unix time>,v1=<signature> (see below)

Verify the signature#

Check every delivery before you trust it. The signature is an HMAC-SHA256, in hex, of the timestamp, a dot, and the raw request body, using your webhook's signing secret (whsec_...) as the key:

Text
v1 = hex(HMAC_SHA256(secret, "<t>.<raw body>"))
  1. Read t and v1 from the X-LemuTickets-Signature header.
  2. Compute the HMAC over the raw body bytes as received. Parsing and re-encoding the JSON changes the bytes and breaks the check.
  3. Compare with v1 in constant time.
  4. Reject the delivery if t is more than 5 minutes from your clock, to stop replays.

Node.js

JavaScript
import crypto from "node:crypto";
import express from "express";
 
const app = express();
const SECRET = process.env.LEMU_TICKETS_WEBHOOK_SECRET; // whsec_...
 
app.post("/lemutickets/webhook", express.raw({ type: "application/json" }), (req, res) => {
  const header = req.get("X-LemuTickets-Signature") || "";
  const parts = Object.fromEntries(header.split(",").map((p) => p.split("=", 2)));
  const t = Number(parts.t);
  const expected = crypto
    .createHmac("sha256", SECRET)
    .update(`${parts.t}.`)
    .update(req.body)
    .digest("hex");
  const ok =
    parts.v1 &&
    parts.v1.length === expected.length &&
    crypto.timingSafeEqual(Buffer.from(parts.v1), Buffer.from(expected)) &&
    Math.abs(Date.now() / 1000 - t) <= 300;
  if (!ok) return res.status(400).send("bad signature");
 
  const event = JSON.parse(req.body.toString("utf8"));
  // Handle the event, then answer quickly with a 2xx
  res.sendStatus(204);
});

Python

Python
import hashlib
import hmac
import os
import time
 
from flask import Flask, abort, request
 
app = Flask(__name__)
SECRET = os.environ["LEMU_TICKETS_WEBHOOK_SECRET"]  # whsec_...
 
 
@app.post("/lemutickets/webhook")
def lemutickets_webhook():
    header = request.headers.get("X-LemuTickets-Signature", "")
    parts = dict(p.split("=", 1) for p in header.split(",") if "=" in p)
    t, sig = parts.get("t", ""), parts.get("v1", "")
    body = request.get_data()  # raw bytes
    expected = hmac.new(SECRET.encode(), f"{t}.".encode() + body, hashlib.sha256).hexdigest()
    if not t.isdigit() or not hmac.compare_digest(sig, expected):
        abort(400)
    if abs(time.time() - int(t)) > 300:
        abort(400)
 
    event = request.get_json()
    # Handle the event, then answer quickly with a 2xx
    return "", 204

Responding and retries#

  • Answer with any 2xx status within 10 seconds. Do slow work after you answer, for example in a queue.
  • Redirects are not followed, and any other status, a timeout or a connection error counts as a failure.
  • Failed deliveries are retried with growing gaps (30 seconds, 1 minute, 2 minutes, 4 minutes and so on, up to 1 hour between tries) for 24 hours. After that the delivery is marked failed. You can still send it again from Deliveries.
  • Deliveries go out within about 10 seconds of the event, several at a time, so they can arrive out of order. Use created_at and the ticket's version to tell which is newer.
  • After 50 failed attempts in a row, the webhook is turned off, its pending deliveries are marked failed, and a webhook.disabled event is sent to any other webhook subscribed to it. Fix your endpoint, then turn Send events back on in the webhook's settings. That resets the failure count.

Test your endpoint#

Send test event on the webhook (or POST /v1/webhooks/{webhook_id}/ping) sends a signed webhook.ping event straight away:

JSON
{
  "id": "ping_Xk2pQ9aB",
  "type": "webhook.ping",
  "created_at": "2026-11-25T09:31:10.004512+00:00",
  "org_id": "5e7a9c1b-3d2f-4a6e-8b0c-2d4f6a8c0e1b",
  "data": {
    "webhook_id": "f2a4c6e8-0b1d-4f3a-8c5e-a7c9e1b3d5f7",
    "message": "Webhook is reachable"
  }
}

Embedding in Your ERP

Show a customer's tickets, a request form or one ticket inside your own app with embed tokens and the <lemu-tickets> element

https://docs.lemuai.com/tickets-api/embedding

The <lemu-tickets> element puts LemuTickets screens inside your ERP, customer portal or website, without you building them. It shows one customer (a requester) their own tickets, lets them raise a new one, and lets them reply. Your agents see and answer everything in LemuTickets as usual.

It works in two steps:

  1. Your server asks the API for a short-lived embed token for the signed-in customer.
  2. Your page loads the script and adds a <lemu-tickets> element with that token.

Never put an API key in a web page. An embed token is safe to put in the page: it only works for one requester, only on the embed screens, only from the sites you list, and only for a short time.

1. Get an embed token on your server#

POST/v1/embed/tokens

Call this with an API key or OAuth token that has the tickets.write scope.

FieldTypeRequiredDescription
requester_idstring (UUID)One of the threeThe LemuTickets requester id.
requester_external_idstringOne of the threeYour own id for the customer, as set with Upsert a requester by external ID.
requesterobjectOne of the threeemail, phone and name. Finds the requester by email or phone, or creates one. Needs an email or a phone.
scopestringNoWhat the token allows. list (default), create or ticket. See below.
ticket_keystringFor ticketThe ticket to show, for example SUP-1042. It must belong to this requester.
projectstringNoProject key or id for tickets the customer creates. Without it, new tickets go to your first open service desk project.
ttl_minutesintegerNoHow long the token lasts, 1 to 1440 minutes. Default 60.
allowed_originsarray of stringsNoThe sites allowed to use the token, as origins like https://erp.example.com (no path). Strongly recommended. Empty means any site.
ScopeThe customer can
listSee all their tickets, open any of them, reply, and raise new tickets
createRaise new tickets only
ticketOpen and reply on the one ticket in ticket_key

Example request:

cURL
curl -X POST https://api.tickets.lemuai.com/v1/embed/tokens \
  -H "Authorization: Bearer ltk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "requester_external_id": "CUST-20931",
    "scope": "list",
    "project": "SUP",
    "ttl_minutes": 60,
    "allowed_origins": ["https://erp.example.com"]
  }'

201

JSON
{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "expires_at": "2026-11-25T10:12:40.512000+00:00",
  "scope": "list",
  "requester_id": "8b4d6f2a-0c1e-4a3b-9d5f-7e6a8c0b2d4f",
  "ticket_key": null,
  "allowed_origins": ["https://erp.example.com"],
  "script_url": "https://api.tickets.lemuai.com/v1/public/embed.js",
  "snippet": "<script src=\"https://api.tickets.lemuai.com/v1/public/embed.js\" async></script>\n<lemu-tickets token=\"eyJhbGciOi...\" view=\"list\"></lemu-tickets>"
}

snippet is ready-made HTML for this token.

StatuscodeWhen
422missing_requesterNone of requester_id, requester_external_id or requester (with an email or phone) was sent
422invalid_requesterNo requester with that id or external id
422requester_unavailableThe requester's self-service access is turned off, or their data was anonymised
422missing_ticket_keyscope is ticket but there is no ticket_key
422ticket_not_requestersThe ticket belongs to another requester
422invalid_originAn entry in allowed_origins is not an origin like https://erp.example.com

2. Add the element to your page#

Load the script once per page, then add an element for each screen:

HTML
<script src="https://api.tickets.lemuai.com/v1/public/embed.js" async></script>
 
<!-- The customer's tickets (token with scope "list") -->
<lemu-tickets token="TOKEN_FROM_YOUR_SERVER" view="list"></lemu-tickets>
 
<!-- A "raise a request" form (token with scope "create") -->
<lemu-tickets token="TOKEN_FROM_YOUR_SERVER" view="create"></lemu-tickets>
 
<!-- One ticket with its replies (token with scope "ticket") -->
<lemu-tickets token="TOKEN_FROM_YOUR_SERVER" view="ticket" ticket="SUP-1042"></lemu-tickets>
AttributeDescription
tokenThe embed token from step 1. Required.
viewlist (default), create or ticket. It should match the token's scope.
ticketThe ticket key, for view="ticket".
statusOptional, for view="list". open shows every ticket that is not done. Otherwise a comma-separated list of status categories, for example waiting or new,open.

The customer only ever sees their own tickets and public replies. Internal notes stay hidden. Tickets they raise have the source portal.

Refreshing tokens#

Tokens expire (after 60 minutes by default). Ask your server for a new token each time the page loads. If the page stays open a long time, fetch a new token before expires_at and set it on the element:

JavaScript
document.querySelector("lemu-tickets").setAttribute("token", newToken);

Changing an attribute redraws the element.

Events#

The element sends DOM events you can listen to, for example to refresh your own screen:

Eventevent.detail
lemu:ticket-createdThe new ticket: id, key, title, status, status_category, priority, type, created_at and more
lemu:reply-sentThe reply: id, ticket_key, body_text, created_at
lemu:error{ code, message }, for example embed_token_expired when the token ran out
JavaScript
document.addEventListener("lemu:error", (e) => {
  if (e.detail.code === "embed_token_expired") refreshToken();
});

Styling#

The element draws inside its own shadow DOM, so your page's styles do not leak into it. Set these CSS variables on the element to match your brand:

CSS
lemu-tickets {
  --accent: #0b6e4f;
  --accent-hover: #095c42;
  --ink: #1d1d1f;
  --slate: #6b6b73;
  --mist: #f4f4f5;
  --line: #ececee;
  --radius: 12px;
}

When something goes wrong#

What you seeWhy
"Missing token."The token attribute is empty.
network_error ("Could not reach the support service.")Often the page's origin is not in the token's allowed_origins, so the browser blocks the response. Origins must match exactly, including https and any port.
embed_token_expiredThe token ran out. Get a new one from your server.
embed_scopeThe token's scope does not allow this view, for example a create token used with view="list".

The Ticket Object

The fields of a LemuTickets ticket, as returned by every ticket endpoint and webhook

https://docs.lemuai.com/tickets-api/tickets/overview

A ticket is one complaint, request, task, incident or question, with an owner, a status, a deadline and a full history. Every ticket belongs to a project (for example SUP) and gets a key from it (SUP-1042). Wherever an endpoint takes {ref}, you can pass the key or the ticket's id.

MethodEndpointPurpose
POST/v1/ticketsCreate a ticket
GET/v1/ticketsList and search tickets
GET/v1/tickets/{ref}Get a ticket
PATCH/v1/tickets/{ref}Update a ticket
GET/v1/tickets/{ref}/transitionsList available transitions
POST/v1/tickets/{ref}/transitionsTransition a ticket to another status
POST/v1/tickets/{ref}/commentsAdd a comment: a reply or an internal note
GET/v1/tickets/{ref}/commentsList comments
POST/v1/tickets/{ref}/worklogsLog work
POST/v1/tickets/{ref}/linksLink tickets

Example#

JSON
{
  "id": "2f9c7e1a-5b3d-4c8e-9a6f-1d0e2b4c6a8f",
  "key": "SUP-1042",
  "number": 1042,
  "project": { "id": "3b0f6c1e-8a2d-4f5b-9c71-0e4d2a6b8f13", "key": "SUP", "name": "Customer Support" },
  "type": { "id": "9d2e4f60-1b3a-4c8d-a7e5-6f0b2c9d1e47", "name": "Complaint", "icon": "message-square-warning", "color": "red" },
  "title": "Refund not received for order 58213",
  "description": "Customer paid on 12 November and the order was cancelled the same day.",
  "status": { "id": "5c8a1d3e-7f2b-4e6a-9b0c-d4e1f2a3b5c6", "name": "Open", "category": "open", "color": "blue" },
  "status_category": "open",
  "priority": "p2",
  "severity": null,
  "source": "api",
  "source_ref": null,
  "requester": {
    "id": "8b4d6f2a-0c1e-4a3b-9d5f-7e6a8c0b2d4f",
    "name": "Priya Sharma",
    "email": "priya@example.com",
    "phone": "+919876543210",
    "is_vip": false,
    "account_id": "4a6c8e0b-2d1f-4b3a-8c5e-9f7d1b3a5c6e"
  },
  "account_id": "4a6c8e0b-2d1f-4b3a-8c5e-9f7d1b3a5c6e",
  "assignee": null,
  "team": { "id": "1c3e5a7b-9d2f-4e6a-b8c0-a2e4f6b8d0c1", "name": "L1 Support" },
  "reporter": {
    "id": "d1f3b5a7-c9e2-4b4d-8f6a-0c2e4a6b8d0f",
    "name": "API: ERP sync",
    "email": "ltk_live_ab12cd34@bots.lemutickets",
    "avatar_url": null
  },
  "parent_id": null,
  "labels": ["refund"],
  "due_at": null,
  "restricted": false,
  "sla": {
    "policy_id": "7e9a1c3b-5d2f-4a6e-8b0c-1d3f5a7c9e2b",
    "targets": {
      "first_response": {
        "minutes": 240.0,
        "business_hours": true,
        "status": "running",
        "started_at": "2026-11-25T09:12:40.512000+00:00",
        "due_at": "2026-11-25T13:12:40.512000+00:00",
        "met_at": null,
        "breached_at": null
      }
    },
    "paused": false,
    "next_due_at": "2026-11-25T13:12:40.512000+00:00",
    "breached": false
  },
  "sla_next_due_at": "2026-11-25T13:12:40.512000+00:00",
  "sla_breached": false,
  "escalation_level": 0,
  "first_response_at": null,
  "resolved_at": null,
  "closed_at": null,
  "reopened_count": 0,
  "csat_score": null,
  "time_spent_minutes": 0,
  "estimate_minutes": null,
  "custom_fields": { "order_id": "58213" },
  "ai": {},
  "lemu": {},
  "channel_thread": {},
  "external_id": "ERP-CMP-58213",
  "merged_into_id": null,
  "version": 3,
  "created_at": "2026-11-25T09:12:40.512000+00:00",
  "updated_at": "2026-11-25T09:12:41.087000+00:00"
}

Ticket fields#

FieldTypeDescription
idstring (UUID)The ticket's id.
keystringThe project key and number, for example SUP-1042.
numberintegerThe number within the project.
projectobjectid, key and name of the project.
typeobjectThe ticket type: id, name, icon, color. Types are set up per project, for example Complaint, Request, Question, Incident and Task.
titlestringUp to 500 characters.
descriptionstringThe body of the ticket.
statusobjectThe current status: id, name, category, color. Status names differ per project.
status_categorystringThe group the status belongs to: new, open, waiting or done. Use this, not the status name, to tell whether a ticket is finished.
prioritystringp1 (most urgent) to p4.
severitystring or nullOptional severity, for incidents.
sourcestringWhere the ticket came from: voice, whatsapp, web_chat, email, slack, teams, api, portal, web_form, manual, lemu_copilot, automation or journey.
source_refstring or nullAn id in the source system, such as a message or call id. Prevents duplicates (see Create a ticket).
requesterobject or nullThe customer who raised it: id, name, email, phone, is_vip, account_id. Email and phone are partly hidden without the pii.read scope.
account_idstring or nullThe requester's account (the customer company).
assigneeobject or nullThe assigned person: id, name, email, avatar_url.
teamobject or nullThe assigned team: id, name.
reporterobject or nullWho created the ticket, in the same shape as assignee. For API keys this is the key's own user.
parent_idstring or nullThe parent ticket, for sub-tasks.
labelsarray of stringsLabels, sorted.
due_atstring or nullThe due date you set (separate from SLA deadlines).
restrictedbooleantrue if only some people may see the ticket.
slaobjectThe SLA state: policy_id, targets, paused, next_due_at, breached. See below.
sla_next_due_atstring or nullThe next SLA deadline across all targets.
sla_breachedbooleantrue once any SLA target was missed.
escalation_levelintegerHow many escalation levels have fired.
first_response_atstring or nullWhen the first public reply was sent.
resolved_atstring or nullWhen it reached a resolved status. Cleared if it is reopened.
closed_atstring or nullWhen it reached a final status. Cleared if it is reopened.
reopened_countintegerHow many times it was reopened.
csat_scoreinteger or nullThe customer's satisfaction rating, if they gave one.
time_spent_minutesintegerTotal logged work.
estimate_minutesinteger or nullThe estimate, if set.
custom_fieldsobjectYour project's custom fields, by key. Fields you are not allowed to see are left out.
aiobjectWhat the AI worked out during triage, for example summary, category and sentiment. Empty when AI triage is off.
lemuobjectLinks to the Lemu AI conversation the ticket came from (call, WhatsApp chat), when there is one.
channel_threadobjectThe conversation replies go back to, for tickets that came from a channel.
external_idstring or nullYour own id for the ticket. Unique in your organization.
merged_into_idstring or nullSet when this ticket was merged into another.
versionintegerGoes up on every change. Use it with If-Match (see Conventions).
created_at, updated_atstringTimes in UTC.

Get a ticket also returns transitions, the statuses the ticket can move to next.

SLA targets#

sla.targets has one entry per target in the ticket's SLA policy: first_response, next_response and resolution. Each has:

FieldDescription
minutesThe target length.
business_hourstrue if the clock only runs in business hours.
statusrunning, paused, met or breached.
started_atWhen the clock started.
due_atThe deadline. Empty while the target is paused.
met_atWhen the target was met, if it was.
breached_atWhen the target was missed, if it was.

Targets can carry more fields (such as remaining_minutes while paused). Ignore fields you do not use.

Create a Ticket

Create a ticket in a LemuTickets project, with its requester, priority, assignee and custom fields

https://docs.lemuai.com/tickets-api/tickets/create

Creates a ticket in a project. The ticket starts in the workflow's first status unless you choose one, and gets the next number in the project (for example SUP-1042).

After it is created, the project's assignment rules, SLA policy and AI triage run as they do for tickets made in the app.

POST/v1/tickets

Needs the tickets.write scope in the project.

Headers#

NameRequiredDescription
Idempotency-KeyNo, but recommendedA unique value for this ticket, for example your own record id. Sending the same request again returns the first response instead of a second ticket. See idempotency keys.

Request body#

FieldTypeRequiredDescription
projectstringYesProject key (SUP) or id.
titlestringYes1 to 500 characters.
descriptionstringNoThe body of the ticket.
typestringNoTicket type name (Complaint) or id. Defaults to the project's default type.
prioritystringNop1, p2, p3 or p4. Default p3.
severitystringNoOptional severity, for incidents.
statusstringNoStatus name or id to start in. Defaults to the workflow's first status.
sourcestringNoWhere the ticket came from. Default api. One of voice, whatsapp, web_chat, email, slack, teams, api, portal, web_form, manual, lemu_copilot, automation, journey.
source_refstringNoThe id of the item in the source system. If a ticket with the same source and source_ref exists, it is returned instead of creating a new one.
external_idstringNoYour own id for the ticket. Must be unique: a second ticket with the same value fails with 409.
requester_idstring (UUID)NoAn existing requester.
requesterobjectNoFind or create the requester inline (see below). Used when requester_id is not sent.
account_idstring (UUID)NoThe customer account. Defaults to the requester's account.
assignee_user_idstring (UUID)NoAssign to this person. They must be an active member of your organization.
assignee_team_idstring (UUID)NoAssign to this team. Defaults to the project's default team when no person is set.
labelsarray of stringsNoLabels to add.
due_atstring (date-time)NoA due date, separate from SLA deadlines.
custom_fieldsobjectNoValues for the project's custom fields, by key. Required custom fields must be sent.
parent_idstring (UUID)NoMake this a sub-task of another ticket.
restrictedbooleanNoOnly the assignee, the reporter, admins and people it is shared with can see it. Default false.
watchersarray of UUIDsNoUsers to notify about changes.
estimate_minutesintegerNoAn estimate of the work.
auto_assignbooleanNoRun the project's assignment rules. Default true.
auto_triagebooleanNoLet the AI classify the ticket. Default true.

Inline requester#

Send requester to link the ticket to a customer without looking them up first. LemuTickets finds an existing requester by lemu_contact_id, email, phone, WhatsApp id or external_id, in that order, and creates one if there is no match. Details on an existing requester are only filled in where they are empty, never overwritten.

FieldTypeDescription
namestringFull name.
emailstringEmail address.
phonestringPhone number. Numbers without a country code are read as Indian (+91).
whatsapp_idstringWhatsApp number.
external_idstringYour own id for the customer.
lemu_contact_idintegerThe contact's id in Lemu AI, if you use both products.
languagestringPreferred language, for example hi or en.

A new requester whose email domain matches an account is added to that account.

Example request:

cURL
curl -X POST https://api.tickets.lemuai.com/v1/tickets \
  -H "Authorization: Bearer ltk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ERP-CMP-58213" \
  -d '{
    "project": "SUP",
    "type": "Complaint",
    "title": "Refund not received for order 58213",
    "description": "Customer paid on 12 November and the order was cancelled the same day.",
    "priority": "p2",
    "external_id": "ERP-CMP-58213",
    "labels": ["refund"],
    "custom_fields": { "order_id": "58213" },
    "requester": {
      "name": "Priya Sharma",
      "email": "priya@example.com",
      "phone": "+919876543210",
      "external_id": "CUST-20931"
    }
  }'

Response#

201 with the new ticket. The ETag header holds its version.

JSON
{
  "id": "2f9c7e1a-5b3d-4c8e-9a6f-1d0e2b4c6a8f",
  "key": "SUP-1042",
  "number": 1042,
  "project": { "id": "3b0f6c1e-8a2d-4f5b-9c71-0e4d2a6b8f13", "key": "SUP", "name": "Customer Support" },
  "type": { "id": "9d2e4f60-1b3a-4c8d-a7e5-6f0b2c9d1e47", "name": "Complaint", "icon": "message-square-warning", "color": "red" },
  "title": "Refund not received for order 58213",
  "description": "Customer paid on 12 November and the order was cancelled the same day.",
  "status": { "id": "4d7b9e1f-3a5c-4e8b-a0d2-f4b6c8e0a1d3", "name": "New", "category": "new", "color": "sky" },
  "status_category": "new",
  "priority": "p2",
  "severity": null,
  "source": "api",
  "source_ref": null,
  "requester": {
    "id": "8b4d6f2a-0c1e-4a3b-9d5f-7e6a8c0b2d4f",
    "name": "Priya Sharma",
    "email": "priya@example.com",
    "phone": "+919876543210",
    "is_vip": false,
    "account_id": null
  },
  "account_id": null,
  "assignee": null,
  "team": { "id": "1c3e5a7b-9d2f-4e6a-b8c0-a2e4f6b8d0c1", "name": "L1 Support" },
  "reporter": {
    "id": "d1f3b5a7-c9e2-4b4d-8f6a-0c2e4a6b8d0f",
    "name": "API: ERP sync",
    "email": "ltk_live_ab12cd34@bots.lemutickets",
    "avatar_url": null
  },
  "parent_id": null,
  "labels": ["refund"],
  "due_at": null,
  "restricted": false,
  "sla": {
    "policy_id": "7e9a1c3b-5d2f-4a6e-8b0c-1d3f5a7c9e2b",
    "targets": {
      "first_response": {
        "minutes": 240.0,
        "business_hours": true,
        "status": "running",
        "started_at": "2026-11-25T09:12:40.512000+00:00",
        "due_at": "2026-11-25T13:12:40.512000+00:00",
        "met_at": null,
        "breached_at": null
      }
    },
    "paused": false,
    "next_due_at": "2026-11-25T13:12:40.512000+00:00",
    "breached": false
  },
  "sla_next_due_at": "2026-11-25T13:12:40.512000+00:00",
  "sla_breached": false,
  "escalation_level": 0,
  "first_response_at": null,
  "resolved_at": null,
  "closed_at": null,
  "reopened_count": 0,
  "csat_score": null,
  "time_spent_minutes": 0,
  "estimate_minutes": null,
  "custom_fields": { "order_id": "58213" },
  "ai": {},
  "lemu": {},
  "channel_thread": {},
  "external_id": "ERP-CMP-58213",
  "merged_into_id": null,
  "version": 1,
  "created_at": "2026-11-25T09:12:40.512000+00:00",
  "updated_at": "2026-11-25T09:12:40.512000+00:00"
}

See the ticket object for every field. Assignment, SLA and triage can still change the ticket right after it is created, so version and the assignee may move on quickly.

200 with the existing ticket, when a ticket with the same source and source_ref already exists.

Errors#

StatuscodeWhen
404project_not_foundNo project with that key or id, or the key cannot access it
409duplicate_external_idA ticket with this external_id exists. data.key is its key
409idempotency_mismatchThe Idempotency-Key was used before with a different body
422project_archivedThe project is archived
422invalid_type, invalid_statusThe type or status does not exist in this project
422invalid_assignee, invalid_team, invalid_requesterThe assignee, team or requester does not exist
422invalid_sourcesource is not one of the allowed values
422invalid_custom_fieldsA custom field value is wrong or a required one is missing. See field_errors
422invalid_fieldsA field has the wrong type or length. See field_errors

List and Search Tickets

List LemuTickets tickets a page at a time, filtered with simple parameters or a TQL query

https://docs.lemuai.com/tickets-api/tickets/list

Returns the tickets you can see, a page at a time. Filter with the simple parameters, with a TQL query in q, or both. All filters are combined with AND.

GET/v1/tickets

Needs the tickets.read scope. Deleted tickets are never returned.

Query parameters#

NameTypeRequiredDescription
qstringNoA TQL query, for example project = SUP AND priority in (p1, p2). May end with ORDER BY.
projectstringNoOnly tickets in this project (key or id).
status_categorystringNoComma-separated status categories: new, open, waiting, done.
assigneestringNome (the caller), none (unassigned), or a user id or email.
requester_idstring (UUID)NoOnly this requester's tickets.
view_idstring (UUID)NoUse the query and sort of a saved view from the app.
limitintegerNoTickets per page, 1 to 200. Default 50.
cursorstringNoThe next_cursor from the previous page. See pagination.
with_totalbooleanNoAlso count all matching tickets in total. Default false. Leave it off when you don't need it; it makes the request slower.

Without ORDER BY in q, the most recently updated tickets come first.

Example request:

cURL
curl -G https://api.tickets.lemuai.com/v1/tickets \
  -H "Authorization: Bearer ltk_live_your_api_key" \
  --data-urlencode "project=SUP" \
  --data-urlencode "status_category=new,open,waiting" \
  --data-urlencode "q=requester = \"priya@example.com\" ORDER BY created DESC" \
  --data-urlencode "limit=25" \
  --data-urlencode "with_total=true"

To sync every ticket that changed since your last run:

cURL
curl -G https://api.tickets.lemuai.com/v1/tickets \
  -H "Authorization: Bearer ltk_live_your_api_key" \
  --data-urlencode "q=updated >= \"2026-11-24T00:00:00+00:00\" ORDER BY updated ASC" \
  --data-urlencode "limit=200"

Response#

200

JSON
{
  "data": [
    {
      "id": "2f9c7e1a-5b3d-4c8e-9a6f-1d0e2b4c6a8f",
      "key": "SUP-1042",
      "number": 1042,
      "project": { "id": "3b0f6c1e-8a2d-4f5b-9c71-0e4d2a6b8f13", "key": "SUP", "name": "Customer Support" },
      "type": { "id": "9d2e4f60-1b3a-4c8d-a7e5-6f0b2c9d1e47", "name": "Complaint", "icon": "message-square-warning", "color": "red" },
      "title": "Refund not received for order 58213",
      "status": { "id": "5c8a1d3e-7f2b-4e6a-9b0c-d4e1f2a3b5c6", "name": "Open", "category": "open", "color": "blue" },
      "status_category": "open",
      "priority": "p2",
      "requester": {
        "id": "8b4d6f2a-0c1e-4a3b-9d5f-7e6a8c0b2d4f",
        "name": "Priya Sharma",
        "email": "priya@example.com",
        "phone": "+919876543210",
        "is_vip": false,
        "account_id": "4a6c8e0b-2d1f-4b3a-8c5e-9f7d1b3a5c6e"
      },
      "assignee": {
        "id": "0e2a4c6b-8d1f-4a3e-9b5c-7d9f1a3c5e7b",
        "name": "Arjun Mehta",
        "email": "arjun@yourcompany.com",
        "avatar_url": null
      },
      "team": { "id": "1c3e5a7b-9d2f-4e6a-b8c0-a2e4f6b8d0c1", "name": "L1 Support" },
      "sla_next_due_at": "2026-11-25T13:12:40.512000+00:00",
      "sla_breached": false,
      "external_id": "ERP-CMP-58213",
      "version": 4,
      "created_at": "2026-11-25T09:12:40.512000+00:00",
      "updated_at": "2026-11-25T09:30:02.114210+00:00"
    }
  ],
  "next_cursor": null,
  "total": 1
}
FieldTypeDescription
dataarrayThe tickets on this page. Each one is a full ticket object; the example above is shortened.
next_cursorstring or nullPass as cursor for the next page. null on the last page.
totalinteger or nullAll matching tickets, when with_total=true. Otherwise null.

Errors#

StatuscodeWhen
404not_foundview_id does not exist
422tql_syntax, tql_field, tql_value, tql_operator, tql_orderThe TQL query is invalid. message says what is wrong and data.position where
422invalid_fieldslimit is out of range or a parameter has the wrong type

Get a Ticket

Get one LemuTickets ticket by key or id, with the transitions it can make next

https://docs.lemuai.com/tickets-api/tickets/get

Returns one ticket, by its key or id, together with the statuses it can move to next.

GET/v1/tickets/{ref}

Needs the tickets.read scope.

Path parameters#

NameTypeRequiredDescription
refstringYesThe ticket key (SUP-1042, not case sensitive) or id.

Example request:

cURL
curl https://api.tickets.lemuai.com/v1/tickets/SUP-1042 \
  -H "Authorization: Bearer ltk_live_your_api_key"

Response#

200 with the ticket object and a transitions list. The ETag header holds the ticket's version, for use with If-Match.

JSON
{
  "id": "2f9c7e1a-5b3d-4c8e-9a6f-1d0e2b4c6a8f",
  "key": "SUP-1042",
  "number": 1042,
  "project": { "id": "3b0f6c1e-8a2d-4f5b-9c71-0e4d2a6b8f13", "key": "SUP", "name": "Customer Support" },
  "type": { "id": "9d2e4f60-1b3a-4c8d-a7e5-6f0b2c9d1e47", "name": "Complaint", "icon": "message-square-warning", "color": "red" },
  "title": "Refund not received for order 58213",
  "description": "Customer paid on 12 November and the order was cancelled the same day.",
  "status": { "id": "5c8a1d3e-7f2b-4e6a-9b0c-d4e1f2a3b5c6", "name": "Open", "category": "open", "color": "blue" },
  "status_category": "open",
  "priority": "p2",
  "severity": null,
  "source": "api",
  "source_ref": null,
  "requester": {
    "id": "8b4d6f2a-0c1e-4a3b-9d5f-7e6a8c0b2d4f",
    "name": "Priya Sharma",
    "email": "priya@example.com",
    "phone": "+919876543210",
    "is_vip": false,
    "account_id": "4a6c8e0b-2d1f-4b3a-8c5e-9f7d1b3a5c6e"
  },
  "account_id": "4a6c8e0b-2d1f-4b3a-8c5e-9f7d1b3a5c6e",
  "assignee": {
    "id": "0e2a4c6b-8d1f-4a3e-9b5c-7d9f1a3c5e7b",
    "name": "Arjun Mehta",
    "email": "arjun@yourcompany.com",
    "avatar_url": null
  },
  "team": { "id": "1c3e5a7b-9d2f-4e6a-b8c0-a2e4f6b8d0c1", "name": "L1 Support" },
  "reporter": {
    "id": "d1f3b5a7-c9e2-4b4d-8f6a-0c2e4a6b8d0f",
    "name": "API: ERP sync",
    "email": "ltk_live_ab12cd34@bots.lemutickets",
    "avatar_url": null
  },
  "parent_id": null,
  "labels": ["refund"],
  "due_at": null,
  "restricted": false,
  "sla": {
    "policy_id": "7e9a1c3b-5d2f-4a6e-8b0c-1d3f5a7c9e2b",
    "targets": {
      "first_response": {
        "minutes": 240.0,
        "business_hours": true,
        "status": "running",
        "started_at": "2026-11-25T09:12:40.512000+00:00",
        "due_at": "2026-11-25T13:12:40.512000+00:00",
        "met_at": null,
        "breached_at": null
      }
    },
    "paused": false,
    "next_due_at": "2026-11-25T13:12:40.512000+00:00",
    "breached": false
  },
  "sla_next_due_at": "2026-11-25T13:12:40.512000+00:00",
  "sla_breached": false,
  "escalation_level": 0,
  "first_response_at": null,
  "resolved_at": null,
  "closed_at": null,
  "reopened_count": 0,
  "csat_score": null,
  "time_spent_minutes": 0,
  "estimate_minutes": null,
  "custom_fields": { "order_id": "58213" },
  "ai": {},
  "lemu": {},
  "channel_thread": {},
  "external_id": "ERP-CMP-58213",
  "merged_into_id": null,
  "version": 4,
  "created_at": "2026-11-25T09:12:40.512000+00:00",
  "updated_at": "2026-11-25T09:20:15.301000+00:00",
  "transitions": [
    {
      "id": "e8a0c2d4-f6b1-4d3e-9a5c-7b9d1f3e5a7c",
      "name": "Start work",
      "to_status_id": "6e1f2a3b-8c4d-4f5e-a6b7-c8d9e0f1a2b3",
      "to_status": "In progress",
      "category": "open",
      "validators": {},
      "approval": {}
    },
    {
      "id": "b1d3f5a7-9c2e-4b4d-8f6a-1c3e5a7b9d0f",
      "name": "Resolve",
      "to_status_id": "7a2b3c4d-9e5f-4a6b-b7c8-d9e0f1a2b3c4",
      "to_status": "Resolved",
      "category": "done",
      "validators": { "require_comment": true },
      "approval": {}
    }
  ]
}

transitions has the same items as List available transitions (shortened above).

Errors#

StatuscodeWhen
404ticket_not_foundNo ticket with this key or id, or you cannot see it

Update a Ticket

Change fields on a LemuTickets ticket, safely with If-Match

https://docs.lemuai.com/tickets-api/tickets/update

Changes the fields you send and leaves the rest alone. To change the status, use Transition a ticket instead.

PATCH/v1/tickets/{ref}

Needs the tickets.write scope in the ticket's project. Assigning a ticket to someone other than the caller also needs tickets.assign.

Path parameters#

NameTypeRequiredDescription
refstringYesThe ticket key (SUP-1042) or id.

Headers#

NameRequiredDescription
If-MatchNo, but recommendedThe version you last read. If the ticket changed since, nothing is saved and you get 412. See versions and If-Match.

Request body#

Send only the fields you want to change. Send null to clear a field.

FieldTypeDescription
titlestringThe title.
descriptionstringThe body of the ticket.
prioritystringp1, p2, p3 or p4.
severitystringOptional severity.
type_idstring (UUID)Another ticket type in the same project. It must use the same workflow.
assignee_user_idstring (UUID)The person to assign. null unassigns.
assignee_team_idstring (UUID)The team to assign.
requester_idstring (UUID)Change the requester. The account follows the new requester unless you also send account_id.
account_idstring (UUID)The customer account.
labelsarray of stringsReplaces all labels.
due_atstring (date-time)The due date.
custom_fieldsobjectMerged into the existing values: keys you send are updated, others are kept.
parent_idstring (UUID)Make it a sub-task of another ticket.
estimate_minutesintegerEstimated work.
story_pointsnumberStory points, for task tracking projects.
external_idstringYour own id for the ticket.
restrictedbooleanOnly organization or project admins may change this.
restricted_toobjectWho else may see a restricted ticket: {"user_ids": [...], "roles": [...]}. Only organization or project admins may change this.

Any other field is rejected with 422.

Example request:

cURL
curl -X PATCH https://api.tickets.lemuai.com/v1/tickets/SUP-1042 \
  -H "Authorization: Bearer ltk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -H "If-Match: 4" \
  -d '{
    "priority": "p1",
    "assignee_user_id": "0e2a4c6b-8d1f-4a3e-9b5c-7d9f1a3c5e7b",
    "labels": ["refund", "escalated"],
    "custom_fields": { "refund_reference": "RF-99120" }
  }'

Response#

200 with the updated ticket object. The ETag header holds the new version.

JSON
{
  "id": "2f9c7e1a-5b3d-4c8e-9a6f-1d0e2b4c6a8f",
  "key": "SUP-1042",
  "title": "Refund not received for order 58213",
  "status": { "id": "5c8a1d3e-7f2b-4e6a-9b0c-d4e1f2a3b5c6", "name": "Open", "category": "open", "color": "blue" },
  "status_category": "open",
  "priority": "p1",
  "assignee": {
    "id": "0e2a4c6b-8d1f-4a3e-9b5c-7d9f1a3c5e7b",
    "name": "Arjun Mehta",
    "email": "arjun@yourcompany.com",
    "avatar_url": null
  },
  "labels": ["escalated", "refund"],
  "custom_fields": { "order_id": "58213", "refund_reference": "RF-99120" },
  "version": 5,
  "updated_at": "2026-11-25T09:41:07.220000+00:00"
}

The example is shortened; the response has every ticket field. A change fires the ticket.updated webhook with the changed fields, and ticket.assigned when the assignee or team changed. The new assignee becomes a watcher.

Errors#

StatuscodeWhen
403missing_capabilityYou assigned someone else without tickets.assign, or changed restricted without being an admin
404ticket_not_foundNo ticket with this key or id, or you cannot see it
412version_mismatchThe ticket changed since the version in If-Match. data.current_version has the current one
422invalid_if_matchIf-Match is not a version number
422invalid_fieldsAn unknown field was sent, or a value has the wrong type
422invalid_priority, invalid_assignee, invalid_team, invalid_typeA value does not exist or is not allowed
422workflow_changeThe new type uses another workflow
422invalid_parentA ticket cannot be its own parent
422invalid_custom_fieldsA custom field value is wrong. See field_errors

List Available Transitions

See which statuses a LemuTickets ticket can move to from its current status

https://docs.lemuai.com/tickets-api/tickets/list-transitions

Returns the transitions a ticket can make from its current status, as set in the project's workflow. Use it to build "Start work", "Resolve" or "Close" buttons in your own system, and to find the transition_id or to_status for Transition a ticket.

GET/v1/tickets/{ref}/transitions

Needs the tickets.read scope.

Path parameters#

NameTypeRequiredDescription
refstringYesThe ticket key (SUP-1042) or id.

Example request:

cURL
curl https://api.tickets.lemuai.com/v1/tickets/SUP-1042/transitions \
  -H "Authorization: Bearer ltk_live_your_api_key"

Response#

200

JSON
{
  "data": [
    {
      "id": "e8a0c2d4-f6b1-4d3e-9a5c-7b9d1f3e5a7c",
      "name": "Start work",
      "to_status_id": "6e1f2a3b-8c4d-4f5e-a6b7-c8d9e0f1a2b3",
      "to_status": "In progress",
      "category": "open",
      "validators": {},
      "approval": {}
    },
    {
      "id": "a3c5e7b9-1d2f-4a4c-8e6b-0d2f4a6c8e1b",
      "name": "Ask customer",
      "to_status_id": "8b3c4d5e-0f6a-4b7c-c8d9-e0f1a2b3c4d5",
      "to_status": "Waiting on customer",
      "category": "waiting",
      "validators": { "require_comment": true },
      "approval": {}
    },
    {
      "id": "b1d3f5a7-9c2e-4b4d-8f6a-1c3e5a7b9d0f",
      "name": "Resolve",
      "to_status_id": "7a2b3c4d-9e5f-4a6b-b7c8-d9e0f1a2b3c4",
      "to_status": "Resolved",
      "category": "done",
      "validators": { "required_fields": ["resolution_note"] },
      "approval": {}
    }
  ]
}
FieldTypeDescription
idstring or nullThe transition's id, for transition_id. null when the workflow lets tickets move to any status.
namestringThe button label, for example Resolve.
to_status_idstringThe status the ticket moves to.
to_statusstringThat status's name.
categorystringThat status's category: new, open, waiting or done.
validatorsobjectWhat the transition needs: required_fields (field names that must have a value) and require_comment. Only on workflows with defined transitions.
approvalobjectSet when the transition needs approval first. Empty otherwise. Only on workflows with defined transitions.

A transition can still be refused when you try it, for example when it is limited to some roles or to the assignee.

Errors#

StatuscodeWhen
404ticket_not_foundNo ticket with this key or id, or you cannot see it

Transition a Ticket

Move a LemuTickets ticket to another status in its workflow, with an optional comment

https://docs.lemuai.com/tickets-api/tickets/transition

Moves a ticket to another status, following the project's workflow. You can add a comment and change fields in the same request.

POST/v1/tickets/{ref}/transitions

Needs the tickets.write scope in the ticket's project.

Path parameters#

NameTypeRequiredDescription
refstringYesThe ticket key (SUP-1042) or id.

Headers#

NameRequiredDescription
If-MatchNoThe version you last read. If the ticket changed since, nothing happens and you get 412. See versions and If-Match.

Request body#

Send either to_status or transition_id.

FieldTypeRequiredDescription
to_statusstringOne of the twoThe status to move to, by name (Resolved, not case sensitive) or id.
transition_idstring (UUID)One of the twoA transition id from List available transitions.
commentstringNoA comment to add with the move. Some transitions require one.
comment_visibilitystringNointernal (default) for a note to your team, or public to reply to the requester.
fieldsobjectNoTicket fields to change at the same time, with the same names as Update a ticket, for example {"priority": "p3"}.

If the transition has required_fields, they must already have a value or be set in fields. For required custom fields, set them with Update a ticket first.

Example request:

cURL
curl -X POST https://api.tickets.lemuai.com/v1/tickets/SUP-1042/transitions \
  -H "Authorization: Bearer ltk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -H "If-Match: 5" \
  -d '{
    "to_status": "Resolved",
    "comment": "Your refund of Rs 4,250 was processed today. It reaches your account in 3 to 5 working days.",
    "comment_visibility": "public"
  }'

Response#

200 with the updated ticket object.

JSON
{
  "id": "2f9c7e1a-5b3d-4c8e-9a6f-1d0e2b4c6a8f",
  "key": "SUP-1042",
  "title": "Refund not received for order 58213",
  "status": { "id": "7a2b3c4d-9e5f-4a6b-b7c8-d9e0f1a2b3c4", "name": "Resolved", "category": "done", "color": "green" },
  "status_category": "done",
  "priority": "p1",
  "first_response_at": "2026-11-25T10:02:18.640000+00:00",
  "resolved_at": "2026-11-25T10:02:18.640000+00:00",
  "closed_at": null,
  "version": 8,
  "updated_at": "2026-11-25T10:02:18.640000+00:00"
}

The example is shortened; the response has every ticket field.

Moving to a status in the done category sets resolved_at (or closed_at for a final status) and fires ticket.resolved or ticket.closed. Moving a done ticket back to another category reopens it: reopened_count goes up and ticket.reopened fires. Every move fires ticket.transitioned. See Webhooks.

When the transition needs approval#

If the transition needs approval, the ticket does not move yet. The response is the ticket in its current status, with a notes object:

JSON
{
  "key": "SUP-1042",
  "status_category": "open",
  "notes": {
    "transition_blocked": true,
    "approval_request_id": "c7e9b1d3-5f2a-4c6e-8b0d-3f5a7c9e1b2d",
    "approval_required": {
      "status": "pending",
      "created": true,
      "approver_user_ids": ["0e2a4c6b-8d1f-4a3e-9b5c-7d9f1a3c5e7b"],
      "approver_roles": []
    }
  }
}

Once approved, the transition is made with the comment and fields you sent. notes can also appear with other information, such as how the ticket was assigned. Always check status_category to see where the ticket ended up.

Errors#

StatuscodeWhen
403transition_forbiddenThe transition is limited to certain roles, or to the assignee
403transition_conditionThe ticket does not meet the transition's conditions
404ticket_not_foundNo ticket with this key or id, or you cannot see it
412version_mismatchThe ticket changed since the version in If-Match
422missing_targetNeither to_status nor transition_id was sent
422invalid_statusNo status with that name or id in this ticket's workflow
422invalid_transitionThe ticket cannot move to that status from its current status. data has from and to
422transition_validationA required field or comment is missing. field_errors lists them

Moving a ticket to the status it is already in does nothing and returns 200.

Add a Comment

Reply to the requester on their channel or add an internal note to a LemuTickets ticket

https://docs.lemuai.com/tickets-api/tickets/add-comment

Adds a comment to a ticket. A comment is either:

  • a public reply, sent to the requester on the ticket's channel (email, WhatsApp, the portal), or
  • an internal note, seen only by your team.
POST/v1/tickets/{ref}/comments

A public reply needs the tickets.write scope. An internal note needs comments.internal.

Path parameters#

NameTypeRequiredDescription
refstringYesThe ticket key (SUP-1042) or id.

Headers#

NameRequiredDescription
Idempotency-KeyNo, but recommendedA unique value for this comment. Sending the same request again returns the first comment instead of posting twice. See idempotency keys.

Request body#

FieldTypeRequiredDescription
bodystringYesThe text. Plain text or simple HTML.
visibilitystringNointernal (default) or public.
channelstringNoFor public replies: email, whatsapp, portal, slack or voice. Defaults to the channel the ticket came in on.
mentionsarray of UUIDsNoUsers to mention. They are notified and become watchers.
attachment_idsarray of UUIDsNoFiles from Upload an attachment to attach to this comment.
whatsapp_templateobjectNoAn approved WhatsApp template (name, language, variables) to send instead of free text. WhatsApp only allows free text within 24 hours of the customer's last message.

Public replies on WhatsApp go out through Lemu AI, so your organization needs the Lemu AI connection set up in LemuTickets. A ticket that came from a phone call has no channel to reply on: the reply is saved on the ticket but not sent.

Example request:

cURL
curl -X POST https://api.tickets.lemuai.com/v1/tickets/SUP-1042/comments \
  -H "Authorization: Bearer ltk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: erp-note-77812" \
  -d '{
    "body": "Finance confirmed the refund was approved. Reference RF-99120.",
    "visibility": "internal",
    "mentions": ["0e2a4c6b-8d1f-4a3e-9b5c-7d9f1a3c5e7b"]
  }'

Response#

201

JSON
{
  "id": "c5e7a9b1-d3f2-4c6e-8a0b-2e4c6a8b0d1f",
  "ticket_id": "2f9c7e1a-5b3d-4c8e-9a6f-1d0e2b4c6a8f",
  "visibility": "internal",
  "body": "Finance confirmed the refund was approved. Reference RF-99120.",
  "body_text": "Finance confirmed the refund was approved. Reference RF-99120.",
  "author_type": "user",
  "author": {
    "type": "user",
    "id": "d1f3b5a7-c9e2-4b4d-8f6a-0c2e4a6b8d0f",
    "name": "API: ERP sync",
    "avatar_url": null
  },
  "channel": "none",
  "delivery_status": null,
  "delivery_error": null,
  "mentions": ["0e2a4c6b-8d1f-4a3e-9b5c-7d9f1a3c5e7b"],
  "meta": {},
  "attachments": [],
  "created_at": "2026-11-25T09:52:11.018000+00:00",
  "edited_at": null
}
FieldTypeDescription
idstringThe comment's id.
ticket_idstringThe ticket.
visibilitystringpublic or internal.
bodystringThe text as sent.
body_textstringThe text without HTML.
author_typestringuser, requester, ai or system.
authorobjecttype, id and name of the author (avatar_url for users).
channelstringWhere a public reply was sent: email, whatsapp, portal, slack, voice, or none for internal notes and replies with no channel.
delivery_statusstring or nullFor public replies sent on a channel: queued at first, then for example sent, delivered, read or failed. null when nothing is sent.
delivery_errorstring or nullWhy delivery failed.
mentionsarray of stringsMentioned user ids.
metaobjectExtra details, such as the WhatsApp template used.
attachmentsarrayFiles on the comment: id, filename, content_type, size_bytes.
created_atstringWhen it was added.
edited_atstring or nullWhen it was last edited.

Delivery happens after the response. Listen for the comment.delivery_updated webhook, or read the comment again with List comments, to see whether it arrived.

The first public reply on a ticket sets its first_response_at, which meets the first response SLA.

Errors#

StatuscodeWhen
403missing_capabilityThe key cannot write internal notes, or cannot reply to requesters
404ticket_not_foundNo ticket with this key or id, or you cannot see it
409idempotency_mismatchThe Idempotency-Key was used before with a different body
422invalid_fieldsbody is missing or visibility is not public or internal
422empty_commentbody only has spaces

List Comments

List the replies and internal notes on a LemuTickets ticket, oldest first

https://docs.lemuai.com/tickets-api/tickets/list-comments

Returns every comment on a ticket, oldest first: public replies (from your team, the requester, AI and automations) and internal notes.

GET/v1/tickets/{ref}/comments

Needs the tickets.read scope. Internal notes are only returned with the comments.internal scope.

Path parameters#

NameTypeRequiredDescription
refstringYesThe ticket key (SUP-1042) or id.

Query parameters#

NameTypeRequiredDescription
visibilitystringNopublic for replies only, internal for notes only. Default: both.

Example request:

cURL
curl -G https://api.tickets.lemuai.com/v1/tickets/SUP-1042/comments \
  -H "Authorization: Bearer ltk_live_your_api_key" \
  --data-urlencode "visibility=public"

Response#

200 with all comments at once (this list is not paged).

JSON
{
  "data": [
    {
      "id": "f4a6c8e0-2b1d-4f3a-9c5e-7b9d1f3a5c7e",
      "ticket_id": "2f9c7e1a-5b3d-4c8e-9a6f-1d0e2b4c6a8f",
      "visibility": "public",
      "body": "Hi, I still have not received the refund for order 58213.",
      "body_text": "Hi, I still have not received the refund for order 58213.",
      "author_type": "requester",
      "author": {
        "type": "requester",
        "id": "8b4d6f2a-0c1e-4a3b-9d5f-7e6a8c0b2d4f",
        "name": "Priya Sharma"
      },
      "channel": "email",
      "delivery_status": null,
      "delivery_error": null,
      "mentions": [],
      "meta": {},
      "attachments": [
        {
          "id": "a9c1e3b5-d7f2-4a4c-9e6b-8d0f2a4c6e8b",
          "filename": "bank-statement.pdf",
          "content_type": "application/pdf",
          "size_bytes": 182344
        }
      ],
      "created_at": "2026-11-25T09:40:02.771000+00:00",
      "edited_at": null
    },
    {
      "id": "1b3d5f7a-9c2e-4a4b-8d6f-0a2c4e6b8d1f",
      "ticket_id": "2f9c7e1a-5b3d-4c8e-9a6f-1d0e2b4c6a8f",
      "visibility": "public",
      "body": "Your refund of Rs 4,250 was processed today. It reaches your account in 3 to 5 working days.",
      "body_text": "Your refund of Rs 4,250 was processed today. It reaches your account in 3 to 5 working days.",
      "author_type": "user",
      "author": {
        "type": "user",
        "id": "0e2a4c6b-8d1f-4a3e-9b5c-7d9f1a3c5e7b",
        "name": "Arjun Mehta",
        "avatar_url": null
      },
      "channel": "email",
      "delivery_status": "sent",
      "delivery_error": null,
      "mentions": [],
      "meta": {},
      "attachments": [],
      "created_at": "2026-11-25T10:02:18.640000+00:00",
      "edited_at": null
    }
  ]
}

Each item has the fields described in Add a comment. Download links for attachments come from GET /v1/attachments/{attachment_id} (see Upload an attachment).

Errors#

StatuscodeWhen
404ticket_not_foundNo ticket with this key or id, or you cannot see it

Log Work

Record time spent on a LemuTickets ticket

https://docs.lemuai.com/tickets-api/tickets/log-work

Records time someone spent on a ticket. Logged time adds up in the ticket's time_spent_minutes and appears in reports, separately from how long the ticket was open.

POST/v1/tickets/{ref}/worklogs

Use a key with the tickets.write scope.

Path parameters#

NameTypeRequiredDescription
refstringYesThe ticket key (SUP-1042) or id.

Request body#

FieldTypeRequiredDescription
minutesintegerYesTime spent, 1 to 1440 (24 hours).
started_atstring (date-time)NoWhen the work started. Defaults to now.
notestringNoWhat was done.
billablebooleanNoWhether the time can be billed to the customer. Default false.
user_idstring (UUID)NoThe team member who did the work. Defaults to the caller: for an API key, the key's own user. Required with a client credentials token.

Example request:

cURL
curl -X POST https://api.tickets.lemuai.com/v1/tickets/SUP-1042/worklogs \
  -H "Authorization: Bearer ltk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "minutes": 45,
    "started_at": "2026-11-25T08:30:00+05:30",
    "note": "Checked the payment gateway logs and raised the refund.",
    "billable": false,
    "user_id": "0e2a4c6b-8d1f-4a3e-9b5c-7d9f1a3c5e7b"
  }'

This endpoint does not use idempotency keys. If you retry after a timeout, check the ticket's time_spent_minutes first so the time is not logged twice.

Response#

201

JSON
{
  "id": "b3d5f7a9-c1e2-4b6d-8f0a-2c4e6a8b0d2f",
  "minutes": 45,
  "total_minutes": 105
}
FieldTypeDescription
idstringThe worklog's id.
minutesintegerThe minutes logged by this request.
total_minutesintegerAll time logged on the ticket so far.

This fires the worklog.created webhook.

Errors#

StatuscodeWhen
404ticket_not_foundNo ticket with this key or id, or you cannot see it
422invalid_fieldsminutes is missing or not between 1 and 1440
422missing_userThe caller is not a user and no user_id was sent

Create or Update a Requester

Find a LemuTickets requester by email, phone or other ids, or create one

https://docs.lemuai.com/tickets-api/requesters/upsert

A requester is the customer who raises tickets: a person with a name, email, phone, WhatsApp number and, optionally, an account (their company). This endpoint finds the requester that matches the details you send, or creates one.

POST/v1/requesters

Needs the requesters.write scope.

To keep requesters in step with records in your ERP, Upsert a requester by external ID is usually simpler: it matches on your own id and updates exactly the fields you send.

How the requester is found#

LemuTickets looks for an existing requester in this order and uses the first match:

  1. lemu_contact_id
  2. email (not case sensitive)
  3. phone (formatting is ignored; numbers without a country code are read as +91)
  4. whatsapp_id
  5. external_id

If there is a match, empty details on it are filled in from your request. Details that are already set (by your team or an earlier request) are not overwritten. If there is no match, a new requester is created. A new requester whose email domain matches an account's domain is added to that account.

Request body#

FieldTypeRequiredDescription
namestringNoFull name.
emailstringNoEmail address.
phonestringNoPhone number, ideally in international format.
whatsapp_idstringNoWhatsApp number.
external_idstringNoYour own id for the customer.
account_idstring (UUID)NoThe account (company) the requester belongs to.
languagestringNoPreferred language, for example en or hi.
lemu_contact_idintegerNoThe contact's id in Lemu AI, if you use both products.
is_vipbooleanNoMark as VIP. Default false.
tagsarray of stringsNoTags.
custom_fieldsobjectNoExtra values. Merged into existing custom fields.

Send at least one of email, phone, whatsapp_id, external_id or lemu_contact_id, or every request creates a new requester.

is_vip and tags always replace the stored values, even on an existing requester. If you leave them out, the requester's VIP flag is set to false and its tags are cleared. Send the current values, or use Upsert a requester by external ID, which only changes the fields you send.

Example request:

cURL
curl -X POST https://api.tickets.lemuai.com/v1/requesters \
  -H "Authorization: Bearer ltk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Priya Sharma",
    "email": "priya@example.com",
    "phone": "98765 43210",
    "account_id": "4a6c8e0b-2d1f-4b3a-8c5e-9f7d1b3a5c6e",
    "language": "en",
    "is_vip": true,
    "tags": ["distributor"],
    "custom_fields": { "gstin": "29ABCDE1234F1Z5" }
  }'

Response#

201 with the requester, whether it was created or found.

JSON
{
  "id": "8b4d6f2a-0c1e-4a3b-9d5f-7e6a8c0b2d4f",
  "name": "Priya Sharma",
  "email": "priya@example.com",
  "phone": "+919876543210",
  "whatsapp_id": null,
  "account_id": "4a6c8e0b-2d1f-4b3a-8c5e-9f7d1b3a5c6e",
  "language": "en",
  "is_vip": true,
  "external_id": null,
  "lemu_contact_id": null,
  "tags": ["distributor"],
  "custom_fields": { "gstin": "29ABCDE1234F1Z5" },
  "anonymised": false,
  "created_at": "2026-11-25T09:05:12.330000+00:00",
  "open_tickets": null
}

Requester fields#

FieldTypeDescription
idstringThe requester's id. Use it as requester_id when creating tickets.
namestringFull name.
emailstring or nullEmail, stored in lower case. Partly hidden without the pii.read scope.
phonestring or nullPhone in international format. Partly hidden without pii.read.
whatsapp_idstring or nullWhatsApp number. Partly hidden without pii.read.
account_idstring or nullThe account (company).
languagestring or nullPreferred language.
is_vipbooleanMarked as VIP. Find their tickets with the TQL query requester.vip = true.
external_idstring or nullYour own id.
lemu_contact_idinteger or nullThe matching Lemu AI contact, if any.
tagsarray of stringsTags.
custom_fieldsobjectExtra values.
anonymisedbooleantrue if the requester's personal data was erased.
created_atstringWhen the requester was created.
open_ticketsinteger or nullTickets that are not done. Filled in by List requesters; null here.

Errors#

StatuscodeWhen
403missing_capabilityThe key does not have requesters.write
422invalid_fieldsA field has the wrong type

Upsert a Requester by External ID

Create or update a LemuTickets requester using your own customer id

https://docs.lemuai.com/tickets-api/requesters/upsert-by-external-id

Creates or updates the requester with your own id for the customer, for example the customer number in your ERP. Use it whenever a customer record is created or changes in your system.

PUT/v1/requesters/by-external-id/{external_id}

Needs the requesters.write scope.

Path parameters#

NameTypeRequiredDescription
external_idstringYesYour own id for the customer, URL-encoded.

How it works#

  • A requester with this external_id exists: the fields you send are updated. Fields you leave out keep their values.
  • None exists yet: LemuTickets looks for the same person by email, phone or WhatsApp number (see how the requester is found), or creates a new requester, and then applies the fields you send. Later requests with the same id update the same requester.

Request body#

The same fields as Create or update a requester, all optional. external_id in the body is ignored; the one in the path is used.

FieldWhat happens
name, email, phone, whatsapp_id, account_id, language, is_vip, lemu_contact_idSet to the value you send.
tagsReplaces all tags.
custom_fieldsReplaces all custom fields.

Example request:

cURL
curl -X PUT https://api.tickets.lemuai.com/v1/requesters/by-external-id/CUST-20931 \
  -H "Authorization: Bearer ltk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Priya Sharma",
    "email": "priya@example.com",
    "phone": "+919876543210",
    "account_id": "4a6c8e0b-2d1f-4b3a-8c5e-9f7d1b3a5c6e",
    "is_vip": true,
    "custom_fields": { "gstin": "29ABCDE1234F1Z5", "credit_limit": 500000 }
  }'

Response#

200 with the requester.

JSON
{
  "id": "8b4d6f2a-0c1e-4a3b-9d5f-7e6a8c0b2d4f",
  "name": "Priya Sharma",
  "email": "priya@example.com",
  "phone": "+919876543210",
  "whatsapp_id": null,
  "account_id": "4a6c8e0b-2d1f-4b3a-8c5e-9f7d1b3a5c6e",
  "language": "en",
  "is_vip": true,
  "external_id": "CUST-20931",
  "lemu_contact_id": null,
  "tags": ["distributor"],
  "custom_fields": { "gstin": "29ABCDE1234F1Z5", "credit_limit": 500000 },
  "anonymised": false,
  "created_at": "2026-11-25T09:05:12.330000+00:00",
  "open_tickets": null
}

See requester fields.

A requester created by this endpoint has your id in external_id. You can then use it to issue embed tokens (requester_external_id) and to search with GET /v1/requesters?q=CUST-20931.

Errors#

StatuscodeWhen
403missing_capabilityThe key does not have requesters.write
422invalid_fieldsA field has the wrong type

List Requesters

List and search the requesters (customers) in LemuTickets

https://docs.lemuai.com/tickets-api/requesters/list

Returns requesters a page at a time, newest first, with how many open tickets each one has.

GET/v1/requesters

Needs the requesters.read scope.

Query parameters#

NameTypeRequiredDescription
qstringNoSearch. Matches part of the name, email or phone, or the exact external_id.
account_idstring (UUID)NoOnly requesters in this account.
limitintegerNoRequesters per page, up to 200. Default 50.
cursorstringNoThe next_cursor from the previous page. See pagination.

Example request:

cURL
curl -G https://api.tickets.lemuai.com/v1/requesters \
  -H "Authorization: Bearer ltk_live_your_api_key" \
  --data-urlencode "q=priya" \
  --data-urlencode "limit=20"

Response#

200

JSON
{
  "data": [
    {
      "id": "8b4d6f2a-0c1e-4a3b-9d5f-7e6a8c0b2d4f",
      "name": "Priya Sharma",
      "email": "priya@example.com",
      "phone": "+919876543210",
      "whatsapp_id": "+919876543210",
      "account_id": "4a6c8e0b-2d1f-4b3a-8c5e-9f7d1b3a5c6e",
      "language": "en",
      "is_vip": true,
      "external_id": "CUST-20931",
      "lemu_contact_id": 901,
      "tags": ["distributor"],
      "custom_fields": { "gstin": "29ABCDE1234F1Z5" },
      "anonymised": false,
      "created_at": "2026-11-25T09:05:12.330000+00:00",
      "open_tickets": 2
    }
  ],
  "next_cursor": null
}
FieldTypeDescription
dataarrayThe requesters on this page. See requester fields. open_tickets counts tickets that are not done.
next_cursorstring or nullPass as cursor for the next page. null on the last page.

Without the pii.read scope, email, phone and whatsapp_id are partly hidden, for example p•••@example.com.

Errors#

StatuscodeWhen
403missing_capabilityThe key does not have requesters.read
422invalid_fieldslimit is over 200, or account_id is not a UUID

Get a Requester

Get one LemuTickets requester with their account, recent tickets and average satisfaction score

https://docs.lemuai.com/tickets-api/requesters/get

Returns one requester with their account, their 50 most recent tickets and their average CSAT score. Useful for a customer view in your ERP.

GET/v1/requesters/{requester_id}

Needs the requesters.read scope.

Path parameters#

NameTypeRequiredDescription
requester_idstring (UUID)YesThe requester's id.

Example request:

cURL
curl https://api.tickets.lemuai.com/v1/requesters/8b4d6f2a-0c1e-4a3b-9d5f-7e6a8c0b2d4f \
  -H "Authorization: Bearer ltk_live_your_api_key"

Response#

200

JSON
{
  "id": "8b4d6f2a-0c1e-4a3b-9d5f-7e6a8c0b2d4f",
  "name": "Priya Sharma",
  "email": "priya@example.com",
  "phone": "+919876543210",
  "whatsapp_id": "+919876543210",
  "account_id": "4a6c8e0b-2d1f-4b3a-8c5e-9f7d1b3a5c6e",
  "language": "en",
  "is_vip": true,
  "external_id": "CUST-20931",
  "lemu_contact_id": 901,
  "tags": ["distributor"],
  "custom_fields": { "gstin": "29ABCDE1234F1Z5" },
  "anonymised": false,
  "created_at": "2026-11-25T09:05:12.330000+00:00",
  "open_tickets": null,
  "account": {
    "id": "4a6c8e0b-2d1f-4b3a-8c5e-9f7d1b3a5c6e",
    "name": "Sharma Traders",
    "tier": "premium"
  },
  "tickets": [
    {
      "id": "2f9c7e1a-5b3d-4c8e-9a6f-1d0e2b4c6a8f",
      "key": "SUP-1042",
      "title": "Refund not received for order 58213",
      "status_category": "done",
      "priority": "p1",
      "created_at": "2026-11-25T09:12:40.512000+00:00",
      "csat_score": 5
    },
    {
      "id": "6d8f0a2c-4e6b-4c8d-a0f2-c4e6a8b0d2f4",
      "key": "SUP-1039",
      "title": "Order 58213 cancelled without notice",
      "status_category": "open",
      "priority": "p2",
      "created_at": "2026-11-24T16:45:03.118000+00:00",
      "csat_score": null
    }
  ],
  "csat_average": 5.0
}

The response has the requester fields, plus:

FieldTypeDescription
accountobject or nullThe requester's account: id, name, tier.
ticketsarrayUp to 50 of the requester's tickets, newest first: id, key, title, status_category, priority, created_at, csat_score. Use List and search tickets with requester_id for all of them.
csat_averagenumber or nullThe average of the requester's ratings on these tickets, or null if they never rated one.

Errors#

StatuscodeWhen
403missing_capabilityThe key does not have requesters.read
404not_foundNo requester with this id

List Accounts

List and search the customer accounts (companies) in LemuTickets

https://docs.lemuai.com/tickets-api/accounts/list

An account is a customer company, such as a distributor, dealer or business customer. Requesters belong to an account, and tickets carry the requester's account. This endpoint returns accounts a page at a time, sorted by name, with how many open tickets each one has.

GET/v1/accounts

Needs the requesters.read scope.

Query parameters#

NameTypeRequiredDescription
qstringNoSearch. Matches part of the name, or the exact external_id.
limitintegerNoAccounts per page, up to 200. Default 50.
cursorstringNoThe next_cursor from the previous page. See pagination.

Example request:

cURL
curl -G https://api.tickets.lemuai.com/v1/accounts \
  -H "Authorization: Bearer ltk_live_your_api_key" \
  --data-urlencode "q=sharma"

Response#

200

JSON
{
  "data": [
    {
      "id": "4a6c8e0b-2d1f-4b3a-8c5e-9f7d1b3a5c6e",
      "name": "Sharma Traders",
      "domains": ["sharmatraders.in"],
      "tier": "premium",
      "owner_user_id": "0e2a4c6b-8d1f-4a3e-9b5c-7d9f1a3c5e7b",
      "phone": "+918041234567",
      "address": "14 MG Road",
      "city": "Bengaluru",
      "region": "Karnataka",
      "notes": "",
      "health": "good",
      "external_id": "DIST-0412",
      "custom_fields": { "gstin": "29ABCDE1234F1Z5" },
      "created_at": "2026-10-02T11:20:45.000000+00:00",
      "open_tickets": 3
    }
  ],
  "next_cursor": null
}
FieldTypeDescription
idstringThe account's id.
namestringCompany name.
domainsarray of stringsEmail domains. New requesters with an email at one of these domains join the account automatically.
tierstringstandard, premium or enterprise. Use it in TQL as account.tier.
owner_user_idstring or nullThe team member who owns the relationship.
phone, address, city, regionstring or nullContact details.
notesstringFree-text notes.
healthstring or nullgood, at_risk or unhappy, when set.
external_idstring or nullYour own id for the account, for example the customer code in your ERP.
custom_fieldsobjectExtra values.
created_atstringWhen the account was created.
open_ticketsintegerTickets on the account that are not done.
next_cursorstring or nullPass as cursor for the next page. null on the last page.

Errors#

StatuscodeWhen
403missing_capabilityThe key does not have requesters.read
422invalid_fieldslimit is over 200

List Projects

List the LemuTickets projects you can create tickets in

https://docs.lemuai.com/tickets-api/projects/list

A project is where tickets live, for example SUP for customer support or LOG for logistics. Each project has its own ticket types, workflow, fields and SLAs. This endpoint returns every project the key can access, sorted by name.

GET/v1/projects

Needs the projects.read scope.

Query parameters#

NameTypeRequiredDescription
include_archivedbooleanNoAlso return archived projects. Default false.

Example request:

cURL
curl https://api.tickets.lemuai.com/v1/projects \
  -H "Authorization: Bearer ltk_live_your_api_key"

Response#

200 with all projects at once (this list is not paged).

JSON
{
  "data": [
    {
      "id": "3b0f6c1e-8a2d-4f5b-9c71-0e4d2a6b8f13",
      "key": "SUP",
      "name": "Customer Support",
      "description": "Complaints and requests from customers on every channel",
      "type": "service_desk",
      "visibility": "open",
      "lead_user_id": "0e2a4c6b-8d1f-4a3e-9b5c-7d9f1a3c5e7b",
      "default_team_id": "1c3e5a7b-9d2f-4e6a-b8c0-a2e4f6b8d0c1",
      "default_type_id": "9d2e4f60-1b3a-4c8d-a7e5-6f0b2c9d1e47",
      "color": "blue",
      "icon": "headset",
      "settings": {},
      "external_id": null,
      "archived": false,
      "created_at": "2026-10-01T06:30:00.000000+00:00",
      "open_tickets": 128,
      "permissions": null
    }
  ]
}

Project fields#

FieldTypeDescription
idstringThe project's id.
keystringThe short key used in ticket keys, for example SUP. Use it as project when creating tickets.
namestringThe project's name.
descriptionstringWhat the project is for.
typestringservice_desk, task_tracker, field_service, incident, itsm or internal_ops.
visibilitystringopen (every member sees it) or private (project members only).
lead_user_idstring or nullThe project lead.
default_team_idstring or nullNew tickets go to this team when no one is assigned.
default_type_idstring or nullThe ticket type used when you don't send type.
color, iconstringHow the project looks in the app.
settingsobjectProject settings.
external_idstring or nullYour own id for the project.
archivedbooleanArchived projects take no new tickets.
created_atstringWhen the project was created.
open_ticketsintegerTickets in the project that are not done.
permissionsarray or nullOnly on Get a project: what the caller may do in this project. null in this list.

Errors#

StatuscodeWhen
403missing_capabilityThe key does not have projects.read

Get a Project

Get one LemuTickets project with its ticket types, workflow statuses and transitions

https://docs.lemuai.com/tickets-api/projects/get

Returns one project with its ticket types and workflows. Use it to learn the status names, categories and transitions to use in your integration, and the ticket type names you can send when creating tickets.

GET/v1/projects/{ref}

Needs the projects.read scope in the project.

Path parameters#

NameTypeRequiredDescription
refstringYesThe project key (SUP, not case sensitive) or id.

Example request:

cURL
curl https://api.tickets.lemuai.com/v1/projects/SUP \
  -H "Authorization: Bearer ltk_live_your_api_key"

Response#

200

JSON
{
  "id": "3b0f6c1e-8a2d-4f5b-9c71-0e4d2a6b8f13",
  "key": "SUP",
  "name": "Customer Support",
  "description": "Complaints and requests from customers on every channel",
  "type": "service_desk",
  "visibility": "open",
  "lead_user_id": "0e2a4c6b-8d1f-4a3e-9b5c-7d9f1a3c5e7b",
  "default_team_id": "1c3e5a7b-9d2f-4e6a-b8c0-a2e4f6b8d0c1",
  "default_type_id": "9d2e4f60-1b3a-4c8d-a7e5-6f0b2c9d1e47",
  "color": "blue",
  "icon": "headset",
  "settings": {},
  "external_id": null,
  "archived": false,
  "created_at": "2026-10-01T06:30:00.000000+00:00",
  "open_tickets": 128,
  "permissions": ["comments.internal", "projects.read", "requesters.read", "requesters.write", "tickets.read", "tickets.write"],
  "types": [
    {
      "id": "9d2e4f60-1b3a-4c8d-a7e5-6f0b2c9d1e47",
      "project_id": "3b0f6c1e-8a2d-4f5b-9c71-0e4d2a6b8f13",
      "name": "Complaint",
      "description": "",
      "icon": "message-square-warning",
      "color": "red",
      "workflow_id": "2c4e6a8b-0d1f-4a3c-9e5b-7d9f1b3d5f7a",
      "sla_policy_id": "7e9a1c3b-5d2f-4a6e-8b0c-1d3f5a7c9e2b",
      "field_layout": [],
      "is_subtask": false,
      "archived": false
    }
  ],
  "workflows": [
    {
      "id": "2c4e6a8b-0d1f-4a3c-9e5b-7d9f1b3d5f7a",
      "name": "Service desk",
      "description": "",
      "project_id": "3b0f6c1e-8a2d-4f5b-9c71-0e4d2a6b8f13",
      "initial_status_id": "4d7b9e1f-3a5c-4e8b-a0d2-f4b6c8e0a1d3",
      "allow_any_transition": false,
      "layout": {},
      "statuses": [
        {
          "id": "4d7b9e1f-3a5c-4e8b-a0d2-f4b6c8e0a1d3",
          "name": "New",
          "category": "new",
          "color": "sky",
          "position": 0,
          "pauses_sla": false,
          "is_resolution": false,
          "is_final": false,
          "wip_limit": null
        },
        {
          "id": "7a2b3c4d-9e5f-4a6b-b7c8-d9e0f1a2b3c4",
          "name": "Resolved",
          "category": "done",
          "color": "green",
          "position": 5,
          "pauses_sla": false,
          "is_resolution": true,
          "is_final": false,
          "wip_limit": null
        }
      ],
      "transitions": [
        {
          "id": "b1d3f5a7-9c2e-4b4d-8f6a-1c3e5a7b9d0f",
          "name": "Resolve",
          "from_status_id": null,
          "to_status_id": "7a2b3c4d-9e5f-4a6b-b7c8-d9e0f1a2b3c4",
          "conditions": {},
          "validators": {},
          "post_actions": [],
          "approval": {}
        }
      ]
    }
  ]
}

The response has the project fields (with permissions filled in), plus:

FieldTypeDescription
permissionsarray of stringsThe scopes the caller has in this project.
typesarrayThe project's ticket types: id, name, description, icon, color, the workflow_id it uses, its sla_policy_id, is_subtask and archived.
workflowsarrayThe workflows the types use (shortened above).

Each workflow has:

FieldDescription
initial_status_idThe status new tickets start in.
allow_any_transitiontrue if tickets can move to any status, ignoring transitions.
statusesEach status: id, name, category (new, open, waiting, done), color, position, pauses_sla (the SLA clock stops in this status), is_resolution (reaching it counts as resolved), is_final (reaching it closes the ticket) and wip_limit.
transitionsEach transition: id, name, from_status_id (null means from any status), to_status_id, conditions (who may use it), validators (required_fields, require_comment), post_actions and approval.

Errors#

StatuscodeWhen
403missing_capabilityThe key does not have projects.read in this project
404project_not_foundNo project with this key or id, or the key cannot access it

Upload an Attachment

Upload a file to a LemuTickets ticket, or to attach to a comment

https://docs.lemuai.com/tickets-api/attachments/upload

Uploads a file of up to 25 MB, such as an invoice, a photo of a damaged product or a log file. You can attach it to a ticket straight away, or upload it first and then attach it to a comment with Add a comment (attachment_ids).

POST/v1/attachments

Attaching to a ticket needs the tickets.write scope in the ticket's project.

Request body#

Send the file as multipart/form-data, not JSON.

FieldTypeRequiredDescription
filefileYesThe file. Up to 25 MB.
ticketstringNoThe ticket key (SUP-1042) or id to attach the file to. Leave it out to upload a file for a comment you post next.
inlinebooleanNotrue for an image shown inside a comment's text rather than as a separate file. Default false.

Executables and scripts are refused, by extension (for example .exe, .msi, .bat, .sh, .js, .apk, .dmg, .ps1, .vbs, .jar) and by content.

Example request:

cURL
curl -X POST https://api.tickets.lemuai.com/v1/attachments \
  -H "Authorization: Bearer ltk_live_your_api_key" \
  -F "file=@invoice-58213.pdf;type=application/pdf" \
  -F "ticket=SUP-1042"

To attach the file to a comment, upload it without ticket (or with the same ticket), then send its id in attachment_ids:

cURL
curl -X POST https://api.tickets.lemuai.com/v1/tickets/SUP-1042/comments \
  -H "Authorization: Bearer ltk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "body": "Please find the credit note attached.",
    "visibility": "public",
    "attachment_ids": ["a9c1e3b5-d7f2-4a4c-9e6b-8d0f2a4c6e8b"]
  }'

Response#

201

JSON
{
  "id": "a9c1e3b5-d7f2-4a4c-9e6b-8d0f2a4c6e8b",
  "filename": "invoice-58213.pdf",
  "content_type": "application/pdf",
  "size_bytes": 182344,
  "scan_status": "clean",
  "inline": false,
  "ticket_id": "2f9c7e1a-5b3d-4c8e-9a6f-1d0e2b4c6a8f",
  "comment_id": null,
  "created_at": "2026-11-25T10:05:33.902000+00:00",
  "download_url": "<signed link to the file>",
  "download_expires_in": 900
}
FieldTypeDescription
idstringThe attachment's id. Use it in attachment_ids.
filenamestringThe file name, cleaned of unsafe characters.
content_typestringThe file's type.
size_bytesintegerThe size.
scan_statusstringclean when the file is stored and can be downloaded.
inlinebooleanWhether it is an inline image.
ticket_idstring or nullThe ticket it belongs to.
comment_idstring or nullThe comment it belongs to, once attached to one.
created_atstringWhen it was uploaded.
download_urlstring or nullA link to download the file. It works for 15 minutes.
download_expires_ininteger or nullSeconds until download_url stops working (900).

Downloading a file#

download_url expires after 15 minutes, so don't store it. To get a fresh link later, call:

cURL
curl https://api.tickets.lemuai.com/v1/attachments/a9c1e3b5-d7f2-4a4c-9e6b-8d0f2a4c6e8b \
  -H "Authorization: Bearer ltk_live_your_api_key"

It returns the same fields with a new download_url.

Errors#

StatuscodeWhen
404ticket_not_foundticket does not exist, or you cannot see it
422file_too_largeThe file is over 25 MB
422empty_fileThe file is empty
422blocked_file_typeThe file is an executable or script
422invalid_fieldsfile is missing

Create a Webhook

Subscribe a URL to LemuTickets events; the signing secret is returned once

https://docs.lemuai.com/tickets-api/webhook-subscriptions/create

Creates a webhook subscription: LemuTickets sends a signed POST to your URL for every matching event. See Webhooks for the event list, the payload, verifying signatures and retries.

POST/v1/webhooks

Needs the api_keys.manage scope.

Request body#

FieldTypeRequiredDescription
urlstringYesWhere to send events. https:// is recommended. Must resolve to a public address. Up to 1,000 characters.
eventsarray of stringsYesEvent names or patterns, for example ["ticket.created", "ticket.transitioned", "comment.*"]. Each must match at least one event.
descriptionstringNoA note for your team, for example ERP ticket sync.
project_idsarray of UUIDsNoOnly send events for tickets in these projects. Empty (default) means all projects and also events that are not about a ticket.
enabledbooleanNoDefault true. Set false to create it switched off.

Example request:

cURL
curl -X POST https://api.tickets.lemuai.com/v1/webhooks \
  -H "Authorization: Bearer ltk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://erp.example.com/lemutickets/webhook",
    "events": ["ticket.created", "ticket.transitioned", "ticket.updated", "comment.created"],
    "description": "ERP ticket sync",
    "project_ids": ["3b0f6c1e-8a2d-4f5b-9c71-0e4d2a6b8f13"]
  }'

Response#

201

JSON
{
  "id": "f2a4c6e8-0b1d-4f3a-8c5e-a7c9e1b3d5f7",
  "url": "https://erp.example.com/lemutickets/webhook",
  "description": "ERP ticket sync",
  "events": ["comment.created", "ticket.created", "ticket.transitioned", "ticket.updated"],
  "project_ids": ["3b0f6c1e-8a2d-4f5b-9c71-0e4d2a6b8f13"],
  "enabled": true,
  "failure_count": 0,
  "disabled_reason": null,
  "last_success_at": null,
  "last_failure_at": null,
  "created_at": "2026-11-25T10:10:00.120000+00:00",
  "updated_at": "2026-11-25T10:10:00.120000+00:00",
  "secret": "whsec_Lr6c0Xh2vJ9kQ1pT8sW3nB5mA7dF4gE2"
}

secret is only returned here. Store it straight away: you need it to verify signatures. If you lose it, issue a new one with Rotate secret in Settings → API keys and webhooks.

FieldTypeDescription
idstringThe webhook's id.
urlstringThe endpoint URL.
descriptionstringYour note.
eventsarray of stringsThe event patterns, sorted and without duplicates.
project_idsarray of stringsThe project filter. Empty means all.
enabledbooleanWhether events are being sent.
failure_countintegerFailed attempts in a row. Resets on a successful delivery.
disabled_reasonstring or nullWhy the webhook was turned off automatically, if it was.
last_success_at, last_failure_atstring or nullThe last successful and failed delivery.
created_at, updated_atstringTimestamps.
secretstringThe signing secret (whsec_...). Only in this response.

Errors#

StatuscodeWhen
403missing_capabilityThe key does not have api_keys.manage
422missing_eventsevents is empty
422invalid_eventsA pattern matches no event. data.unknown lists them
422invalid_urlThe URL does not start with http:// or https://
422private_addressThe URL points at a private, local or internal address
422unresolvable_hostThe URL's host name does not resolve

List Webhooks

List your organization's LemuTickets webhook subscriptions and their delivery health

https://docs.lemuai.com/tickets-api/webhook-subscriptions/list

Returns every webhook subscription in your organization, oldest first. Check enabled, failure_count and disabled_reason to spot an endpoint that stopped accepting deliveries.

GET/v1/webhooks

Needs the api_keys.manage scope.

Example request:

cURL
curl https://api.tickets.lemuai.com/v1/webhooks \
  -H "Authorization: Bearer ltk_live_your_api_key"

Response#

200 with all webhooks at once (this list is not paged).

JSON
{
  "data": [
    {
      "id": "f2a4c6e8-0b1d-4f3a-8c5e-a7c9e1b3d5f7",
      "url": "https://erp.example.com/lemutickets/webhook",
      "description": "ERP ticket sync",
      "events": ["comment.created", "ticket.created", "ticket.transitioned", "ticket.updated"],
      "project_ids": ["3b0f6c1e-8a2d-4f5b-9c71-0e4d2a6b8f13"],
      "enabled": true,
      "failure_count": 0,
      "disabled_reason": null,
      "last_success_at": "2026-11-25T10:02:21.447000+00:00",
      "last_failure_at": null,
      "created_at": "2026-11-25T10:10:00.120000+00:00",
      "updated_at": "2026-11-25T10:10:00.120000+00:00"
    }
  ]
}

The fields are described in Create a webhook. The signing secret is never returned here.

Errors#

StatuscodeWhen
403missing_capabilityThe key does not have api_keys.manage

Delete a Webhook

Remove a LemuTickets webhook subscription so no more events are sent to it

https://docs.lemuai.com/tickets-api/webhook-subscriptions/delete

Deletes a webhook subscription. No more events are sent to its URL. This cannot be undone; to stop deliveries for a while instead, turn off Send events on the webhook in Settings → API keys and webhooks.

DELETE/v1/webhooks/{webhook_id}

Needs the api_keys.manage scope.

Path parameters#

NameTypeRequiredDescription
webhook_idstring (UUID)YesThe webhook's id, from List webhooks.

Example request:

cURL
curl -X DELETE https://api.tickets.lemuai.com/v1/webhooks/f2a4c6e8-0b1d-4f3a-8c5e-a7c9e1b3d5f7 \
  -H "Authorization: Bearer ltk_live_your_api_key"

Response#

204 with no body.

Errors#

StatuscodeWhen
403missing_capabilityThe key does not have api_keys.manage
404webhook_not_foundNo webhook with this id
422invalid_fieldswebhook_id is not a UUID