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

Contacts


List contacts

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

Newest first. Filter by phone, email, externalRef, or updatedSince. presence=online keeps only the contacts online now (needs the contacts:presence-read scope). To search, send q (name, email, phone, externalRef and the values of the contact fields): each result says in match which field matched. pipelineId keeps the contacts with a case in that pipeline, hasOpenCases=true the ones with an open case, fieldKey with fieldValue the ones whose contact field has that value. Any of these, or order, sorts by latest activity (or by name) instead of newest first, and adds caseCount, openCaseCount and lastActivityAt to each contact.

Required scope: contacts:read.

List contacts › query Parameters

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

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

phone
​string

Exact match on the stored phone.

email
​string

Exact match, ignoring case.

externalRef
​string
updatedSince
​string · date-time

Only contacts changed at or after this moment.

presence
​string · enum

online: only contacts that are 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
q
​string

Searches name, email, phone, externalRef and the values of the contact fields, ignoring case and accents. With q the answer carries match, the field that matched.

pipelineId
​string

Only contacts that have a case in this pipeline.

hasOpenCases
​boolean · enum

true keeps only the contacts with an open case.

Enum values:
order
​string · enum

activity: the latest activity first. name: A to Z. Without order and without the other search parameters the list is newest first.

Enum values:
activity
name
fieldKey
​string

The key of a contact field. Send it with fieldValue.

fieldValue
​string

Only contacts whose fieldKey has exactly this value. Send it with fieldKey.

List contacts › 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 contacts › Responses

ContactList
object
​string · enum · required
Enum values:
list
hasMore
​boolean · required
nextCursor
​string | null · required
​Contact[] · required
GET/v2/contacts
curl https://api.lelemon.cl/v2/contacts \ --header 'Authorization: Bearer <token>'
Example Responses
{ "object": "list", "hasMore": true, "nextCursor": "nextCursor", "data": [ { "object": "contact", "id": "ctc_4Zq0x8bVw1TqS9mYp3RkLd", "name": "Ana Pérez", "email": "email", "phone": "phone", "externalRef": "externalRef", "companyId": "cpy_4Zq0x8bVw1TqS9mYp3RkLd", "tags": [ "string" ], "fields": { "plan": "pro" }, "createdAt": "2024-08-25T15:00:00Z", "updatedAt": "2024-08-25T15:00:00Z", "presence": { "online": true, "lastSeenAt": "2024-08-25T15:00:00Z" }, "match": { "field": "Plan", "value": "enterprise" }, "caseCount": 0, "openCaseCount": 0, "lastActivityAt": "2024-08-25T15:00:00Z" } ] }
json
application/json

Create a contact

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

A contact is the person the organization attends. Send externalRef to keep your own id on it: sending the same externalRef again is a 409. To create or update in one call, use PUT /v2/contacts/by-external-ref/{externalRef}.

Required scope: contacts:write.

Create a contact › 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.

Create a contact › Request Body

CreateContact
name
​string · minLength: 1 · maxLength: 255 · required
email
​string · email · maxLength: 255 · pattern: ^[A-Za-z0-9!#$%&'*+/…
phone
​string · minLength: 1 · maxLength: 50
externalRef
​string · minLength: 1 · maxLength: 255

Your own id for this person. Unique in the organization: sending it again is a 409.

companyId
​string

The company this person works in, created with POST /v2/companies. A company that does not exist in the organization is a 400 with param companyId.

tags
​string[] · maxItems: 20
​object

Values for the contact fields you created with POST /v2/contact-fields, by key. Each value is checked against the type of its field. Nothing is saved if one key or value is not accepted.

Create a contact › Responses

Contact
object
​string · enum · required
Enum values:
contact
id
​string · required
name
​string · required
email
​string | null · required
phone
​string | null · required
externalRef
​string | null · required
companyId
​string | null · required

The company of this contact, or null when it has none.

tags
​string[] · required
​object · required

The values of the contact fields this contact has, by key. Empty when it has none.

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

Whether the contact is online. Present only when the organization setting presenceEnabled is on, at least one presence signal has arrived, and the key has the contacts:presence-read scope.

match
​object | null

Only when you search with q: the field of the contact that matched and its value, or null when the match was the name, email, phone or externalRef. Fields marked sensitive are never searched or shown.

caseCount
​integer

Only when you search, filter by pipeline or open cases, or sort: how many cases the contact has.

openCaseCount
​integer

Same as caseCount, only the open ones.

lastActivityAt
​string · date-time

Same as caseCount: the latest message of its cases, or its creation date.

POST/v2/contacts
curl https://api.lelemon.cl/v2/contacts \ --request POST \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer <token>' \ --data '{ "name": "Ana Pérez", "email": "[email protected]", "phone": "+56912345678", "externalRef": "crm-4471", "companyId": "cpy_02y0e5MANqacVbmtn1YyeJ", "tags": [ "vip" ], "fields": { "plan": "pro" } }'
Example Request Body
{ "name": "Ana Pérez", "email": "[email protected]", "phone": "+56912345678", "externalRef": "crm-4471", "companyId": "cpy_02y0e5MANqacVbmtn1YyeJ", "tags": [ "vip" ], "fields": { "plan": "pro" } }
json
application/json
Example Responses
{ "object": "contact", "id": "ctc_4Zq0x8bVw1TqS9mYp3RkLd", "name": "Ana Pérez", "email": "email", "phone": "phone", "externalRef": "externalRef", "companyId": "cpy_4Zq0x8bVw1TqS9mYp3RkLd", "tags": [ "string" ], "fields": { "plan": "pro" }, "createdAt": "2024-08-25T15:00:00Z", "updatedAt": "2024-08-25T15:00:00Z", "presence": { "online": true, "lastSeenAt": "2024-08-25T15:00:00Z" }, "match": { "field": "Plan", "value": "enterprise" }, "caseCount": 0, "openCaseCount": 0, "lastActivityAt": "2024-08-25T15:00:00Z" }
json
application/json

Create or update a contact by your own id

PUT
https://api.lelemon.cl
/v2/contacts/by-external-ref/{externalRef}
Bearer (API key)

Calling it twice with the same externalRef leaves one contact. The fields you omit stay as they were; a new contact with no name is named after the externalRef. Always answers 200.

Required scope: contacts:write.

Create or update a contact by your own id › path Parameters

externalRef
​string · required

Your own id for this person. The contact with this externalRef is updated; if there is none it is created.

Create or update a contact by your own id › 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.

Create or update a contact by your own id › Request Body optional

UpsertContact
name
​string · minLength: 1 · maxLength: 255

Required to create. When the contact exists and you omit it, the name stays. A new contact with no name is named after the externalRef.

email
​string · email · maxLength: 255 · pattern: ^[A-Za-z0-9!#$%&'*+/…
phone
​string · minLength: 1 · maxLength: 50
companyId
​string | null

Links the contact to a company. When you omit it the company stays; null unlinks it. A company that does not exist in the organization is a 400 with param companyId.

tags
​string[] · maxItems: 20
​object

Values for the contact fields you created with POST /v2/contact-fields, by key. The keys you omit stay as they were; null removes the value. Each value is checked against the type of its field. Nothing is saved if one key or value is not accepted.

Create or update a contact by your own id › Responses

Contact
object
​string · enum · required
Enum values:
contact
id
​string · required
name
​string · required
email
​string | null · required
phone
​string | null · required
externalRef
​string | null · required
companyId
​string | null · required

The company of this contact, or null when it has none.

tags
​string[] · required
​object · required

The values of the contact fields this contact has, by key. Empty when it has none.

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

Whether the contact is online. Present only when the organization setting presenceEnabled is on, at least one presence signal has arrived, and the key has the contacts:presence-read scope.

match
​object | null

Only when you search with q: the field of the contact that matched and its value, or null when the match was the name, email, phone or externalRef. Fields marked sensitive are never searched or shown.

caseCount
​integer

Only when you search, filter by pipeline or open cases, or sort: how many cases the contact has.

openCaseCount
​integer

Same as caseCount, only the open ones.

lastActivityAt
​string · date-time

Same as caseCount: the latest message of its cases, or its creation date.

PUT/v2/contacts/by-external-ref/{externalRef}
curl https://api.lelemon.cl/v2/contacts/by-external-ref/:externalRef \ --request PUT \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer <token>' \ --data '{ "name": "Ana Pérez", "email": "[email protected]", "phone": "+56912345678", "tags": [ "vip" ] }'
Example Request Body
{ "name": "Ana Pérez", "email": "[email protected]", "phone": "+56912345678", "tags": [ "vip" ] }
json
application/json
Example Responses
{ "object": "contact", "id": "ctc_4Zq0x8bVw1TqS9mYp3RkLd", "name": "Ana Pérez", "email": "email", "phone": "phone", "externalRef": "externalRef", "companyId": "cpy_4Zq0x8bVw1TqS9mYp3RkLd", "tags": [ "string" ], "fields": { "plan": "pro" }, "createdAt": "2024-08-25T15:00:00Z", "updatedAt": "2024-08-25T15:00:00Z", "presence": { "online": true, "lastSeenAt": "2024-08-25T15:00:00Z" }, "match": { "field": "Plan", "value": "enterprise" }, "caseCount": 0, "openCaseCount": 0, "lastActivityAt": "2024-08-25T15:00:00Z" }
json
application/json

Retrieve a contact

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

Returns one contact by id. Use it to refresh a single record you already know; to find records, use the list route. To search for a person, 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: contacts:read.

Retrieve a contact › path Parameters

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

The id of the contact (ctc_…).

Retrieve a contact › 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 contact › Responses

Contact
object
​string · enum · required
Enum values:
contact
id
​string · required
name
​string · required
email
​string | null · required
phone
​string | null · required
externalRef
​string | null · required
companyId
​string | null · required

The company of this contact, or null when it has none.

tags
​string[] · required
​object · required

The values of the contact fields this contact has, by key. Empty when it has none.

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

Whether the contact is online. Present only when the organization setting presenceEnabled is on, at least one presence signal has arrived, and the key has the contacts:presence-read scope.

match
​object | null

Only when you search with q: the field of the contact that matched and its value, or null when the match was the name, email, phone or externalRef. Fields marked sensitive are never searched or shown.

caseCount
​integer

Only when you search, filter by pipeline or open cases, or sort: how many cases the contact has.

openCaseCount
​integer

Same as caseCount, only the open ones.

lastActivityAt
​string · date-time

Same as caseCount: the latest message of its cases, or its creation date.

GET/v2/contacts/{id}
curl https://api.lelemon.cl/v2/contacts/:id \ --header 'Authorization: Bearer <token>'
Example Responses
{ "object": "contact", "id": "ctc_4Zq0x8bVw1TqS9mYp3RkLd", "name": "Ana Pérez", "email": "email", "phone": "phone", "externalRef": "externalRef", "companyId": "cpy_4Zq0x8bVw1TqS9mYp3RkLd", "tags": [ "string" ], "fields": { "plan": "pro" }, "createdAt": "2024-08-25T15:00:00Z", "updatedAt": "2024-08-25T15:00:00Z", "presence": { "online": true, "lastSeenAt": "2024-08-25T15:00:00Z" }, "match": { "field": "Plan", "value": "enterprise" }, "caseCount": 0, "openCaseCount": 0, "lastActivityAt": "2024-08-25T15:00:00Z" }
json
application/json

Erase a contact

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

Use it when a person asks to be erased or when you decide to erase them. It is permanent: the contact, its cases, messages, files, fields, agent memory and logs lose their content; the contact is anonymized in place and what remains is an aggregate shell of each case with a new id and dates cut to the day. It does not delete rows, so statistics keep working. The erasure runs as a job: it answers 202 with a suppression to follow with GET /v2/suppressions/{id} and the contact.suppressed webhook. Without closeOpenCases it answers 409 resource_in_use while the contact has open cases. Use dryRun=true first to get the inventory without content (200, changes nothing). legalHold=true records the request and keeps everything until you repeat it without legalHold. Not idempotent in effect but safe to repeat: once started the contact answers 404.

Required scope: contacts:erase.

Erase a contact › path Parameters

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

The id of the contact (ctc_…).

Erase a contact › query Parameters

reason
​string · enum

Why the contact is erased: the person asked (data_subject_request) or you decided it as the data controller (controller_instruction). It is kept in the suppression record.

Enum values:
data_subject_request
controller_instruction
Default: data_subject_request
legalHold
​boolean

true: you must keep this data by law (a debt, a credit, a refund). The request is recorded as held and nothing is erased until you repeat it without legalHold.

closeOpenCases
​boolean

true: close the open cases of the contact and erase it. Without it, a contact with open cases is a 409 resource_in_use.

dryRun
​boolean

When true, the request goes through the same validation as the real one and is answered with what would happen (always 200), and nothing is saved, sent or charged. The answer has the same shape as the real one plus dryRun: true; an id in it is not saved. It does not use the Idempotency-Key.

Erase a contact › 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.

Erase a contact › Responses

dryRun=true: the inventory, nothing changes.

What a dryRun answer adds to the normal one: nothing was saved, sent or charged, and an id in it is not saved.
object
​string · enum · required
Enum values:
suppression
id
​string | null · required

null on a dryRun: nothing was created.

contactId
​string · required
status
​string · enum · required
Enum values:
queued
running
done
failed
held
preview
phase
​string | null · enum · required
Enum values:
inventory
rows
objects
rest
done
reason
​string · enum · required
Enum values:
data_subject_request
controller_instruction
legalHold
​boolean · required
closedOpenCases
​number · required
​object · required

Rows erased or anonymized per store. Numbers only.

errorCode
​string | null · required
​required

Only on dryRun: what would be erased, by store, without content.

createdAt
​string | null · required
completedAt
​string | null · required
dryRun
​boolean · const

Present and true only on a dry run: nothing was erased and the inventory shows what would be.

Const value:
DELETE/v2/contacts/{id}
curl https://api.lelemon.cl/v2/contacts/:id \ --request DELETE \ --header 'Authorization: Bearer <token>'
Example Responses
{ "object": "suppression", "id": "sup_3PqA0x8bVw1TqS9mYp3RkL", "contactId": "ctc_7Hc2LmQ0x8bVw1TqS9mYp3", "status": "queued", "phase": "inventory", "reason": "data_subject_request", "legalHold": true, "closedOpenCases": 0, "counts": { "key": 0 }, "errorCode": "errorCode", "inventory": { "cases": 0, "openCases": 0, "files": 0, "stores": [ { "id": "conversation_messages", "store": "table", "rows": 0 } ] }, "createdAt": "createdAt", "completedAt": "completedAt", "dryRun": true }
json
application/json

Update a contact

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

Send null in email, phone or externalRef to remove it. tags replaces the whole list.

Required scope: contacts:write.

Update a contact › path Parameters

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

The id of the contact (ctc_…).

Update a contact › 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 contact › Request Body optional

UpdateContact
name
​string · minLength: 1 · maxLength: 255
email
​string | null · email · maxLength: 255 · pattern: ^[A-Za-z0-9!#$%&'*+/…

null removes it.

phone
​string | null · minLength: 1 · maxLength: 50

null removes it.

externalRef
​string | null · minLength: 1 · maxLength: 255

null removes it.

companyId
​string | null

Links the contact to a company, or to another one. null unlinks it. A company that does not exist in the organization is a 400 with param companyId.

tags
​string[] · maxItems: 20

Replaces the whole list.

​object

Values for the contact fields you created with POST /v2/contact-fields, by key. The keys you omit stay as they were; null removes the value. Each value is checked against the type of its field. Nothing is saved if one key or value is not accepted.

Update a contact › Responses

Contact
object
​string · enum · required
Enum values:
contact
id
​string · required
name
​string · required
email
​string | null · required
phone
​string | null · required
externalRef
​string | null · required
companyId
​string | null · required

The company of this contact, or null when it has none.

tags
​string[] · required
​object · required

The values of the contact fields this contact has, by key. Empty when it has none.

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

Whether the contact is online. Present only when the organization setting presenceEnabled is on, at least one presence signal has arrived, and the key has the contacts:presence-read scope.

match
​object | null

Only when you search with q: the field of the contact that matched and its value, or null when the match was the name, email, phone or externalRef. Fields marked sensitive are never searched or shown.

caseCount
​integer

Only when you search, filter by pipeline or open cases, or sort: how many cases the contact has.

openCaseCount
​integer

Same as caseCount, only the open ones.

lastActivityAt
​string · date-time

Same as caseCount: the latest message of its cases, or its creation date.

PATCH/v2/contacts/{id}
curl https://api.lelemon.cl/v2/contacts/:id \ --request PATCH \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer <token>' \ --data '{ "email": "[email protected]", "companyId": "cpy_02y0e5MANqacVbmtn1YyeJ", "tags": [ "vip" ], "fields": { "plan": "max", "segment": null } }'
Example Request Body
{ "email": "[email protected]", "companyId": "cpy_02y0e5MANqacVbmtn1YyeJ", "tags": [ "vip" ], "fields": { "plan": "max", "segment": null } }
json
application/json
Example Responses
{ "object": "contact", "id": "ctc_4Zq0x8bVw1TqS9mYp3RkLd", "name": "Ana Pérez", "email": "email", "phone": "phone", "externalRef": "externalRef", "companyId": "cpy_4Zq0x8bVw1TqS9mYp3RkLd", "tags": [ "string" ], "fields": { "plan": "pro" }, "createdAt": "2024-08-25T15:00:00Z", "updatedAt": "2024-08-25T15:00:00Z", "presence": { "online": true, "lastSeenAt": "2024-08-25T15:00:00Z" }, "match": { "field": "Plan", "value": "enterprise" }, "caseCount": 0, "openCaseCount": 0, "lastActivityAt": "2024-08-25T15:00:00Z" }
json
application/json

KnowledgeContact fields