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

Agent tools


List an agent's tools

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

Every action and MCP tool this agent could use, plus the Lelemon system tools (transfer_to_human, save_case_data, send_buttons, send_list, send_products, send_carousel, send_cta_url, send_flow, request_location, ask_team, check_availability, schedule_meeting and cancel_meeting), with granted saying which ones it may use now. Newest first, system tools last. For a granted transfer_to_human or save_case_data, config holds how it was set up; the other system tools take no config. Other Lelemon built-in tools and connectors are not listed here.

Required scope: actions:read.

List an agent's tools › path Parameters

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

The id of the agent (agt_…).

List an agent's tools › query Parameters

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

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

granted
​string · enum

true: only what the agent may use. false: only what it could use but has not been granted.

Enum values:
true
false

List an agent's tools › 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 an agent's tools › Responses

AgentToolList
object
​string · enum · required
Enum values:
list
hasMore
​boolean · required
nextCursor
​string | null · required
​AgentTool[] · required
GET/v2/agents/{id}/tools
curl https://api.lelemon.cl/v2/agents/:id/tools \ --header 'Authorization: Bearer <token>'
Example Responses
{ "object": "list", "hasMore": true, "nextCursor": "nextCursor", "data": [ { "object": "agent_tool", "id": "act_5RvP2aKq9XwLmN3tYbZc01", "kind": "action", "name": "create_order", "description": "description", "serverId": "mcp_02y0e5MANqacVbmtn1YyeJ", "sharedByPlatform": true, "connectorId": "dcn_4Zq0x8bVw1TqS9mYp3RkLd", "granted": true, "config": { "stageId": "stg_5RvP2aKq9XwLmN3tYbZc01", "businessHours": { "timezone": "America/Santiago", "startHour": 9, "endHour": 18, "activeSaturday": false, "activeSunday": false }, "farewell": { "duringBusinessHours": "Te paso con una persona del equipo. Te escribe en breve.", "outsideBusinessHours": "Te paso con una persona del equipo. Hoy ya cerramos: te escribe mañana desde las 9." }, "fields": [ "comuna", "rut_comprador" ] }, "approval": { "mode": "never", "condition": { "param": "amount", "op": "eq", "value": {} }, "rules": [ { "when": { "param": "amount", "op": "eq", "value": {} }, "effect": "allow", "approvers": [ { "type": "role", "value": "admin" } ], "expiresInMinutes": 1, "escalateAfterMinutes": 1, "customerMessage": "customerMessage" } ], "accumulated": { "param": "amount", "period": "day", "limit": 50000 }, "approvers": [ { "type": "role", "value": "admin" } ], "expiresInMinutes": 1440, "escalateAfterMinutes": 1, "customerMessage": "customerMessage", "automatedDecision": true }, "approvalFloor": { "mode": "never", "condition": { "param": "amount", "op": "eq", "value": {} }, "rules": [ { "when": { "param": "amount", "op": "eq", "value": {} }, "effect": "allow", "approvers": [ { "type": "role", "value": "admin" } ], "expiresInMinutes": 1, "escalateAfterMinutes": 1, "customerMessage": "customerMessage" } ], "accumulated": { "param": "amount", "period": "day", "limit": 50000 }, "approvers": [ { "type": "role", "value": "admin" } ], "expiresInMinutes": 1440, "escalateAfterMinutes": 1, "customerMessage": "customerMessage", "automatedDecision": true } } ] }
json
application/json

Grant a tool

PUT
https://api.lelemon.cl
/v2/agents/{id}/tools/{toolId}
Bearer (API key)

Lets the agent use an action (act_), an MCP tool (mtl_) or a system tool. Use it to give the agent the ability to hand a case to a person (path value transfer_to_human), to write the case fields whose source is agent (path value save_case_data), or to send interactive WhatsApp messages (path value send_buttons for up to 3 reply buttons, send_list for a menu of 4 to 10 options, send_products for catalog products, send_carousel for 2 to 10 swipeable cards, send_cta_url for one link button, send_flow to open a WhatsApp Flow, request_location to ask for a shared location). To let the agent book and cancel meetings on your default agenda, grant check_availability, schedule_meeting and cancel_meeting (they take no config, and the agenda has to be set up first). One tool at a time, so two people granting at once do not undo each other. Idempotent: granting twice with the same body changes nothing. For a system tool, config replaces the stored one and leaving it out clears it; transfer_to_human takes stageId, businessHours and farewell, save_case_data takes fields. For an action or MCP tool, approval puts it behind a person (see GET /v2/approvals): leaving it out keeps the current policy, mode never lifts it. To let the agent ask your team without handing over the case, grant ask_team (answers go through POST /v2/team-questions/{id}/answer). A handed-over case fires case.escalated and moves to human control.

Required scope: actions:write.

Grant a tool › path Parameters

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

The id of the agent (agt_…).

toolId
​string · pattern: ^(?:act_[0-9A-Za-z]{… · required

An action (act_…), an MCP tool (mtl_…), a data connector tool (dct_…) or a system tool name such as transfer_to_human.

Grant a tool › 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.

Grant a tool › Request Body optional

GrantTool
​object

Only for the system tools transfer_to_human and save_case_data. It replaces the stored configuration: leaving it out clears it. Actions and MCP tools take no configuration.

​object

Only for actions and MCP tools. Puts the tool behind a person: the agent proposes, a person or a named API key decides, and only an approval runs the action. Leaving it out keeps the policy the tool already has, so granting again never lifts it. To lift it, send mode never.

Grant a tool › Responses

AgentTool
object
​string · enum · required
Enum values:
agent_tool
id
​string · required

act_ for an action, mtl_ for an MCP tool, dct_ for a data connector tool, the tool name itself for a system tool. Use it in the path of PUT and DELETE.

kind
​string · enum · required
Enum values:
action
mcp_tool
data_connector_tool
system
name
​string · required
description
​string · required
granted
​boolean · required

True when this agent may use it now.

serverId
​string

For an MCP tool, the server it comes from.

sharedByPlatform
​boolean

For an action or an MCP tool: true when it belongs to your platform and is shared with your subaccounts. Absent for system tools and your own.

connectorId
​string

For a data connector tool (dct_), the data connector it reads. Only internal agents, such as a support copilot, can be granted them.

​

For a granted system tool, its configuration. Null when it has none. Absent for actions and MCP tools.

​object

The approval policy of an action or MCP tool for this agent. mode never when it runs without approval. Absent for system tools.

​object

The minimum approval your platform set for this shared action (PUT /v2/actions/{id}/approval-floor). It applies on top of approval: the stricter one wins, and approval cannot be mode never. Absent when there is none.

PUT/v2/agents/{id}/tools/{toolId}
curl https://api.lelemon.cl/v2/agents/:id/tools/:toolId \ --request PUT \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer <token>' \ --data '{ "approval": { "mode": "when", "condition": { "param": "amount", "op": "gt", "value": 20000 }, "approvers": [ { "type": "role", "value": "admin" } ], "expiresInMinutes": 60 } }'
Example Request Body
{ "approval": { "mode": "when", "condition": { "param": "amount", "op": "gt", "value": 20000 }, "approvers": [ { "type": "role", "value": "admin" } ], "expiresInMinutes": 60 } }
json
application/json
Example Responses
{ "object": "agent_tool", "id": "act_5RvP2aKq9XwLmN3tYbZc01", "kind": "action", "name": "create_order", "description": "description", "serverId": "mcp_02y0e5MANqacVbmtn1YyeJ", "sharedByPlatform": true, "connectorId": "dcn_4Zq0x8bVw1TqS9mYp3RkLd", "granted": true, "config": { "stageId": "stg_5RvP2aKq9XwLmN3tYbZc01", "businessHours": { "timezone": "America/Santiago", "startHour": 9, "endHour": 18, "activeSaturday": false, "activeSunday": false }, "farewell": { "duringBusinessHours": "Te paso con una persona del equipo. Te escribe en breve.", "outsideBusinessHours": "Te paso con una persona del equipo. Hoy ya cerramos: te escribe mañana desde las 9." }, "fields": [ "comuna", "rut_comprador" ] }, "approval": { "mode": "never", "condition": { "param": "amount", "op": "eq", "value": {} }, "rules": [ { "when": { "param": "amount", "op": "eq", "value": {} }, "effect": "allow", "approvers": [ { "type": "role", "value": "admin" } ], "expiresInMinutes": 1, "escalateAfterMinutes": 1, "customerMessage": "customerMessage" } ], "accumulated": { "param": "amount", "period": "day", "limit": 50000 }, "approvers": [ { "type": "role", "value": "admin" } ], "expiresInMinutes": 1440, "escalateAfterMinutes": 1, "customerMessage": "customerMessage", "automatedDecision": true }, "approvalFloor": { "mode": "never", "condition": { "param": "amount", "op": "eq", "value": {} }, "rules": [ { "when": { "param": "amount", "op": "eq", "value": {} }, "effect": "allow", "approvers": [ { "type": "role", "value": "admin" } ], "expiresInMinutes": 1, "escalateAfterMinutes": 1, "customerMessage": "customerMessage" } ], "accumulated": { "param": "amount", "period": "day", "limit": 50000 }, "approvers": [ { "type": "role", "value": "admin" } ], "expiresInMinutes": 1440, "escalateAfterMinutes": 1, "customerMessage": "customerMessage", "automatedDecision": true } }
json
application/json

Remove a tool

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

The agent stops using it. The action or MCP tool itself stays; for a system tool its configuration is deleted. Removing a tool the agent did not have is not an error.

Required scope: actions:write.

Remove a tool › path Parameters

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

The id of the agent (agt_…).

toolId
​string · pattern: ^(?:act_[0-9A-Za-z]{… · required

An action (act_…), an MCP tool (mtl_…), a data connector tool (dct_…) or a system tool name such as transfer_to_human.

Remove a tool › 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.

Remove a tool › Responses

Removed.

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

SkillsApprovals