Lelemon
  • Get started
  • Use cases
  • Guides
  • API basics
  • Webhooks
  • SDK, CLI and MCP
  • API reference
  • Changelog
  • v1 (legacy)
Information
Me
    Retrieve the current keyget
API keys
    List scopesget
Agents
    List agentsgetCreate an agentpostRetrieve an agentgetDelete an agentdeleteUpdate an agentpatchActivate an agentpostPause an agentpostList versionsgetRetrieve a versiongetRestore a versionpostList the fixed facts of an agentgetSave a fixed fact of an agentputForget a fixed fact of an agentdelete
Models and templates
    List agent templatesgetList modelsget
Subaccounts
    List subaccountsgetCreate a subaccountpostRetrieve a subaccountgetDelete a subaccountdeleteUpdate a subaccountpatchGive a subaccount its own keypost
WhatsApp
    List WhatsApp connectionsgetCreate a WhatsApp connection linkpostRetrieve a WhatsApp connectiongetRevoke a pending WhatsApp connectiondeleteList WhatsApp phone numbersgetRetrieve a WhatsApp phone numbergetDisconnect a WhatsApp phone numberdeleteChange the agent, label or state of a numberpatchRead the cart and catalog settings of a numbergetTurn the cart button or the catalog icon of a number on or offpatch
Actions
    List actionsgetCreate an actionpostRead the current authorization textgetRotate the signing secret of your actionspostRetrieve the signing secret of an actiongetRetrieve an actiongetDelete an actiondeleteUpdate an actionpatchTest an actionpostRead the approval floor of a shared actiongetSet the approval floor of a shared actionput
MCP servers
    List MCP serversgetConnect an MCP serverpostRetrieve an MCP servergetDisconnect an MCP serverdeleteUpdate an MCP serverpatchList the tools of an MCP servergetDiscover toolspostRead the run identity of an MCP servergetTurn on or rotate the run identity of an MCP serverpostTurn off the run identity of an MCP serverdelete
Data connectors
    Get the lelemon-connector/v1 formatgetValidate a connector documentpostList data connectorsgetRegister a data connectorpostRetrieve a data connectorgetDelete a data connectordeleteUpdate a data connectorpatchRetrieve the signing secret of a data connectorgetRotate the signing secret of a data connectorpostCheck a data connectorpostRetrieve the manifest of a data connectorgetSearch accounts by emailgetRead the card of an account livegetReveal one masked value of an accountpostGet the link of an account actionpostRead a view livegetList who looked at what through a connectorget
Skills
    List skillsgetCreate a skillpostRetrieve a skillgetDelete a skilldeleteUpdate a skillpatch
Agent tools
    List an agent's toolsgetGrant a toolputRemove a tooldelete
Approvals
    List approvalsgetRetrieve an approvalgetApprove an actionpostReject an actionpostAsk for a human review of a decisionpost
Automated decisions
    List automated decisionsgetRetrieve an automated decisiongetAsk for a human review of an automated decisionpost
Team questions
    List team questionsgetRetrieve a team questiongetRead a team question with its contextgetAnswer a team questionpost
Runs
    Give an agent a jobpostList runsgetRetrieve a rungetCancel a runpostAnswer a run that asked somethingpost
Schedules
    Schedule a job for an agentpostList scheduled tasksgetRetrieve a scheduled taskgetDelete a scheduled taskdeleteChange a scheduled taskpatchFire a scheduled task nowpost
Pipelines
    List pipelinesgetCreate a pipelinepostRetrieve a pipelinegetDelete a pipelinedeleteUpdate a pipelinepatchClone a pipelinepostReorder the stages of a pipelinepost
Stages
    List the stages of a pipelinegetCreate a stagepostRetrieve a stagegetDelete a stagedeleteUpdate a stagepatchMake a stage the entry stagepost
Fields
    List the fields of a pipelinegetCreate a fieldpostRetrieve a fieldgetDelete a fielddeleteUpdate a fieldpatch
Routing rules
    List the routing rules of a pipelinegetCreate a routing rulepostRetrieve a routing rulegetDelete a routing ruledeleteUpdate a routing rulepatch
Knowledge
    List collectionsgetCreate a collectionpostSearch the knowledgepostRetrieve a collectiongetDelete a collectiondeleteUpdate a collectionpatchList documentsgetAdd a documentpostRetrieve a documentgetDelete a documentdeleteUpdate a documentpatchLet an agent search a collectionputStop an agent from searching a collectiondelete
Contacts
    List contactsgetCreate a contactpostCreate or update a contact by your own idputRetrieve a contactgetErase a contactdeleteUpdate a contactpatch
Contact fields
    List the contact fieldsgetCreate a contact fieldpostRetrieve a contact fieldgetDelete a contact fielddeleteUpdate a contact fieldpatch
Companies
    List companiesgetCreate a companypostRetrieve a companygetDelete a companydeleteUpdate a companypatch
Lead forms
    List lead formsgetCreate a lead formpostRetrieve a lead formgetDelete a lead formdeleteUpdate a lead formpatch
Suppressions
    Retrieve a suppressionget
Cases
    List casesgetOpen a casepostRetrieve a casegetDelete a casedeleteUpdate a casepatchMove a case to a stagepostAssign a case to a memberpostClose a casepostReopen a casepostTake control of a casepostHand a case back to the agentpostMark a case as readpostMove several cases to a stagepostArchive a casepostBring an archived case backpostMute the contact of a casepostUnmute the contact of a casepostHand a case to a personpostReveal a sensitive field of a casepostEscalate a case to the technical teampostList the escalations of a caseget
Case queue
    Read the attention queue of a memberget
Contact events
    List the events of a contactgetReport a contact eventpostRetrieve a contact eventget
Case reminders
    List the reminders of a casegetAdd a reminder to a casepost
Reminders
    Retrieve a remindergetDelete a reminderdeleteEdit a reminderpatchComplete a reminderpostDismiss a reminderpost
Presence
    Report who is online in your apppostRead the presence settinggetTurn presence on or offput
Organization
    Get the organizationgetRename the organizationpatchGet the organization settingsgetChange the organization settingspatchGet the company profilegetChange the company profilepatch
Case notes
    List the notes of a casegetAdd a note to a casepostRetrieve a notegetDelete a notedeleteEdit a notepatch
Case attachments
    List the files of a casegetUpload a file to a casepostRetrieve a file of a casegetDelete a file of a casedeleteGet the download link of a fileget
Files
    List filesgetUpload a filepostRetrieve a filegetDelete a filedelete
Case messages
    List the messages of a casegetAdd a message to a casepostRedact a messagepost
Case turns
    List the turns the agent took in a caseget
Usage
    Get the usage of your agentsget
Case metrics
    List the times of the cases that changed in a rangeget
Budgets
    List the budgetsgetCreate a monthly budgetpostGet a budgetgetDelete a budgetdeleteChange a budgetpatch
Members
    List the active members of the organizationgetList who invited, changed the role of or removed membersgetRead whether a team member is availablegetMark a team member available or awayputChange the role of a memberpatchChange which cases a member seespatchRemove a member from the organizationdelete
Invitations
    List the invitations of the organizationgetInvite a person to the organizationpostResend an invitationpostCancel an invitationpost
Scheduling
    List the agendasgetCreate an agendapostRetrieve an agendagetUpdate an agendapatchList the team of an agendagetAdd a person to the team of an agendapostRemove a person from the team of an agendadeleteUpdate a person in the team of an agendapatchRead the free slots of an agendagetList meetingsgetBook a meetingpostRetrieve a meetinggetCancel a meetingpostMove a meeting to another slotpost
Webhook endpoints
    List webhook endpointsgetCreate a webhook endpointpostRetrieve a webhook endpointgetDelete a webhook endpointdeleteUpdate a webhook endpointpatchRotate the signing secretpostSend a test eventpostList the deliveries of an endpointget
Events
    Resend an eventpostList the event typesget
Recipient allowlist
    Get the recipient allowlistgetReplace the recipient allowlistput
WhatsApp templates
    List templatesgetCreate a templatepostSync template statusespostRetrieve a templategetDelete a templatedeleteUpdate a templatepatchRender a templatepostSend a test messagepost
WhatsApp messages
    Send a templatepostRetrieve a template messagegetCancel a scheduled messagepost
Triggers
    List triggersgetCreate a triggerpostRetrieve a triggergetDelete a triggerdeleteUpdate a triggerpatchList the runs of a triggerget
Opt-outs
    List opt-outsgetOpt a contact outputClear an opt-outdelete
Campaigns
    List campaignsgetCreate a campaignpostRetrieve a campaigngetDelete a campaigndeleteUpdate a campaignpatchPreview a campaignpostLaunch a campaignpostPause a campaignpostResume a campaignpostCancel a campaignpostList recipientsget
Email domains
    List the sender domainsgetAdd a sender domainpostGet a sender domain with its status and DNS recordsgetRemove a sender domaindeleteChange the default sender or the inbound agent of a domainpatchCheck the DNS records nowpost
Email messages
    Write first by emailpostRetrieve an email messageget
Teams
    List the teamsgetCreate a teampostRetrieve a teamgetDelete a teamdeleteUpdate a teampatchMerge another team into this onepostMove a pipeline into a teamputAdd a member to a team or change their role in itputRemove a member from a teamdelete
Linear
    Get the Linear connectiongetConnect LinearputDisconnect LineardeleteUpdate the Linear connectionpatch
Schemas
powered by Zudoku
Lelemon API
Lelemon API

Cases


List cases

GET
https://api.lelemon.cl
/v2/cases
Bearer (API key)

Newest first. This is the inbox: filter by pipelineId, stageId, status, assigneeId, contactId, control (agent or human), channel, phoneNumberId unread or presence=online (needs the contacts:presence-read scope).

Required scope: cases:read.

List cases › query Parameters

limit
​integer · min: 1 · max: 100
Default: 20
cursor
​string · maxLength: 512

The nextCursor of the previous page, with the same filters.

pipelineId
​string
stageId
​string
status
​string · enum
Enum values:
open
closed
assigneeId
​string
contactId
​string
control
​string · enum

human includes the cases the agent escalated.

Enum values:
agent
human
channel
​string · enum
Enum values:
whatsapp
api
in_app
email
phoneNumberId
​string
unread
​boolean

true: cases with messages of the contact not read yet. false: the rest.

presence
​string · enum

online: only cases whose contact is online now. Needs the contacts:presence-read scope. Answers 409 presence_not_configured when presence is not active, and 503 when the online list cannot be read.

Enum values:
online
archived
​boolean

true: only archived cases. false: only the ones on the board. Omit it for both.

List cases › Headers

Lelemon-Subaccount
​string · pattern: ^sub_[0-9A-Za-z]{22}…

The subaccount (sub_…) this request acts on. Only for the keys of a platform account; without it the request acts on the account itself.

List cases › Responses

CaseList
object
​string · enum · required
Enum values:
list
hasMore
​boolean · required
nextCursor
​string | null · required
​Case[] · required
GET/v2/cases
curl https://api.lelemon.cl/v2/cases \ --header 'Authorization: Bearer <token>'
Example Responses
{ "object": "list", "hasMore": true, "nextCursor": "nextCursor", "data": [ { "object": "case", "id": "cse_4Zq0x8bVw1TqS9mYp3RkLd", "contactId": "ctc_4Zq0x8bVw1TqS9mYp3RkLd", "pipelineId": "ppl_02y0e5MANqacVbmtn1YyeJ", "stageId": "stageId", "agentId": "agentId", "status": "open", "assigneeId": "assigneeId", "channel": "whatsapp", "phoneNumberId": "pn_4Zq0x8bVw1TqS9mYp3RkLd", "control": "agent", "agentState": "idle", "unread": 0, "lastMessageAt": "2024-08-25T15:00:00Z", "lastMessage": { "author": "contact", "type": "text", "text": "text" }, "contact": { "id": "ctc_4Zq0x8bVw1TqS9mYp3RkLd", "presence": { "online": true, "lastSeenAt": "2024-08-25T15:00:00Z" } }, "outcome": "outcome", "closedAt": "2024-08-25T15:00:00Z", "fields": {}, "tags": [ "string" ], "archivedAt": "2024-08-25T15:00:00Z", "muted": true, "createdAt": "2024-08-25T15:00:00Z", "updatedAt": "2024-08-25T15:00:00Z" } ] }
json
application/json

Open a case

POST
https://api.lelemon.cl
/v2/cases
Bearer (API key)

Opens a case for a contact: send contactId, or contact to find or create the person in the same call (by externalRef or phone, without changing a contact that exists). Say where it starts with stageId, pipelineId (its entry stage) or agentId (the pipeline where that agent attends the entry stage). With agentId the agent needs the api channel: 422 agent_channel_disabled otherwise. To talk to a copilot (audience internal) send its agentId and the pipelineId or stageId where the case lives; the copilot answers the messages written with author contact. A contact has one open case per pipeline: 409 conflict.

Required scope: cases:write.

Open a case › Headers

Lelemon-Subaccount
​string · pattern: ^sub_[0-9A-Za-z]{22}…

The subaccount (sub_…) this request acts on. Only for the keys of a platform account; without it the request acts on the account itself.

Idempotency-Key
​string · minLength: 1 · maxLength: 255

Makes the request safe to retry. Once it starts running, its final response (2xx, 4xx or 5xx) is kept for 24 hours and the same key gets it back, without repeating the effect. A request rejected before it runs leaves the key free. A replayed create omits the secret. The same key with a different request is rejected with 409 idempotency_key_reused.

Open a case › Request Body

oneOf
Exactly one variant must match.

Decision Table

VariantMatching Criteria
type = object · requires: contactId
type = object · requires: contact
Properties for contactId:
contactId
​string · required

The contact of the case. Send this or contact, never both (400 on contact).

agentId
​string

The agent that attends the case. It needs the api channel (422 agent_channel_disabled otherwise). Alone, the case opens in the pipeline where this agent attends the entry stage; if it attends the entry of more than one pipeline that is 422 on pipelineId, so send pipelineId or stageId too. A copilot (an agent with audience internal) attends no stage: send its pipelineId or stageId, the case answers with the copilot whatever agent the stage has, and email cases are refused.

pipelineId
​string

The case enters by the entry stage of this pipeline.

stageId
​string

The stage where the case starts.

channel
​string · enum

email opens a case you write to by email. The contact needs an email address and the organization a verified sender domain (422 contact_without_email, 422 sender_domain_not_verified). The agent needs the email channel.

Enum values:
api
email
Default: api
from
​string · maxLength: 320

With channel email, the sender address. It must belong to a verified domain. Defaults to the first verified domain.

Open a case › Responses

Case
object
​string · enum · required
Enum values:
case
id
​string · required
contactId
​string · required
pipelineId
​string · required
stageId
​string | null · required
agentId
​string | null · required

The agent that answers the case: the copilot of a copilot case, otherwise the agent of the current stage.

status
​string · enum · required
Enum values:
open
closed
assigneeId
​string | null · required
channel
​string | null · enum · required

Where the contact talks: whatsapp, email, api (your own system) or in_app. null when the case has no channel to write back.

Enum values:
whatsapp
api
in_app
email
phoneNumberId
​string | null · required

The WhatsApp number the contact wrote to, when it is a WhatsApp case.

control
​string · enum · required

Who answers the contact. human also covers a case the agent escalated and nobody took yet: see agentState.

Enum values:
agent
human
agentState
​string · enum · required

What the agent is doing, to drive a typing indicator: thinking and replying mean it is working; waiting_for_contact means it answered; escalated means it asked for a person; idle is everything else.

Enum values:
idle
thinking
replying
waiting_for_contact
escalated
unread
​integer · required

Messages of the contact since the last POST /v2/cases/{id}/read.

lastMessageAt
​string | null · date-time · required
​required

A preview of the last public message.

outcome
​string | null · required
closedAt
​string | null · date-time · required
​object · required

The values of the fields the pipeline declares, by key. Sensitive fields are not included.

tags
​string[] · required

The tags of the contact of the case.

archivedAt
​string | null · date-time · required

When the case was archived: out of the board, state untouched. null when it is on the board.

muted
​boolean · required

true while the contact is muted: the agent does not answer them and their open cases are closed. Muting belongs to the person, so every case of the contact shows it.

createdAt
​string · date-time · required
updatedAt
​string · date-time · required
​object

The contact with its presence. Present only on GET /v2/cases and GET /v2/cases/{id}, when the organization setting presenceEnabled is on, at least one presence signal has arrived, and the key has the contacts:presence-read scope.

POST/v2/cases
curl https://api.lelemon.cl/v2/cases \ --request POST \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer <token>' \ --data '{ "contactId": "ctc_02y0e5MANqacVbmtn1YyeJ", "agentId": "agt_02y0e5MANqacVbmtn1YyeJ", "pipelineId": "ppl_02y0e5MANqacVbmtn1YyeJ", "channel": "api" }'
Example Request Body
{ "contactId": "ctc_02y0e5MANqacVbmtn1YyeJ", "agentId": "agt_02y0e5MANqacVbmtn1YyeJ", "pipelineId": "ppl_02y0e5MANqacVbmtn1YyeJ", "channel": "api" }
json
application/json
Example Responses
{ "object": "case", "id": "cse_4Zq0x8bVw1TqS9mYp3RkLd", "contactId": "ctc_4Zq0x8bVw1TqS9mYp3RkLd", "pipelineId": "ppl_02y0e5MANqacVbmtn1YyeJ", "stageId": "stageId", "agentId": "agentId", "status": "open", "assigneeId": "assigneeId", "channel": "whatsapp", "phoneNumberId": "pn_4Zq0x8bVw1TqS9mYp3RkLd", "control": "agent", "agentState": "idle", "unread": 0, "lastMessageAt": "2024-08-25T15:00:00Z", "lastMessage": { "author": "contact", "type": "text", "text": "text" }, "contact": { "id": "ctc_4Zq0x8bVw1TqS9mYp3RkLd", "presence": { "online": true, "lastSeenAt": "2024-08-25T15:00:00Z" } }, "outcome": "outcome", "closedAt": "2024-08-25T15:00:00Z", "fields": {}, "tags": [ "string" ], "archivedAt": "2024-08-25T15:00:00Z", "muted": true, "createdAt": "2024-08-25T15:00:00Z", "updatedAt": "2024-08-25T15:00:00Z" }
json
application/json

Retrieve a case

GET
https://api.lelemon.cl
/v2/cases/{id}
Bearer (API key)

Returns one case by id. Use it to refresh a single record you already know; to find records, use the list route. Read only. 404 not_found when the id does not exist or belongs to another organization. You can repeat it safely: it has no side effects.

Required scope: cases:read.

Retrieve a case › path Parameters

id
​string · pattern: ^cse_[0-9A-Za-z]{22}… · required

The id of the case (cse_…).

Retrieve a case › Headers

Lelemon-Subaccount
​string · pattern: ^sub_[0-9A-Za-z]{22}…

The subaccount (sub_…) this request acts on. Only for the keys of a platform account; without it the request acts on the account itself.

Retrieve a case › Responses

Case
object
​string · enum · required
Enum values:
case
id
​string · required
contactId
​string · required
pipelineId
​string · required
stageId
​string | null · required
agentId
​string | null · required

The agent that answers the case: the copilot of a copilot case, otherwise the agent of the current stage.

status
​string · enum · required
Enum values:
open
closed
assigneeId
​string | null · required
channel
​string | null · enum · required

Where the contact talks: whatsapp, email, api (your own system) or in_app. null when the case has no channel to write back.

Enum values:
whatsapp
api
in_app
email
phoneNumberId
​string | null · required

The WhatsApp number the contact wrote to, when it is a WhatsApp case.

control
​string · enum · required

Who answers the contact. human also covers a case the agent escalated and nobody took yet: see agentState.

Enum values:
agent
human
agentState
​string · enum · required

What the agent is doing, to drive a typing indicator: thinking and replying mean it is working; waiting_for_contact means it answered; escalated means it asked for a person; idle is everything else.

Enum values:
idle
thinking
replying
waiting_for_contact
escalated
unread
​integer · required

Messages of the contact since the last POST /v2/cases/{id}/read.

lastMessageAt
​string | null · date-time · required
​required

A preview of the last public message.

outcome
​string | null · required
closedAt
​string | null · date-time · required
​object · required

The values of the fields the pipeline declares, by key. Sensitive fields are not included.

tags
​string[] · required

The tags of the contact of the case.

archivedAt
​string | null · date-time · required

When the case was archived: out of the board, state untouched. null when it is on the board.

muted
​boolean · required

true while the contact is muted: the agent does not answer them and their open cases are closed. Muting belongs to the person, so every case of the contact shows it.

createdAt
​string · date-time · required
updatedAt
​string · date-time · required
​object

The contact with its presence. Present only on GET /v2/cases and GET /v2/cases/{id}, when the organization setting presenceEnabled is on, at least one presence signal has arrived, and the key has the contacts:presence-read scope.

GET/v2/cases/{id}
curl https://api.lelemon.cl/v2/cases/:id \ --header 'Authorization: Bearer <token>'
Example Responses
{ "object": "case", "id": "cse_4Zq0x8bVw1TqS9mYp3RkLd", "contactId": "ctc_4Zq0x8bVw1TqS9mYp3RkLd", "pipelineId": "ppl_02y0e5MANqacVbmtn1YyeJ", "stageId": "stageId", "agentId": "agentId", "status": "open", "assigneeId": "assigneeId", "channel": "whatsapp", "phoneNumberId": "pn_4Zq0x8bVw1TqS9mYp3RkLd", "control": "agent", "agentState": "idle", "unread": 0, "lastMessageAt": "2024-08-25T15:00:00Z", "lastMessage": { "author": "contact", "type": "text", "text": "text" }, "contact": { "id": "ctc_4Zq0x8bVw1TqS9mYp3RkLd", "presence": { "online": true, "lastSeenAt": "2024-08-25T15:00:00Z" } }, "outcome": "outcome", "closedAt": "2024-08-25T15:00:00Z", "fields": {}, "tags": [ "string" ], "archivedAt": "2024-08-25T15:00:00Z", "muted": true, "createdAt": "2024-08-25T15:00:00Z", "updatedAt": "2024-08-25T15:00:00Z" }
json
application/json

Delete a case

DELETE
https://api.lelemon.cl
/v2/cases/{id}
Bearer (API key)

Deletes a case. To keep the history, close the case instead of deleting it. The effect is permanent through the API. Repeating the call returns 404 not_found, because the case no longer exists, so do not retry a 404 as a failure.

Required scope: cases:delete.

Delete a case › path Parameters

id
​string · pattern: ^cse_[0-9A-Za-z]{22}… · required

The id of the case (cse_…).

Delete a case › Headers

Lelemon-Subaccount
​string · pattern: ^sub_[0-9A-Za-z]{22}…

The subaccount (sub_…) this request acts on. Only for the keys of a platform account; without it the request acts on the account itself.

Delete a case › Responses

No data returned
DELETE/v2/cases/{id}
curl https://api.lelemon.cl/v2/cases/:id \ --request DELETE \ --header 'Authorization: Bearer <token>'
Example Responses
No example specified for this content type

Update a case

PATCH
https://api.lelemon.cl
/v2/cases/{id}
Bearer (API key)

Writes the values of fields the pipeline declares with source system. The stage, the assignee and the state change on their own routes.

Required scope: cases:write.

Update a case › path Parameters

id
​string · pattern: ^cse_[0-9A-Za-z]{22}… · required

The id of the case (cse_…).

Update a case › Headers

Lelemon-Subaccount
​string · pattern: ^sub_[0-9A-Za-z]{22}…

The subaccount (sub_…) this request acts on. Only for the keys of a platform account; without it the request acts on the account itself.

Update a case › Request Body optional

UpdateCase
​object

Values for fields the pipeline declares, by key, whoever fills them (team, channel, system or agent). A field marked sensitive is written but never returned: read it with POST /v2/cases/{id}/fields/{key}/reveal. Nothing is saved if one key is not accepted.

tags
​string[] · maxItems: 20

Replaces the tags of the case. Tags belong to the contact: the contact shows the same list, and so does every other case of the person.

Update a case › Responses

Case
object
​string · enum · required
Enum values:
case
id
​string · required
contactId
​string · required
pipelineId
​string · required
stageId
​string | null · required
agentId
​string | null · required

The agent that answers the case: the copilot of a copilot case, otherwise the agent of the current stage.

status
​string · enum · required
Enum values:
open
closed
assigneeId
​string | null · required
channel
​string | null · enum · required

Where the contact talks: whatsapp, email, api (your own system) or in_app. null when the case has no channel to write back.

Enum values:
whatsapp
api
in_app
email
phoneNumberId
​string | null · required

The WhatsApp number the contact wrote to, when it is a WhatsApp case.

control
​string · enum · required

Who answers the contact. human also covers a case the agent escalated and nobody took yet: see agentState.

Enum values:
agent
human
agentState
​string · enum · required

What the agent is doing, to drive a typing indicator: thinking and replying mean it is working; waiting_for_contact means it answered; escalated means it asked for a person; idle is everything else.

Enum values:
idle
thinking
replying
waiting_for_contact
escalated
unread
​integer · required

Messages of the contact since the last POST /v2/cases/{id}/read.

lastMessageAt
​string | null · date-time · required
​required

A preview of the last public message.

outcome
​string | null · required
closedAt
​string | null · date-time · required
​object · required

The values of the fields the pipeline declares, by key. Sensitive fields are not included.

tags
​string[] · required

The tags of the contact of the case.

archivedAt
​string | null · date-time · required

When the case was archived: out of the board, state untouched. null when it is on the board.

muted
​boolean · required

true while the contact is muted: the agent does not answer them and their open cases are closed. Muting belongs to the person, so every case of the contact shows it.

createdAt
​string · date-time · required
updatedAt
​string · date-time · required
​object

The contact with its presence. Present only on GET /v2/cases and GET /v2/cases/{id}, when the organization setting presenceEnabled is on, at least one presence signal has arrived, and the key has the contacts:presence-read scope.

PATCH/v2/cases/{id}
curl https://api.lelemon.cl/v2/cases/:id \ --request PATCH \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer <token>' \ --data '{ "fields": { "order_number": "ORD-1042" }, "tags": [ "vip" ] }'
Example Request Body
{ "fields": { "order_number": "ORD-1042" }, "tags": [ "vip" ] }
json
application/json
Example Responses
{ "object": "case", "id": "cse_4Zq0x8bVw1TqS9mYp3RkLd", "contactId": "ctc_4Zq0x8bVw1TqS9mYp3RkLd", "pipelineId": "ppl_02y0e5MANqacVbmtn1YyeJ", "stageId": "stageId", "agentId": "agentId", "status": "open", "assigneeId": "assigneeId", "channel": "whatsapp", "phoneNumberId": "pn_4Zq0x8bVw1TqS9mYp3RkLd", "control": "agent", "agentState": "idle", "unread": 0, "lastMessageAt": "2024-08-25T15:00:00Z", "lastMessage": { "author": "contact", "type": "text", "text": "text" }, "contact": { "id": "ctc_4Zq0x8bVw1TqS9mYp3RkLd", "presence": { "online": true, "lastSeenAt": "2024-08-25T15:00:00Z" } }, "outcome": "outcome", "closedAt": "2024-08-25T15:00:00Z", "fields": {}, "tags": [ "string" ], "archivedAt": "2024-08-25T15:00:00Z", "muted": true, "createdAt": "2024-08-25T15:00:00Z", "updatedAt": "2024-08-25T15:00:00Z" }
json
application/json

Move a case to a stage

POST
https://api.lelemon.cl
/v2/cases/{id}/move
Bearer (API key)

A stage of another pipeline moves the case to that pipeline, and so does pipelineId: both need the cases:reorganize scope on top of cases:write (403 scope_missing otherwise). 422 required_fields_missing, with param, when the stage requires a field the case lacks. A closed case is a 409.

Required scope: cases:write.

Move a case to a stage › path Parameters

id
​string · pattern: ^cse_[0-9A-Za-z]{22}… · required

The id of the case (cse_…).

Move a case to a stage › Headers

Lelemon-Subaccount
​string · pattern: ^sub_[0-9A-Za-z]{22}…

The subaccount (sub_…) this request acts on. Only for the keys of a platform account; without it the request acts on the account itself.

Idempotency-Key
​string · minLength: 1 · maxLength: 255

Makes the request safe to retry. Once it starts running, its final response (2xx, 4xx or 5xx) is kept for 24 hours and the same key gets it back, without repeating the effect. A request rejected before it runs leaves the key free. A replayed create omits the secret. The same key with a different request is rejected with 409 idempotency_key_reused.

Move a case to a stage › Request Body optional

MoveCase
stageId
​string

The stage to move to. A stage of another pipeline moves the case to that pipeline and needs the cases:reorganize scope. Send this or pipelineId, never both.

pipelineId
​string

Moves the case to the entry stage of this pipeline and needs the cases:reorganize scope. Send this or stageId, never both.

Move a case to a stage › Responses

Case
object
​string · enum · required
Enum values:
case
id
​string · required
contactId
​string · required
pipelineId
​string · required
stageId
​string | null · required
agentId
​string | null · required

The agent that answers the case: the copilot of a copilot case, otherwise the agent of the current stage.

status
​string · enum · required
Enum values:
open
closed
assigneeId
​string | null · required
channel
​string | null · enum · required

Where the contact talks: whatsapp, email, api (your own system) or in_app. null when the case has no channel to write back.

Enum values:
whatsapp
api
in_app
email
phoneNumberId
​string | null · required

The WhatsApp number the contact wrote to, when it is a WhatsApp case.

control
​string · enum · required

Who answers the contact. human also covers a case the agent escalated and nobody took yet: see agentState.

Enum values:
agent
human
agentState
​string · enum · required

What the agent is doing, to drive a typing indicator: thinking and replying mean it is working; waiting_for_contact means it answered; escalated means it asked for a person; idle is everything else.

Enum values:
idle
thinking
replying
waiting_for_contact
escalated
unread
​integer · required

Messages of the contact since the last POST /v2/cases/{id}/read.

lastMessageAt
​string | null · date-time · required
​required

A preview of the last public message.

outcome
​string | null · required
closedAt
​string | null · date-time · required
​object · required

The values of the fields the pipeline declares, by key. Sensitive fields are not included.

tags
​string[] · required

The tags of the contact of the case.

archivedAt
​string | null · date-time · required

When the case was archived: out of the board, state untouched. null when it is on the board.

muted
​boolean · required

true while the contact is muted: the agent does not answer them and their open cases are closed. Muting belongs to the person, so every case of the contact shows it.

createdAt
​string · date-time · required
updatedAt
​string · date-time · required
​object

The contact with its presence. Present only on GET /v2/cases and GET /v2/cases/{id}, when the organization setting presenceEnabled is on, at least one presence signal has arrived, and the key has the contacts:presence-read scope.

POST/v2/cases/{id}/move
curl https://api.lelemon.cl/v2/cases/:id/move \ --request POST \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer <token>' \ --data '{ "stageId": "stg_02y0e5MANqacVbmtn1YyeJ" }'
Example Request Body
{ "stageId": "stg_02y0e5MANqacVbmtn1YyeJ" }
json
application/json
Example Responses
{ "object": "case", "id": "cse_4Zq0x8bVw1TqS9mYp3RkLd", "contactId": "ctc_4Zq0x8bVw1TqS9mYp3RkLd", "pipelineId": "ppl_02y0e5MANqacVbmtn1YyeJ", "stageId": "stageId", "agentId": "agentId", "status": "open", "assigneeId": "assigneeId", "channel": "whatsapp", "phoneNumberId": "pn_4Zq0x8bVw1TqS9mYp3RkLd", "control": "agent", "agentState": "idle", "unread": 0, "lastMessageAt": "2024-08-25T15:00:00Z", "lastMessage": { "author": "contact", "type": "text", "text": "text" }, "contact": { "id": "ctc_4Zq0x8bVw1TqS9mYp3RkLd", "presence": { "online": true, "lastSeenAt": "2024-08-25T15:00:00Z" } }, "outcome": "outcome", "closedAt": "2024-08-25T15:00:00Z", "fields": {}, "tags": [ "string" ], "archivedAt": "2024-08-25T15:00:00Z", "muted": true, "createdAt": "2024-08-25T15:00:00Z", "updatedAt": "2024-08-25T15:00:00Z" }
json
application/json

Assign a case to a member

POST
https://api.lelemon.cl
/v2/cases/{id}/assign
Bearer (API key)

assigneeId null leaves the case unassigned. The assignment is recorded as made by whoever issued the key. When that person is a member they can only assign to people of their own team, as in the panel: 403 forbidden otherwise.

Required scope: cases:write.

Assign a case to a member › path Parameters

id
​string · pattern: ^cse_[0-9A-Za-z]{22}… · required

The id of the case (cse_…).

Assign a case to a member › Headers

Lelemon-Subaccount
​string · pattern: ^sub_[0-9A-Za-z]{22}…

The subaccount (sub_…) this request acts on. Only for the keys of a platform account; without it the request acts on the account itself.

Idempotency-Key
​string · minLength: 1 · maxLength: 255

Makes the request safe to retry. Once it starts running, its final response (2xx, 4xx or 5xx) is kept for 24 hours and the same key gets it back, without repeating the effect. A request rejected before it runs leaves the key free. A replayed create omits the secret. The same key with a different request is rejected with 409 idempotency_key_reused.

Assign a case to a member › Request Body

AssignCase
assigneeId
​string | null · required

An active member who can attend cases. null unassigns.

Assign a case to a member › Responses

Case
object
​string · enum · required
Enum values:
case
id
​string · required
contactId
​string · required
pipelineId
​string · required
stageId
​string | null · required
agentId
​string | null · required

The agent that answers the case: the copilot of a copilot case, otherwise the agent of the current stage.

status
​string · enum · required
Enum values:
open
closed
assigneeId
​string | null · required
channel
​string | null · enum · required

Where the contact talks: whatsapp, email, api (your own system) or in_app. null when the case has no channel to write back.

Enum values:
whatsapp
api
in_app
email
phoneNumberId
​string | null · required

The WhatsApp number the contact wrote to, when it is a WhatsApp case.

control
​string · enum · required

Who answers the contact. human also covers a case the agent escalated and nobody took yet: see agentState.

Enum values:
agent
human
agentState
​string · enum · required

What the agent is doing, to drive a typing indicator: thinking and replying mean it is working; waiting_for_contact means it answered; escalated means it asked for a person; idle is everything else.

Enum values:
idle
thinking
replying
waiting_for_contact
escalated
unread
​integer · required

Messages of the contact since the last POST /v2/cases/{id}/read.

lastMessageAt
​string | null · date-time · required
​required

A preview of the last public message.

outcome
​string | null · required
closedAt
​string | null · date-time · required
​object · required

The values of the fields the pipeline declares, by key. Sensitive fields are not included.

tags
​string[] · required

The tags of the contact of the case.

archivedAt
​string | null · date-time · required

When the case was archived: out of the board, state untouched. null when it is on the board.

muted
​boolean · required

true while the contact is muted: the agent does not answer them and their open cases are closed. Muting belongs to the person, so every case of the contact shows it.

createdAt
​string · date-time · required
updatedAt
​string · date-time · required
​object

The contact with its presence. Present only on GET /v2/cases and GET /v2/cases/{id}, when the organization setting presenceEnabled is on, at least one presence signal has arrived, and the key has the contacts:presence-read scope.

POST/v2/cases/{id}/assign
curl https://api.lelemon.cl/v2/cases/:id/assign \ --request POST \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer <token>' \ --data '{ "assigneeId": "mbr_02y0e5MANqacVbmtn1YyeJ" }'
Example Request Body
{ "assigneeId": "mbr_02y0e5MANqacVbmtn1YyeJ" }
json
application/json
Example Responses
{ "object": "case", "id": "cse_4Zq0x8bVw1TqS9mYp3RkLd", "contactId": "ctc_4Zq0x8bVw1TqS9mYp3RkLd", "pipelineId": "ppl_02y0e5MANqacVbmtn1YyeJ", "stageId": "stageId", "agentId": "agentId", "status": "open", "assigneeId": "assigneeId", "channel": "whatsapp", "phoneNumberId": "pn_4Zq0x8bVw1TqS9mYp3RkLd", "control": "agent", "agentState": "idle", "unread": 0, "lastMessageAt": "2024-08-25T15:00:00Z", "lastMessage": { "author": "contact", "type": "text", "text": "text" }, "contact": { "id": "ctc_4Zq0x8bVw1TqS9mYp3RkLd", "presence": { "online": true, "lastSeenAt": "2024-08-25T15:00:00Z" } }, "outcome": "outcome", "closedAt": "2024-08-25T15:00:00Z", "fields": {}, "tags": [ "string" ], "archivedAt": "2024-08-25T15:00:00Z", "muted": true, "createdAt": "2024-08-25T15:00:00Z", "updatedAt": "2024-08-25T15:00:00Z" }
json
application/json

Close a case

POST
https://api.lelemon.cl
/v2/cases/{id}/close
Bearer (API key)

The contact can then have a new case in the pipeline. Closing a closed case is a 409.

Required scope: cases:write.

Close a case › path Parameters

id
​string · pattern: ^cse_[0-9A-Za-z]{22}… · required

The id of the case (cse_…).

Close a case › Headers

Lelemon-Subaccount
​string · pattern: ^sub_[0-9A-Za-z]{22}…

The subaccount (sub_…) this request acts on. Only for the keys of a platform account; without it the request acts on the account itself.

Idempotency-Key
​string · minLength: 1 · maxLength: 255

Makes the request safe to retry. Once it starts running, its final response (2xx, 4xx or 5xx) is kept for 24 hours and the same key gets it back, without repeating the effect. A request rejected before it runs leaves the key free. A replayed create omits the secret. The same key with a different request is rejected with 409 idempotency_key_reused.

Close a case › Request Body optional

CloseCase
outcome
​string · minLength: 1 · maxLength: 50

Why it closed. Up to 50 characters.

Close a case › Responses

Case
object
​string · enum · required
Enum values:
case
id
​string · required
contactId
​string · required
pipelineId
​string · required
stageId
​string | null · required
agentId
​string | null · required

The agent that answers the case: the copilot of a copilot case, otherwise the agent of the current stage.

status
​string · enum · required
Enum values:
open
closed
assigneeId
​string | null · required
channel
​string | null · enum · required

Where the contact talks: whatsapp, email, api (your own system) or in_app. null when the case has no channel to write back.

Enum values:
whatsapp
api
in_app
email
phoneNumberId
​string | null · required

The WhatsApp number the contact wrote to, when it is a WhatsApp case.

control
​string · enum · required

Who answers the contact. human also covers a case the agent escalated and nobody took yet: see agentState.

Enum values:
agent
human
agentState
​string · enum · required

What the agent is doing, to drive a typing indicator: thinking and replying mean it is working; waiting_for_contact means it answered; escalated means it asked for a person; idle is everything else.

Enum values:
idle
thinking
replying
waiting_for_contact
escalated
unread
​integer · required

Messages of the contact since the last POST /v2/cases/{id}/read.

lastMessageAt
​string | null · date-time · required
​required

A preview of the last public message.

outcome
​string | null · required
closedAt
​string | null · date-time · required
​object · required

The values of the fields the pipeline declares, by key. Sensitive fields are not included.

tags
​string[] · required

The tags of the contact of the case.

archivedAt
​string | null · date-time · required

When the case was archived: out of the board, state untouched. null when it is on the board.

muted
​boolean · required

true while the contact is muted: the agent does not answer them and their open cases are closed. Muting belongs to the person, so every case of the contact shows it.

createdAt
​string · date-time · required
updatedAt
​string · date-time · required
​object

The contact with its presence. Present only on GET /v2/cases and GET /v2/cases/{id}, when the organization setting presenceEnabled is on, at least one presence signal has arrived, and the key has the contacts:presence-read scope.

POST/v2/cases/{id}/close
curl https://api.lelemon.cl/v2/cases/:id/close \ --request POST \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer <token>' \ --data '{ "outcome": "resolved" }'
Example Request Body
{ "outcome": "resolved" }
json
application/json
Example Responses
{ "object": "case", "id": "cse_4Zq0x8bVw1TqS9mYp3RkLd", "contactId": "ctc_4Zq0x8bVw1TqS9mYp3RkLd", "pipelineId": "ppl_02y0e5MANqacVbmtn1YyeJ", "stageId": "stageId", "agentId": "agentId", "status": "open", "assigneeId": "assigneeId", "channel": "whatsapp", "phoneNumberId": "pn_4Zq0x8bVw1TqS9mYp3RkLd", "control": "agent", "agentState": "idle", "unread": 0, "lastMessageAt": "2024-08-25T15:00:00Z", "lastMessage": { "author": "contact", "type": "text", "text": "text" }, "contact": { "id": "ctc_4Zq0x8bVw1TqS9mYp3RkLd", "presence": { "online": true, "lastSeenAt": "2024-08-25T15:00:00Z" } }, "outcome": "outcome", "closedAt": "2024-08-25T15:00:00Z", "fields": {}, "tags": [ "string" ], "archivedAt": "2024-08-25T15:00:00Z", "muted": true, "createdAt": "2024-08-25T15:00:00Z", "updatedAt": "2024-08-25T15:00:00Z" }
json
application/json

Reopen a case

POST
https://api.lelemon.cl
/v2/cases/{id}/reopen
Bearer (API key)

A 409 when the case is open, or when the contact already opened another case in the pipeline.

Required scope: cases:write.

Reopen a case › path Parameters

id
​string · pattern: ^cse_[0-9A-Za-z]{22}… · required

The id of the case (cse_…).

Reopen a case › Headers

Lelemon-Subaccount
​string · pattern: ^sub_[0-9A-Za-z]{22}…

The subaccount (sub_…) this request acts on. Only for the keys of a platform account; without it the request acts on the account itself.

Idempotency-Key
​string · minLength: 1 · maxLength: 255

Makes the request safe to retry. Once it starts running, its final response (2xx, 4xx or 5xx) is kept for 24 hours and the same key gets it back, without repeating the effect. A request rejected before it runs leaves the key free. A replayed create omits the secret. The same key with a different request is rejected with 409 idempotency_key_reused.

Reopen a case › Responses

Case
object
​string · enum · required
Enum values:
case
id
​string · required
contactId
​string · required
pipelineId
​string · required
stageId
​string | null · required
agentId
​string | null · required

The agent that answers the case: the copilot of a copilot case, otherwise the agent of the current stage.

status
​string · enum · required
Enum values:
open
closed
assigneeId
​string | null · required
channel
​string | null · enum · required

Where the contact talks: whatsapp, email, api (your own system) or in_app. null when the case has no channel to write back.

Enum values:
whatsapp
api
in_app
email
phoneNumberId
​string | null · required

The WhatsApp number the contact wrote to, when it is a WhatsApp case.

control
​string · enum · required

Who answers the contact. human also covers a case the agent escalated and nobody took yet: see agentState.

Enum values:
agent
human
agentState
​string · enum · required

What the agent is doing, to drive a typing indicator: thinking and replying mean it is working; waiting_for_contact means it answered; escalated means it asked for a person; idle is everything else.

Enum values:
idle
thinking
replying
waiting_for_contact
escalated
unread
​integer · required

Messages of the contact since the last POST /v2/cases/{id}/read.

lastMessageAt
​string | null · date-time · required
​required

A preview of the last public message.

outcome
​string | null · required
closedAt
​string | null · date-time · required
​object · required

The values of the fields the pipeline declares, by key. Sensitive fields are not included.

tags
​string[] · required

The tags of the contact of the case.

archivedAt
​string | null · date-time · required

When the case was archived: out of the board, state untouched. null when it is on the board.

muted
​boolean · required

true while the contact is muted: the agent does not answer them and their open cases are closed. Muting belongs to the person, so every case of the contact shows it.

createdAt
​string · date-time · required
updatedAt
​string · date-time · required
​object

The contact with its presence. Present only on GET /v2/cases and GET /v2/cases/{id}, when the organization setting presenceEnabled is on, at least one presence signal has arrived, and the key has the contacts:presence-read scope.

POST/v2/cases/{id}/reopen
curl https://api.lelemon.cl/v2/cases/:id/reopen \ --request POST \ --header 'Authorization: Bearer <token>'
Example Responses
{ "object": "case", "id": "cse_4Zq0x8bVw1TqS9mYp3RkLd", "contactId": "ctc_4Zq0x8bVw1TqS9mYp3RkLd", "pipelineId": "ppl_02y0e5MANqacVbmtn1YyeJ", "stageId": "stageId", "agentId": "agentId", "status": "open", "assigneeId": "assigneeId", "channel": "whatsapp", "phoneNumberId": "pn_4Zq0x8bVw1TqS9mYp3RkLd", "control": "agent", "agentState": "idle", "unread": 0, "lastMessageAt": "2024-08-25T15:00:00Z", "lastMessage": { "author": "contact", "type": "text", "text": "text" }, "contact": { "id": "ctc_4Zq0x8bVw1TqS9mYp3RkLd", "presence": { "online": true, "lastSeenAt": "2024-08-25T15:00:00Z" } }, "outcome": "outcome", "closedAt": "2024-08-25T15:00:00Z", "fields": {}, "tags": [ "string" ], "archivedAt": "2024-08-25T15:00:00Z", "muted": true, "createdAt": "2024-08-25T15:00:00Z", "updatedAt": "2024-08-25T15:00:00Z" }
json
application/json

Take control of a case

POST
https://api.lelemon.cl
/v2/cases/{id}/take-control
Bearer (API key)

A person takes over: the agent stops answering this case and your team can write with author team. Fires case.control_changed.

Required scope: cases:write.

Take control of a case › path Parameters

id
​string · pattern: ^cse_[0-9A-Za-z]{22}… · required

The id of the case (cse_…).

Take control of a case › Headers

Lelemon-Subaccount
​string · pattern: ^sub_[0-9A-Za-z]{22}…

The subaccount (sub_…) this request acts on. Only for the keys of a platform account; without it the request acts on the account itself.

Idempotency-Key
​string · minLength: 1 · maxLength: 255

Makes the request safe to retry. Once it starts running, its final response (2xx, 4xx or 5xx) is kept for 24 hours and the same key gets it back, without repeating the effect. A request rejected before it runs leaves the key free. A replayed create omits the secret. The same key with a different request is rejected with 409 idempotency_key_reused.

Take control of a case › Responses

Case
object
​string · enum · required
Enum values:
case
id
​string · required
contactId
​string · required
pipelineId
​string · required
stageId
​string | null · required
agentId
​string | null · required

The agent that answers the case: the copilot of a copilot case, otherwise the agent of the current stage.

status
​string · enum · required
Enum values:
open
closed
assigneeId
​string | null · required
channel
​string | null · enum · required

Where the contact talks: whatsapp, email, api (your own system) or in_app. null when the case has no channel to write back.

Enum values:
whatsapp
api
in_app
email
phoneNumberId
​string | null · required

The WhatsApp number the contact wrote to, when it is a WhatsApp case.

control
​string · enum · required

Who answers the contact. human also covers a case the agent escalated and nobody took yet: see agentState.

Enum values:
agent
human
agentState
​string · enum · required

What the agent is doing, to drive a typing indicator: thinking and replying mean it is working; waiting_for_contact means it answered; escalated means it asked for a person; idle is everything else.

Enum values:
idle
thinking
replying
waiting_for_contact
escalated
unread
​integer · required

Messages of the contact since the last POST /v2/cases/{id}/read.

lastMessageAt
​string | null · date-time · required
​required

A preview of the last public message.

outcome
​string | null · required
closedAt
​string | null · date-time · required
​object · required

The values of the fields the pipeline declares, by key. Sensitive fields are not included.

tags
​string[] · required

The tags of the contact of the case.

archivedAt
​string | null · date-time · required

When the case was archived: out of the board, state untouched. null when it is on the board.

muted
​boolean · required

true while the contact is muted: the agent does not answer them and their open cases are closed. Muting belongs to the person, so every case of the contact shows it.

createdAt
​string · date-time · required
updatedAt
​string · date-time · required
​object

The contact with its presence. Present only on GET /v2/cases and GET /v2/cases/{id}, when the organization setting presenceEnabled is on, at least one presence signal has arrived, and the key has the contacts:presence-read scope.

POST/v2/cases/{id}/take-control
curl https://api.lelemon.cl/v2/cases/:id/take-control \ --request POST \ --header 'Authorization: Bearer <token>'
Example Responses
{ "object": "case", "id": "cse_4Zq0x8bVw1TqS9mYp3RkLd", "contactId": "ctc_4Zq0x8bVw1TqS9mYp3RkLd", "pipelineId": "ppl_02y0e5MANqacVbmtn1YyeJ", "stageId": "stageId", "agentId": "agentId", "status": "open", "assigneeId": "assigneeId", "channel": "whatsapp", "phoneNumberId": "pn_4Zq0x8bVw1TqS9mYp3RkLd", "control": "agent", "agentState": "idle", "unread": 0, "lastMessageAt": "2024-08-25T15:00:00Z", "lastMessage": { "author": "contact", "type": "text", "text": "text" }, "contact": { "id": "ctc_4Zq0x8bVw1TqS9mYp3RkLd", "presence": { "online": true, "lastSeenAt": "2024-08-25T15:00:00Z" } }, "outcome": "outcome", "closedAt": "2024-08-25T15:00:00Z", "fields": {}, "tags": [ "string" ], "archivedAt": "2024-08-25T15:00:00Z", "muted": true, "createdAt": "2024-08-25T15:00:00Z", "updatedAt": "2024-08-25T15:00:00Z" }
json
application/json

Hand a case back to the agent

POST
https://api.lelemon.cl
/v2/cases/{id}/release-control
Bearer (API key)

The agent answers again, with the messages of the team in its context. Fires case.control_changed.

Required scope: cases:write.

Hand a case back to the agent › path Parameters

id
​string · pattern: ^cse_[0-9A-Za-z]{22}… · required

The id of the case (cse_…).

Hand a case back to the agent › Headers

Lelemon-Subaccount
​string · pattern: ^sub_[0-9A-Za-z]{22}…

The subaccount (sub_…) this request acts on. Only for the keys of a platform account; without it the request acts on the account itself.

Idempotency-Key
​string · minLength: 1 · maxLength: 255

Makes the request safe to retry. Once it starts running, its final response (2xx, 4xx or 5xx) is kept for 24 hours and the same key gets it back, without repeating the effect. A request rejected before it runs leaves the key free. A replayed create omits the secret. The same key with a different request is rejected with 409 idempotency_key_reused.

Hand a case back to the agent › Responses

Case
object
​string · enum · required
Enum values:
case
id
​string · required
contactId
​string · required
pipelineId
​string · required
stageId
​string | null · required
agentId
​string | null · required

The agent that answers the case: the copilot of a copilot case, otherwise the agent of the current stage.

status
​string · enum · required
Enum values:
open
closed
assigneeId
​string | null · required
channel
​string | null · enum · required

Where the contact talks: whatsapp, email, api (your own system) or in_app. null when the case has no channel to write back.

Enum values:
whatsapp
api
in_app
email
phoneNumberId
​string | null · required

The WhatsApp number the contact wrote to, when it is a WhatsApp case.

control
​string · enum · required

Who answers the contact. human also covers a case the agent escalated and nobody took yet: see agentState.

Enum values:
agent
human
agentState
​string · enum · required

What the agent is doing, to drive a typing indicator: thinking and replying mean it is working; waiting_for_contact means it answered; escalated means it asked for a person; idle is everything else.

Enum values:
idle
thinking
replying
waiting_for_contact
escalated
unread
​integer · required

Messages of the contact since the last POST /v2/cases/{id}/read.

lastMessageAt
​string | null · date-time · required
​required

A preview of the last public message.

outcome
​string | null · required
closedAt
​string | null · date-time · required
​object · required

The values of the fields the pipeline declares, by key. Sensitive fields are not included.

tags
​string[] · required

The tags of the contact of the case.

archivedAt
​string | null · date-time · required

When the case was archived: out of the board, state untouched. null when it is on the board.

muted
​boolean · required

true while the contact is muted: the agent does not answer them and their open cases are closed. Muting belongs to the person, so every case of the contact shows it.

createdAt
​string · date-time · required
updatedAt
​string · date-time · required
​object

The contact with its presence. Present only on GET /v2/cases and GET /v2/cases/{id}, when the organization setting presenceEnabled is on, at least one presence signal has arrived, and the key has the contacts:presence-read scope.

POST/v2/cases/{id}/release-control
curl https://api.lelemon.cl/v2/cases/:id/release-control \ --request POST \ --header 'Authorization: Bearer <token>'
Example Responses
{ "object": "case", "id": "cse_4Zq0x8bVw1TqS9mYp3RkLd", "contactId": "ctc_4Zq0x8bVw1TqS9mYp3RkLd", "pipelineId": "ppl_02y0e5MANqacVbmtn1YyeJ", "stageId": "stageId", "agentId": "agentId", "status": "open", "assigneeId": "assigneeId", "channel": "whatsapp", "phoneNumberId": "pn_4Zq0x8bVw1TqS9mYp3RkLd", "control": "agent", "agentState": "idle", "unread": 0, "lastMessageAt": "2024-08-25T15:00:00Z", "lastMessage": { "author": "contact", "type": "text", "text": "text" }, "contact": { "id": "ctc_4Zq0x8bVw1TqS9mYp3RkLd", "presence": { "online": true, "lastSeenAt": "2024-08-25T15:00:00Z" } }, "outcome": "outcome", "closedAt": "2024-08-25T15:00:00Z", "fields": {}, "tags": [ "string" ], "archivedAt": "2024-08-25T15:00:00Z", "muted": true, "createdAt": "2024-08-25T15:00:00Z", "updatedAt": "2024-08-25T15:00:00Z" }
json
application/json

Mark a case as read

POST
https://api.lelemon.cl
/v2/cases/{id}/read
Bearer (API key)

unread goes to 0 until the contact writes again. It does not send a read receipt to the channel.

Required scope: cases:write.

Mark a case as read › path Parameters

id
​string · pattern: ^cse_[0-9A-Za-z]{22}… · required

The id of the case (cse_…).

Mark a case as read › Headers

Lelemon-Subaccount
​string · pattern: ^sub_[0-9A-Za-z]{22}…

The subaccount (sub_…) this request acts on. Only for the keys of a platform account; without it the request acts on the account itself.

Idempotency-Key
​string · minLength: 1 · maxLength: 255

Makes the request safe to retry. Once it starts running, its final response (2xx, 4xx or 5xx) is kept for 24 hours and the same key gets it back, without repeating the effect. A request rejected before it runs leaves the key free. A replayed create omits the secret. The same key with a different request is rejected with 409 idempotency_key_reused.

Mark a case as read › Responses

Case
object
​string · enum · required
Enum values:
case
id
​string · required
contactId
​string · required
pipelineId
​string · required
stageId
​string | null · required
agentId
​string | null · required

The agent that answers the case: the copilot of a copilot case, otherwise the agent of the current stage.

status
​string · enum · required
Enum values:
open
closed
assigneeId
​string | null · required
channel
​string | null · enum · required

Where the contact talks: whatsapp, email, api (your own system) or in_app. null when the case has no channel to write back.

Enum values:
whatsapp
api
in_app
email
phoneNumberId
​string | null · required

The WhatsApp number the contact wrote to, when it is a WhatsApp case.

control
​string · enum · required

Who answers the contact. human also covers a case the agent escalated and nobody took yet: see agentState.

Enum values:
agent
human
agentState
​string · enum · required

What the agent is doing, to drive a typing indicator: thinking and replying mean it is working; waiting_for_contact means it answered; escalated means it asked for a person; idle is everything else.

Enum values:
idle
thinking
replying
waiting_for_contact
escalated
unread
​integer · required

Messages of the contact since the last POST /v2/cases/{id}/read.

lastMessageAt
​string | null · date-time · required
​required

A preview of the last public message.

outcome
​string | null · required
closedAt
​string | null · date-time · required
​object · required

The values of the fields the pipeline declares, by key. Sensitive fields are not included.

tags
​string[] · required

The tags of the contact of the case.

archivedAt
​string | null · date-time · required

When the case was archived: out of the board, state untouched. null when it is on the board.

muted
​boolean · required

true while the contact is muted: the agent does not answer them and their open cases are closed. Muting belongs to the person, so every case of the contact shows it.

createdAt
​string · date-time · required
updatedAt
​string · date-time · required
​object

The contact with its presence. Present only on GET /v2/cases and GET /v2/cases/{id}, when the organization setting presenceEnabled is on, at least one presence signal has arrived, and the key has the contacts:presence-read scope.

POST/v2/cases/{id}/read
curl https://api.lelemon.cl/v2/cases/:id/read \ --request POST \ --header 'Authorization: Bearer <token>'
Example Responses
{ "object": "case", "id": "cse_4Zq0x8bVw1TqS9mYp3RkLd", "contactId": "ctc_4Zq0x8bVw1TqS9mYp3RkLd", "pipelineId": "ppl_02y0e5MANqacVbmtn1YyeJ", "stageId": "stageId", "agentId": "agentId", "status": "open", "assigneeId": "assigneeId", "channel": "whatsapp", "phoneNumberId": "pn_4Zq0x8bVw1TqS9mYp3RkLd", "control": "agent", "agentState": "idle", "unread": 0, "lastMessageAt": "2024-08-25T15:00:00Z", "lastMessage": { "author": "contact", "type": "text", "text": "text" }, "contact": { "id": "ctc_4Zq0x8bVw1TqS9mYp3RkLd", "presence": { "online": true, "lastSeenAt": "2024-08-25T15:00:00Z" } }, "outcome": "outcome", "closedAt": "2024-08-25T15:00:00Z", "fields": {}, "tags": [ "string" ], "archivedAt": "2024-08-25T15:00:00Z", "muted": true, "createdAt": "2024-08-25T15:00:00Z", "updatedAt": "2024-08-25T15:00:00Z" }
json
application/json

Move several cases to a stage

POST
https://api.lelemon.cl
/v2/cases/move-batch
Bearer (API key)

Moves up to 100 cases of one pipeline to a stage of that pipeline. It answers how many moved and, for each case that did not, the reason: not_found, not_in_pipeline, archived, closed, already_in_stage or required_fields_missing (with missingFields). The ones that can move move even when others cannot. To change pipeline use POST /v2/cases/{id}/move.

Required scope: cases:reorganize.

Move several cases to a stage › Headers

Lelemon-Subaccount
​string · pattern: ^sub_[0-9A-Za-z]{22}…

The subaccount (sub_…) this request acts on. Only for the keys of a platform account; without it the request acts on the account itself.

Idempotency-Key
​string · minLength: 1 · maxLength: 255

Makes the request safe to retry. Once it starts running, its final response (2xx, 4xx or 5xx) is kept for 24 hours and the same key gets it back, without repeating the effect. A request rejected before it runs leaves the key free. A replayed create omits the secret. The same key with a different request is rejected with 409 idempotency_key_reused.

Move several cases to a stage › Request Body

MoveCasesBatch
caseIds
​string[] · minItems: 1 · maxItems: 100 · required

Up to 100 cases of one pipeline.

stageId
​string · required

The stage they move to. The cases have to be in the pipeline of this stage: to change pipeline use POST /v2/cases/{id}/move.

Move several cases to a stage › Responses

CaseBatchMove
object
​string · enum · required
Enum values:
case_batch_move
moved
​integer · required

Cases that changed stage.

​NotMovedCase[] · required
POST/v2/cases/move-batch
curl https://api.lelemon.cl/v2/cases/move-batch \ --request POST \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer <token>' \ --data '{ "caseIds": [ "cse_02y0e5MANqacVbmtn1YyeJ" ], "stageId": "stg_02y0e5MANqacVbmtn1YyeJ" }'
Example Request Body
{ "caseIds": [ "cse_02y0e5MANqacVbmtn1YyeJ" ], "stageId": "stg_02y0e5MANqacVbmtn1YyeJ" }
json
application/json
Example Responses
{ "object": "case_batch_move", "moved": 0, "notMoved": [ { "caseId": "cse_4Zq0x8bVw1TqS9mYp3RkLd", "reason": "not_found", "missingFields": [ "string" ] } ] }
json
application/json

Archive a case

POST
https://api.lelemon.cl
/v2/cases/{id}/archive
Bearer (API key)

Takes the case off the board without deleting it or changing its status. Archiving an archived case leaves it as it is. Undo it with POST /v2/cases/{id}/unarchive.

Required scope: cases:delete.

Archive a case › path Parameters

id
​string · pattern: ^cse_[0-9A-Za-z]{22}… · required

The id of the case (cse_…).

Archive a case › Headers

Lelemon-Subaccount
​string · pattern: ^sub_[0-9A-Za-z]{22}…

The subaccount (sub_…) this request acts on. Only for the keys of a platform account; without it the request acts on the account itself.

Idempotency-Key
​string · minLength: 1 · maxLength: 255

Makes the request safe to retry. Once it starts running, its final response (2xx, 4xx or 5xx) is kept for 24 hours and the same key gets it back, without repeating the effect. A request rejected before it runs leaves the key free. A replayed create omits the secret. The same key with a different request is rejected with 409 idempotency_key_reused.

Archive a case › Responses

Case
object
​string · enum · required
Enum values:
case
id
​string · required
contactId
​string · required
pipelineId
​string · required
stageId
​string | null · required
agentId
​string | null · required

The agent that answers the case: the copilot of a copilot case, otherwise the agent of the current stage.

status
​string · enum · required
Enum values:
open
closed
assigneeId
​string | null · required
channel
​string | null · enum · required

Where the contact talks: whatsapp, email, api (your own system) or in_app. null when the case has no channel to write back.

Enum values:
whatsapp
api
in_app
email
phoneNumberId
​string | null · required

The WhatsApp number the contact wrote to, when it is a WhatsApp case.

control
​string · enum · required

Who answers the contact. human also covers a case the agent escalated and nobody took yet: see agentState.

Enum values:
agent
human
agentState
​string · enum · required

What the agent is doing, to drive a typing indicator: thinking and replying mean it is working; waiting_for_contact means it answered; escalated means it asked for a person; idle is everything else.

Enum values:
idle
thinking
replying
waiting_for_contact
escalated
unread
​integer · required

Messages of the contact since the last POST /v2/cases/{id}/read.

lastMessageAt
​string | null · date-time · required
​required

A preview of the last public message.

outcome
​string | null · required
closedAt
​string | null · date-time · required
​object · required

The values of the fields the pipeline declares, by key. Sensitive fields are not included.

tags
​string[] · required

The tags of the contact of the case.

archivedAt
​string | null · date-time · required

When the case was archived: out of the board, state untouched. null when it is on the board.

muted
​boolean · required

true while the contact is muted: the agent does not answer them and their open cases are closed. Muting belongs to the person, so every case of the contact shows it.

createdAt
​string · date-time · required
updatedAt
​string · date-time · required
​object

The contact with its presence. Present only on GET /v2/cases and GET /v2/cases/{id}, when the organization setting presenceEnabled is on, at least one presence signal has arrived, and the key has the contacts:presence-read scope.

POST/v2/cases/{id}/archive
curl https://api.lelemon.cl/v2/cases/:id/archive \ --request POST \ --header 'Authorization: Bearer <token>'
Example Responses
{ "object": "case", "id": "cse_4Zq0x8bVw1TqS9mYp3RkLd", "contactId": "ctc_4Zq0x8bVw1TqS9mYp3RkLd", "pipelineId": "ppl_02y0e5MANqacVbmtn1YyeJ", "stageId": "stageId", "agentId": "agentId", "status": "open", "assigneeId": "assigneeId", "channel": "whatsapp", "phoneNumberId": "pn_4Zq0x8bVw1TqS9mYp3RkLd", "control": "agent", "agentState": "idle", "unread": 0, "lastMessageAt": "2024-08-25T15:00:00Z", "lastMessage": { "author": "contact", "type": "text", "text": "text" }, "contact": { "id": "ctc_4Zq0x8bVw1TqS9mYp3RkLd", "presence": { "online": true, "lastSeenAt": "2024-08-25T15:00:00Z" } }, "outcome": "outcome", "closedAt": "2024-08-25T15:00:00Z", "fields": {}, "tags": [ "string" ], "archivedAt": "2024-08-25T15:00:00Z", "muted": true, "createdAt": "2024-08-25T15:00:00Z", "updatedAt": "2024-08-25T15:00:00Z" }
json
application/json

Bring an archived case back

POST
https://api.lelemon.cl
/v2/cases/{id}/unarchive
Bearer (API key)

Puts the case back on the board with the status it had. Unarchiving a case that is not archived leaves it as it is.

Required scope: cases:delete.

Bring an archived case back › path Parameters

id
​string · pattern: ^cse_[0-9A-Za-z]{22}… · required

The id of the case (cse_…).

Bring an archived case back › Headers

Lelemon-Subaccount
​string · pattern: ^sub_[0-9A-Za-z]{22}…

The subaccount (sub_…) this request acts on. Only for the keys of a platform account; without it the request acts on the account itself.

Idempotency-Key
​string · minLength: 1 · maxLength: 255

Makes the request safe to retry. Once it starts running, its final response (2xx, 4xx or 5xx) is kept for 24 hours and the same key gets it back, without repeating the effect. A request rejected before it runs leaves the key free. A replayed create omits the secret. The same key with a different request is rejected with 409 idempotency_key_reused.

Bring an archived case back › Responses

Case
object
​string · enum · required
Enum values:
case
id
​string · required
contactId
​string · required
pipelineId
​string · required
stageId
​string | null · required
agentId
​string | null · required

The agent that answers the case: the copilot of a copilot case, otherwise the agent of the current stage.

status
​string · enum · required
Enum values:
open
closed
assigneeId
​string | null · required
channel
​string | null · enum · required

Where the contact talks: whatsapp, email, api (your own system) or in_app. null when the case has no channel to write back.

Enum values:
whatsapp
api
in_app
email
phoneNumberId
​string | null · required

The WhatsApp number the contact wrote to, when it is a WhatsApp case.

control
​string · enum · required

Who answers the contact. human also covers a case the agent escalated and nobody took yet: see agentState.

Enum values:
agent
human
agentState
​string · enum · required

What the agent is doing, to drive a typing indicator: thinking and replying mean it is working; waiting_for_contact means it answered; escalated means it asked for a person; idle is everything else.

Enum values:
idle
thinking
replying
waiting_for_contact
escalated
unread
​integer · required

Messages of the contact since the last POST /v2/cases/{id}/read.

lastMessageAt
​string | null · date-time · required
​required

A preview of the last public message.

outcome
​string | null · required
closedAt
​string | null · date-time · required
​object · required

The values of the fields the pipeline declares, by key. Sensitive fields are not included.

tags
​string[] · required

The tags of the contact of the case.

archivedAt
​string | null · date-time · required

When the case was archived: out of the board, state untouched. null when it is on the board.

muted
​boolean · required

true while the contact is muted: the agent does not answer them and their open cases are closed. Muting belongs to the person, so every case of the contact shows it.

createdAt
​string · date-time · required
updatedAt
​string · date-time · required
​object

The contact with its presence. Present only on GET /v2/cases and GET /v2/cases/{id}, when the organization setting presenceEnabled is on, at least one presence signal has arrived, and the key has the contacts:presence-read scope.

POST/v2/cases/{id}/unarchive
curl https://api.lelemon.cl/v2/cases/:id/unarchive \ --request POST \ --header 'Authorization: Bearer <token>'
Example Responses
{ "object": "case", "id": "cse_4Zq0x8bVw1TqS9mYp3RkLd", "contactId": "ctc_4Zq0x8bVw1TqS9mYp3RkLd", "pipelineId": "ppl_02y0e5MANqacVbmtn1YyeJ", "stageId": "stageId", "agentId": "agentId", "status": "open", "assigneeId": "assigneeId", "channel": "whatsapp", "phoneNumberId": "pn_4Zq0x8bVw1TqS9mYp3RkLd", "control": "agent", "agentState": "idle", "unread": 0, "lastMessageAt": "2024-08-25T15:00:00Z", "lastMessage": { "author": "contact", "type": "text", "text": "text" }, "contact": { "id": "ctc_4Zq0x8bVw1TqS9mYp3RkLd", "presence": { "online": true, "lastSeenAt": "2024-08-25T15:00:00Z" } }, "outcome": "outcome", "closedAt": "2024-08-25T15:00:00Z", "fields": {}, "tags": [ "string" ], "archivedAt": "2024-08-25T15:00:00Z", "muted": true, "createdAt": "2024-08-25T15:00:00Z", "updatedAt": "2024-08-25T15:00:00Z" }
json
application/json

Mute the contact of a case

POST
https://api.lelemon.cl
/v2/cases/{id}/mute
Bearer (API key)

The agent stops answering the person and every open case of the contact closes. Muting belongs to the contact, so it holds for all their cases until POST /v2/cases/{id}/unmute. Muting a muted contact leaves it muted.

Required scope: cases:write.

Mute the contact of a case › path Parameters

id
​string · pattern: ^cse_[0-9A-Za-z]{22}… · required

The id of the case (cse_…).

Mute the contact of a case › Headers

Lelemon-Subaccount
​string · pattern: ^sub_[0-9A-Za-z]{22}…

The subaccount (sub_…) this request acts on. Only for the keys of a platform account; without it the request acts on the account itself.

Idempotency-Key
​string · minLength: 1 · maxLength: 255

Makes the request safe to retry. Once it starts running, its final response (2xx, 4xx or 5xx) is kept for 24 hours and the same key gets it back, without repeating the effect. A request rejected before it runs leaves the key free. A replayed create omits the secret. The same key with a different request is rejected with 409 idempotency_key_reused.

Mute the contact of a case › Request Body optional

MuteCase
reason
​string · minLength: 1 · maxLength: 200

Why. It is saved with the contact.

Mute the contact of a case › Responses

Case
object
​string · enum · required
Enum values:
case
id
​string · required
contactId
​string · required
pipelineId
​string · required
stageId
​string | null · required
agentId
​string | null · required

The agent that answers the case: the copilot of a copilot case, otherwise the agent of the current stage.

status
​string · enum · required
Enum values:
open
closed
assigneeId
​string | null · required
channel
​string | null · enum · required

Where the contact talks: whatsapp, email, api (your own system) or in_app. null when the case has no channel to write back.

Enum values:
whatsapp
api
in_app
email
phoneNumberId
​string | null · required

The WhatsApp number the contact wrote to, when it is a WhatsApp case.

control
​string · enum · required

Who answers the contact. human also covers a case the agent escalated and nobody took yet: see agentState.

Enum values:
agent
human
agentState
​string · enum · required

What the agent is doing, to drive a typing indicator: thinking and replying mean it is working; waiting_for_contact means it answered; escalated means it asked for a person; idle is everything else.

Enum values:
idle
thinking
replying
waiting_for_contact
escalated
unread
​integer · required

Messages of the contact since the last POST /v2/cases/{id}/read.

lastMessageAt
​string | null · date-time · required
​required

A preview of the last public message.

outcome
​string | null · required
closedAt
​string | null · date-time · required
​object · required

The values of the fields the pipeline declares, by key. Sensitive fields are not included.

tags
​string[] · required

The tags of the contact of the case.

archivedAt
​string | null · date-time · required

When the case was archived: out of the board, state untouched. null when it is on the board.

muted
​boolean · required

true while the contact is muted: the agent does not answer them and their open cases are closed. Muting belongs to the person, so every case of the contact shows it.

createdAt
​string · date-time · required
updatedAt
​string · date-time · required
​object

The contact with its presence. Present only on GET /v2/cases and GET /v2/cases/{id}, when the organization setting presenceEnabled is on, at least one presence signal has arrived, and the key has the contacts:presence-read scope.

POST/v2/cases/{id}/mute
curl https://api.lelemon.cl/v2/cases/:id/mute \ --request POST \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer <token>' \ --data '{ "reason": "Sends spam" }'
Example Request Body
{ "reason": "Sends spam" }
json
application/json
Example Responses
{ "object": "case", "id": "cse_4Zq0x8bVw1TqS9mYp3RkLd", "contactId": "ctc_4Zq0x8bVw1TqS9mYp3RkLd", "pipelineId": "ppl_02y0e5MANqacVbmtn1YyeJ", "stageId": "stageId", "agentId": "agentId", "status": "open", "assigneeId": "assigneeId", "channel": "whatsapp", "phoneNumberId": "pn_4Zq0x8bVw1TqS9mYp3RkLd", "control": "agent", "agentState": "idle", "unread": 0, "lastMessageAt": "2024-08-25T15:00:00Z", "lastMessage": { "author": "contact", "type": "text", "text": "text" }, "contact": { "id": "ctc_4Zq0x8bVw1TqS9mYp3RkLd", "presence": { "online": true, "lastSeenAt": "2024-08-25T15:00:00Z" } }, "outcome": "outcome", "closedAt": "2024-08-25T15:00:00Z", "fields": {}, "tags": [ "string" ], "archivedAt": "2024-08-25T15:00:00Z", "muted": true, "createdAt": "2024-08-25T15:00:00Z", "updatedAt": "2024-08-25T15:00:00Z" }
json
application/json

Unmute the contact of a case

POST
https://api.lelemon.cl
/v2/cases/{id}/unmute
Bearer (API key)

The contact can talk to the agent again. The cases that closed when it was muted stay closed: reopen the ones you need.

Required scope: cases:write.

Unmute the contact of a case › path Parameters

id
​string · pattern: ^cse_[0-9A-Za-z]{22}… · required

The id of the case (cse_…).

Unmute the contact of a case › Headers

Lelemon-Subaccount
​string · pattern: ^sub_[0-9A-Za-z]{22}…

The subaccount (sub_…) this request acts on. Only for the keys of a platform account; without it the request acts on the account itself.

Idempotency-Key
​string · minLength: 1 · maxLength: 255

Makes the request safe to retry. Once it starts running, its final response (2xx, 4xx or 5xx) is kept for 24 hours and the same key gets it back, without repeating the effect. A request rejected before it runs leaves the key free. A replayed create omits the secret. The same key with a different request is rejected with 409 idempotency_key_reused.

Unmute the contact of a case › Responses

Case
object
​string · enum · required
Enum values:
case
id
​string · required
contactId
​string · required
pipelineId
​string · required
stageId
​string | null · required
agentId
​string | null · required

The agent that answers the case: the copilot of a copilot case, otherwise the agent of the current stage.

status
​string · enum · required
Enum values:
open
closed
assigneeId
​string | null · required
channel
​string | null · enum · required

Where the contact talks: whatsapp, email, api (your own system) or in_app. null when the case has no channel to write back.

Enum values:
whatsapp
api
in_app
email
phoneNumberId
​string | null · required

The WhatsApp number the contact wrote to, when it is a WhatsApp case.

control
​string · enum · required

Who answers the contact. human also covers a case the agent escalated and nobody took yet: see agentState.

Enum values:
agent
human
agentState
​string · enum · required

What the agent is doing, to drive a typing indicator: thinking and replying mean it is working; waiting_for_contact means it answered; escalated means it asked for a person; idle is everything else.

Enum values:
idle
thinking
replying
waiting_for_contact
escalated
unread
​integer · required

Messages of the contact since the last POST /v2/cases/{id}/read.

lastMessageAt
​string | null · date-time · required
​required

A preview of the last public message.

outcome
​string | null · required
closedAt
​string | null · date-time · required
​object · required

The values of the fields the pipeline declares, by key. Sensitive fields are not included.

tags
​string[] · required

The tags of the contact of the case.

archivedAt
​string | null · date-time · required

When the case was archived: out of the board, state untouched. null when it is on the board.

muted
​boolean · required

true while the contact is muted: the agent does not answer them and their open cases are closed. Muting belongs to the person, so every case of the contact shows it.

createdAt
​string · date-time · required
updatedAt
​string · date-time · required
​object

The contact with its presence. Present only on GET /v2/cases and GET /v2/cases/{id}, when the organization setting presenceEnabled is on, at least one presence signal has arrived, and the key has the contacts:presence-read scope.

POST/v2/cases/{id}/unmute
curl https://api.lelemon.cl/v2/cases/:id/unmute \ --request POST \ --header 'Authorization: Bearer <token>'
Example Responses
{ "object": "case", "id": "cse_4Zq0x8bVw1TqS9mYp3RkLd", "contactId": "ctc_4Zq0x8bVw1TqS9mYp3RkLd", "pipelineId": "ppl_02y0e5MANqacVbmtn1YyeJ", "stageId": "stageId", "agentId": "agentId", "status": "open", "assigneeId": "assigneeId", "channel": "whatsapp", "phoneNumberId": "pn_4Zq0x8bVw1TqS9mYp3RkLd", "control": "agent", "agentState": "idle", "unread": 0, "lastMessageAt": "2024-08-25T15:00:00Z", "lastMessage": { "author": "contact", "type": "text", "text": "text" }, "contact": { "id": "ctc_4Zq0x8bVw1TqS9mYp3RkLd", "presence": { "online": true, "lastSeenAt": "2024-08-25T15:00:00Z" } }, "outcome": "outcome", "closedAt": "2024-08-25T15:00:00Z", "fields": {}, "tags": [ "string" ], "archivedAt": "2024-08-25T15:00:00Z", "muted": true, "createdAt": "2024-08-25T15:00:00Z", "updatedAt": "2024-08-25T15:00:00Z" }
json
application/json

Hand a case to a person

POST
https://api.lelemon.cl
/v2/cases/{id}/escalate
Bearer (API key)

Marks the case as needing a person, with your reason, and the agent stops answering. Fires case.control_changed with escalated true. A closed case is a 409.

Required scope: cases:write.

Hand a case to a person › path Parameters

id
​string · pattern: ^cse_[0-9A-Za-z]{22}… · required

The id of the case (cse_…).

Hand a case to a person › Headers

Lelemon-Subaccount
​string · pattern: ^sub_[0-9A-Za-z]{22}…

The subaccount (sub_…) this request acts on. Only for the keys of a platform account; without it the request acts on the account itself.

Idempotency-Key
​string · minLength: 1 · maxLength: 255

Makes the request safe to retry. Once it starts running, its final response (2xx, 4xx or 5xx) is kept for 24 hours and the same key gets it back, without repeating the effect. A request rejected before it runs leaves the key free. A replayed create omits the secret. The same key with a different request is rejected with 409 idempotency_key_reused.

Hand a case to a person › Request Body

EscalateCase
reason
​string · minLength: 1 · maxLength: 500 · required

Why the case needs a person. Your team sees it.

Hand a case to a person › Responses

Case
object
​string · enum · required
Enum values:
case
id
​string · required
contactId
​string · required
pipelineId
​string · required
stageId
​string | null · required
agentId
​string | null · required

The agent that answers the case: the copilot of a copilot case, otherwise the agent of the current stage.

status
​string · enum · required
Enum values:
open
closed
assigneeId
​string | null · required
channel
​string | null · enum · required

Where the contact talks: whatsapp, email, api (your own system) or in_app. null when the case has no channel to write back.

Enum values:
whatsapp
api
in_app
email
phoneNumberId
​string | null · required

The WhatsApp number the contact wrote to, when it is a WhatsApp case.

control
​string · enum · required

Who answers the contact. human also covers a case the agent escalated and nobody took yet: see agentState.

Enum values:
agent
human
agentState
​string · enum · required

What the agent is doing, to drive a typing indicator: thinking and replying mean it is working; waiting_for_contact means it answered; escalated means it asked for a person; idle is everything else.

Enum values:
idle
thinking
replying
waiting_for_contact
escalated
unread
​integer · required

Messages of the contact since the last POST /v2/cases/{id}/read.

lastMessageAt
​string | null · date-time · required
​required

A preview of the last public message.

outcome
​string | null · required
closedAt
​string | null · date-time · required
​object · required

The values of the fields the pipeline declares, by key. Sensitive fields are not included.

tags
​string[] · required

The tags of the contact of the case.

archivedAt
​string | null · date-time · required

When the case was archived: out of the board, state untouched. null when it is on the board.

muted
​boolean · required

true while the contact is muted: the agent does not answer them and their open cases are closed. Muting belongs to the person, so every case of the contact shows it.

createdAt
​string · date-time · required
updatedAt
​string · date-time · required
​object

The contact with its presence. Present only on GET /v2/cases and GET /v2/cases/{id}, when the organization setting presenceEnabled is on, at least one presence signal has arrived, and the key has the contacts:presence-read scope.

POST/v2/cases/{id}/escalate
curl https://api.lelemon.cl/v2/cases/:id/escalate \ --request POST \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer <token>' \ --data '{ "reason": "The person asked to talk to someone" }'
Example Request Body
{ "reason": "The person asked to talk to someone" }
json
application/json
Example Responses
{ "object": "case", "id": "cse_4Zq0x8bVw1TqS9mYp3RkLd", "contactId": "ctc_4Zq0x8bVw1TqS9mYp3RkLd", "pipelineId": "ppl_02y0e5MANqacVbmtn1YyeJ", "stageId": "stageId", "agentId": "agentId", "status": "open", "assigneeId": "assigneeId", "channel": "whatsapp", "phoneNumberId": "pn_4Zq0x8bVw1TqS9mYp3RkLd", "control": "agent", "agentState": "idle", "unread": 0, "lastMessageAt": "2024-08-25T15:00:00Z", "lastMessage": { "author": "contact", "type": "text", "text": "text" }, "contact": { "id": "ctc_4Zq0x8bVw1TqS9mYp3RkLd", "presence": { "online": true, "lastSeenAt": "2024-08-25T15:00:00Z" } }, "outcome": "outcome", "closedAt": "2024-08-25T15:00:00Z", "fields": {}, "tags": [ "string" ], "archivedAt": "2024-08-25T15:00:00Z", "muted": true, "createdAt": "2024-08-25T15:00:00Z", "updatedAt": "2024-08-25T15:00:00Z" }
json
application/json

Reveal a sensitive field of a case

POST
https://api.lelemon.cl
/v2/cases/{id}/fields/{key}/reveal
Bearer (API key)

Returns the value of a field the pipeline marks as sensitive. Reading a case never returns it. Every call writes an audit row with the key and the field, never the value, before the value is returned. The response is stored nowhere: not for idempotent replay and not in the request log. 422 field_not_sensitive when the field is not marked sensitive, or the pipeline does not declare it.

Required scope: cases:reveal.

Reveal a sensitive field of a case › path Parameters

id
​string · pattern: ^cse_[0-9A-Za-z]{22}… · required

The id of the case (cse_…).

key
​string · required

The key of the field, as the pipeline declares it.

Reveal a sensitive field of a case › Headers

Lelemon-Subaccount
​string · pattern: ^sub_[0-9A-Za-z]{22}…

The subaccount (sub_…) this request acts on. Only for the keys of a platform account; without it the request acts on the account itself.

Reveal a sensitive field of a case › Responses

RevealedCaseField
object
​string · enum · required
Enum values:
revealed_case_field
caseId
​string · required
key
​string · required
value
​string | null · required

The value as saved. null when the field has no value yet.

POST/v2/cases/{id}/fields/{key}/reveal
curl https://api.lelemon.cl/v2/cases/:id/fields/:key/reveal \ --request POST \ --header 'Authorization: Bearer <token>'
Example Responses
{ "object": "revealed_case_field", "caseId": "cse_4Zq0x8bVw1TqS9mYp3RkLd", "key": "bank_account", "value": "value" }
json
application/json

Escalate a case to the technical team

POST
https://api.lelemon.cl
/v2/cases/{id}/escalate-to-team
Bearer (API key)

Creates an issue in the Linear of the organization with the title, the contact, the pipeline, the last messages and the link to the case. A case that already has an open escalation gets that same escalation back, never a second issue. When Linear does not answer, the escalation stays pending and Lelemon keeps trying; the case is not lost. When the team completes the issue, the case moves to answerStageId (if it is still in the stage where it was escalated), the answer is left as an internal note and the owner of the case gets a notification. The same happens by itself when a case enters a stage with config.attentionRole escalation and Linear is connected; answerStageId defaults to the stage of the pipeline with attentionRole answer. 404 when Linear is not connected. A closed case is a 409. Safe to repeat.

Required scope: cases:write.

Escalate a case to the technical team › path Parameters

id
​string · pattern: ^cse_[0-9A-Za-z]{22}… · required

The id of the case (cse_…).

Escalate a case to the technical team › Headers

Lelemon-Subaccount
​string · pattern: ^sub_[0-9A-Za-z]{22}…

The subaccount (sub_…) this request acts on. Only for the keys of a platform account; without it the request acts on the account itself.

Idempotency-Key
​string · minLength: 1 · maxLength: 255

Makes the request safe to retry. Once it starts running, its final response (2xx, 4xx or 5xx) is kept for 24 hours and the same key gets it back, without repeating the effect. A request rejected before it runs leaves the key free. A replayed create omits the secret. The same key with a different request is rejected with 409 idempotency_key_reused.

Escalate a case to the technical team › Request Body optional

EscalateToTeam
answerStageId
​string

The stage of the same pipeline where the case goes when the team completes the issue. Without it, the stage of the pipeline with config.attentionRole answer; if the pipeline has none, the case stays where it is and only gets the answer as a note.

Escalate a case to the technical team › Responses

TeamEscalation
object
​string · enum · required
Enum values:
team_escalation
id
​string · required
caseId
​string · required
status
​string · enum · required

pending: the issue is not created yet and Lelemon keeps trying. created: the team has it. completed: the team completed it and the answer reached the case. canceled: the team canceled the issue, so there is no answer and the case stays where it was. failed: Lelemon gave up; saving the Linear connection again tries again.

Enum values:
pending
created
completed
failed
canceled
origin
​string · enum · required

stage: the case entered a stage marked to escalate. manual: someone asked for it.

Enum values:
stage
manual
​required
answerStageId
​string | null · required
answer
​string | null · required

The last comment of the team on the issue, once it is completed.

lastError
​string | null · required

Why the last attempt to create the issue failed.

completedAt
​string | null · date-time · required
createdAt
​string · date-time · required
POST/v2/cases/{id}/escalate-to-team
curl https://api.lelemon.cl/v2/cases/:id/escalate-to-team \ --request POST \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer <token>' \ --data '{ "answerStageId": "stg_02y0e5MANqacVbmtn1YyeJ" }'
Example Request Body
{ "answerStageId": "stg_02y0e5MANqacVbmtn1YyeJ" }
json
application/json
Example Responses
{ "object": "team_escalation", "id": "esc_5RvP2aKq9XwLmN3tYbZc01", "caseId": "cse_5RvP2aKq9XwLmN3tYbZc01", "status": "pending", "origin": "stage", "issue": { "identifier": "LEL-123", "url": "https://linear.app/lelemon/issue/LEL-123" }, "answerStageId": "answerStageId", "answer": "answer", "lastError": "lastError", "completedAt": "2024-08-25T15:00:00Z", "createdAt": "2024-08-25T15:00:00Z" }
json
application/json

List the escalations of a case

GET
https://api.lelemon.cl
/v2/cases/{id}/team-escalations
Bearer (API key)

The escalations of the case to the technical team, newest first, with the Linear issue and the answer once the team completes it. Read only and safe to repeat.

Required scope: cases:read.

List the escalations of a case › path Parameters

id
​string · pattern: ^cse_[0-9A-Za-z]{22}… · required

The id of the case (cse_…).

List the escalations of a case › query Parameters

limit
​integer · min: 1 · max: 100
Default: 20
cursor
​string · maxLength: 512

The nextCursor of the previous page, with the same filters.

List the escalations of a case › Headers

Lelemon-Subaccount
​string · pattern: ^sub_[0-9A-Za-z]{22}…

The subaccount (sub_…) this request acts on. Only for the keys of a platform account; without it the request acts on the account itself.

List the escalations of a case › Responses

TeamEscalationList
object
​string · enum · required
Enum values:
list
hasMore
​boolean · required
nextCursor
​string | null · required
​TeamEscalation[] · required
GET/v2/cases/{id}/team-escalations
curl https://api.lelemon.cl/v2/cases/:id/team-escalations \ --header 'Authorization: Bearer <token>'
Example Responses
{ "object": "list", "hasMore": true, "nextCursor": "nextCursor", "data": [ { "object": "team_escalation", "id": "esc_5RvP2aKq9XwLmN3tYbZc01", "caseId": "cse_5RvP2aKq9XwLmN3tYbZc01", "status": "pending", "origin": "stage", "issue": { "identifier": "LEL-123", "url": "https://linear.app/lelemon/issue/LEL-123" }, "answerStageId": "answerStageId", "answer": "answer", "lastError": "lastError", "completedAt": "2024-08-25T15:00:00Z", "createdAt": "2024-08-25T15:00:00Z" } ] }
json
application/json

SuppressionsCase queue