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

Agents


List agents

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

Newest first.

Required scope: agents:read.

List agents › query Parameters

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

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

status
​string · enum
Enum values:
draft
active
paused
archived
slug
​string

Exact match on the agent slug.

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

AgentList
object
​string · enum · required
Enum values:
list
hasMore
​boolean · required
nextCursor
​string | null · required
​Agent[] · required
GET/v2/agents
curl https://api.lelemon.cl/v2/agents \ --header 'Authorization: Bearer <token>'
Example Responses
{ "object": "list", "hasMore": true, "nextCursor": "nextCursor", "data": [ { "object": "agent", "id": "agt_4Zq0x8bVw1TqS9mYp3RkLd", "name": "name", "audience": "customers", "description": "description", "status": "draft", "version": 0, "instructions": "instructions", "variables": { "key": "string" }, "llmConfig": { "model": "anthropic/claude-sonnet-4.6", "temperature": 0, "maxOutputTokens": 0, "effort": "low", "thinking": "adaptive", "alwaysLoadedTools": [ "string" ], "fallback": { "model": "anthropic/claude-sonnet-4.6", "temperature": 0, "maxOutputTokens": 0, "effort": "low", "thinking": "adaptive", "alwaysLoadedTools": [ "string" ] } }, "maxTokens": 0, "maxIterations": 0, "channels": [ "whatsapp" ], "behaviors": {}, "avatar": "avatar", "createdAt": "2024-08-25T15:00:00Z", "updatedAt": "2024-08-25T15:00:00Z" } ] }
json
application/json

Create an agent

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

Creates a draft agent from scratch (name, instructions and llmConfig) or from a template with fromTemplate. Anything you send overrides the template. llmConfig.model is a public id from GET /v2/models such as anthropic/claude-sonnet-4.6. Activate it when it is ready. audience internal creates a copilot for your team that can use the tools of your data connector (dct_): it needs the scope agents:internal, cannot come from a template and cannot be changed later; you operate it afterwards like any agent.

Required scope: agents:write.

Create an 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.

Create an agent › Request Body

anyOf
At least one variant must match. Multiple variants may match simultaneously.

Decision Table

VariantMatching Criteria
type = object · requires: fromTemplate
type = object · requires: name, instructions, llmConfig
Properties for Variant 1:
fromTemplate
​string · maxLength: 60 · required

A template from GET /v2/agent-templates.

audience
​string · enum

customers: the agent talks to your customers. internal: a copilot that answers your team and can use the tools of your data connector (dct_) to read your back office. Creating an internal one needs the scope agents:internal (403 scope_missing otherwise) and it cannot be made from a template. It cannot be changed later.

Enum values:
customers
internal
Default: customers
name
​string · minLength: 1 · maxLength: 255

Required unless fromTemplate is set.

description
​string · maxLength: 1000
instructions
​string · minLength: 1 · maxLength: 200000

How the agent behaves. Required unless fromTemplate is set. May hold {{name}} placeholders.

​object

Values for the {{name}} placeholders in the instructions, and any fact the agent should know. Replaces the whole map. Every placeholder needs a value or the answer is 422 template_variable_missing.

​object

Required unless fromTemplate is set.

maxTokens
​integer · min: 1000 · max: 5000000
maxIterations
​integer · min: 1 · max: 50
channels
​string[]

Where the agent answers. An empty list means every channel.

Enum values:
whatsapp
api
web
email
​BehaviorInput
avatar
​string · minLength: 1 · maxLength: 50

Create an agent › Responses

Agent
object
​string · enum · required
Enum values:
agent
id
​string · required
name
​string · required
audience
​string · enum · required

customers: talks to your customers. internal: a copilot for your team created with the scope agents:internal.

Enum values:
customers
internal
description
​string | null · required
status
​string · enum · required
Enum values:
draft
active
paused
archived
version
​integer · required

Goes up on every change. Send it back as expectedVersion.

instructions
​string · required

As you wrote them, with the {{name}} placeholders still in place.

​object | null · required
​ModelConfig · required
maxTokens
​integer · required
maxIterations
​integer · required
channels
​string[] · required
Enum values:
whatsapp
api
web
email
​object · required
avatar
​string | null · required
createdAt
​string · date-time · required
updatedAt
​string · date-time · required
POST/v2/agents
curl https://api.lelemon.cl/v2/agents \ --request POST \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer <token>' \ --data '{ "fromTemplate": "atp_02y0e5MANqacVbmtn1YyeJ" }'
Example Request Body
{ "fromTemplate": "atp_02y0e5MANqacVbmtn1YyeJ" }
json
application/json
Example Responses
{ "object": "agent", "id": "agt_4Zq0x8bVw1TqS9mYp3RkLd", "name": "name", "audience": "customers", "description": "description", "status": "draft", "version": 0, "instructions": "instructions", "variables": { "key": "string" }, "llmConfig": { "model": "anthropic/claude-sonnet-4.6", "temperature": 0, "maxOutputTokens": 0, "effort": "low", "thinking": "adaptive", "alwaysLoadedTools": [ "string" ], "fallback": { "model": "anthropic/claude-sonnet-4.6", "temperature": 0, "maxOutputTokens": 0, "effort": "low", "thinking": "adaptive", "alwaysLoadedTools": [ "string" ] } }, "maxTokens": 0, "maxIterations": 0, "channels": [ "whatsapp" ], "behaviors": {}, "avatar": "avatar", "createdAt": "2024-08-25T15:00:00Z", "updatedAt": "2024-08-25T15:00:00Z" }
json
application/json

Retrieve an agent

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

Returns one agent by id. Use it to refresh a single record you already know; to find records, use the list route. To change it, use the update 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: agents:read.

Retrieve an agent › path Parameters

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

The id of the agent (agt_…).

Retrieve an 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.

Retrieve an agent › Responses

Agent
object
​string · enum · required
Enum values:
agent
id
​string · required
name
​string · required
audience
​string · enum · required

customers: talks to your customers. internal: a copilot for your team created with the scope agents:internal.

Enum values:
customers
internal
description
​string | null · required
status
​string · enum · required
Enum values:
draft
active
paused
archived
version
​integer · required

Goes up on every change. Send it back as expectedVersion.

instructions
​string · required

As you wrote them, with the {{name}} placeholders still in place.

​object | null · required
​ModelConfig · required
maxTokens
​integer · required
maxIterations
​integer · required
channels
​string[] · required
Enum values:
whatsapp
api
web
email
​object · required
avatar
​string | null · required
createdAt
​string · date-time · required
updatedAt
​string · date-time · required
GET/v2/agents/{id}
curl https://api.lelemon.cl/v2/agents/:id \ --header 'Authorization: Bearer <token>'
Example Responses
{ "object": "agent", "id": "agt_4Zq0x8bVw1TqS9mYp3RkLd", "name": "name", "audience": "customers", "description": "description", "status": "draft", "version": 0, "instructions": "instructions", "variables": { "key": "string" }, "llmConfig": { "model": "anthropic/claude-sonnet-4.6", "temperature": 0, "maxOutputTokens": 0, "effort": "low", "thinking": "adaptive", "alwaysLoadedTools": [ "string" ], "fallback": { "model": "anthropic/claude-sonnet-4.6", "temperature": 0, "maxOutputTokens": 0, "effort": "low", "thinking": "adaptive", "alwaysLoadedTools": [ "string" ] } }, "maxTokens": 0, "maxIterations": 0, "channels": [ "whatsapp" ], "behaviors": {}, "avatar": "avatar", "createdAt": "2024-08-25T15:00:00Z", "updatedAt": "2024-08-25T15:00:00Z" }
json
application/json

Delete an agent

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

Answers 409 resource_in_use while the agent has open conversations or serves a pipeline stage.

Required scope: agents:write.

Delete an agent › path Parameters

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

The id of the agent (agt_…).

Delete an 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.

Delete an agent › Responses

Deleted.

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

Update an agent

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

Changes only what you send. Changing instructions or variables creates a version. Send expectedVersion so two people cannot overwrite each other: if someone saved first you get 409 agent_version_conflict. llmConfig replaces the whole model configuration; send model as a public id from GET /v2/models.

Required scope: agents:write.

Update an agent › path Parameters

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

The id of the agent (agt_…).

Update an 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.

Update an agent › Request Body optional

UpdateAgent
name
​string · minLength: 1 · maxLength: 255
description
​string · maxLength: 1000
instructions
​string · minLength: 1 · maxLength: 200000

Creates a version. May hold {{name}} placeholders; they are filled with variables.

​object

Values for the {{name}} placeholders in the instructions, and any fact the agent should know. Replaces the whole map. Every placeholder needs a value or the answer is 422 template_variable_missing. Creates a version.

​ModelConfigInput
maxTokens
​integer · min: 1000 · max: 5000000
maxIterations
​integer · min: 1 · max: 50
channels
​string[]

Where the agent answers. An empty list means every channel.

Enum values:
whatsapp
api
web
email
​object

Merged into the current behaviors, key by key.

avatar
​string | null · minLength: 1 · maxLength: 50
expectedVersion
​integer · min: 1

The version you read. If someone saved first the answer is 409 agent_version_conflict and nothing is written.

Update an agent › Responses

Agent
object
​string · enum · required
Enum values:
agent
id
​string · required
name
​string · required
audience
​string · enum · required

customers: talks to your customers. internal: a copilot for your team created with the scope agents:internal.

Enum values:
customers
internal
description
​string | null · required
status
​string · enum · required
Enum values:
draft
active
paused
archived
version
​integer · required

Goes up on every change. Send it back as expectedVersion.

instructions
​string · required

As you wrote them, with the {{name}} placeholders still in place.

​object | null · required
​ModelConfig · required
maxTokens
​integer · required
maxIterations
​integer · required
channels
​string[] · required
Enum values:
whatsapp
api
web
email
​object · required
avatar
​string | null · required
createdAt
​string · date-time · required
updatedAt
​string · date-time · required
PATCH/v2/agents/{id}
curl https://api.lelemon.cl/v2/agents/:id \ --request PATCH \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer <token>' \ --data '{ "instructions": "You answer questions about orders in one short sentence.", "llmConfig": { "model": "anthropic/claude-sonnet-5.5", "temperature": 0.3 }, "expectedVersion": 3 }'
Example Request Body
{ "instructions": "You answer questions about orders in one short sentence.", "llmConfig": { "model": "anthropic/claude-sonnet-5.5", "temperature": 0.3 }, "expectedVersion": 3 }
json
application/json
Example Responses
{ "object": "agent", "id": "agt_4Zq0x8bVw1TqS9mYp3RkLd", "name": "name", "audience": "customers", "description": "description", "status": "draft", "version": 0, "instructions": "instructions", "variables": { "key": "string" }, "llmConfig": { "model": "anthropic/claude-sonnet-4.6", "temperature": 0, "maxOutputTokens": 0, "effort": "low", "thinking": "adaptive", "alwaysLoadedTools": [ "string" ], "fallback": { "model": "anthropic/claude-sonnet-4.6", "temperature": 0, "maxOutputTokens": 0, "effort": "low", "thinking": "adaptive", "alwaysLoadedTools": [ "string" ] } }, "maxTokens": 0, "maxIterations": 0, "channels": [ "whatsapp" ], "behaviors": {}, "avatar": "avatar", "createdAt": "2024-08-25T15:00:00Z", "updatedAt": "2024-08-25T15:00:00Z" }
json
application/json

Activate an agent

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

Turns the agent on, so it starts answering real people, and says in readiness what still keeps people from reaching it: no stage, not the entry stage, or no api channel. An empty readiness.missing means it is reachable. Use dryRun=true first: it runs the same checks (422 agent_not_ready when something is missing) and answers with the agent as it would be once active and its readiness, without turning it on.

Required scope: agents:write.

Activate an agent › path Parameters

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

The id of the agent (agt_…).

Activate an agent › query Parameters

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.

Activate an 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.

Activate an agent › Responses

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:
agent
id
​string · required
name
​string · required
audience
​string · enum · required

customers: talks to your customers. internal: a copilot for your team created with the scope agents:internal.

Enum values:
customers
internal
description
​string | null · required
status
​string · enum · required
Enum values:
draft
active
paused
archived
version
​integer · required

Goes up on every change. Send it back as expectedVersion.

instructions
​string · required

As you wrote them, with the {{name}} placeholders still in place.

​object | null · required
​ModelConfig · required
maxTokens
​integer · required
maxIterations
​integer · required
channels
​string[] · required
Enum values:
whatsapp
api
web
email
​object · required
avatar
​string | null · required
createdAt
​string · date-time · required
updatedAt
​string · date-time · required
​Readiness · required
dryRun
​boolean · const

Present and true when the request had dryRun=true.

Const value:
POST/v2/agents/{id}/activate
curl https://api.lelemon.cl/v2/agents/:id/activate \ --request POST \ --header 'Authorization: Bearer <token>'
Example Responses
{ "object": "agent", "id": "agt_4Zq0x8bVw1TqS9mYp3RkLd", "name": "name", "audience": "customers", "description": "description", "status": "draft", "version": 0, "instructions": "instructions", "variables": { "key": "string" }, "llmConfig": { "model": "anthropic/claude-sonnet-4.6", "temperature": 0, "maxOutputTokens": 0, "effort": "low", "thinking": "adaptive", "alwaysLoadedTools": [ "string" ], "fallback": { "model": "anthropic/claude-sonnet-4.6", "temperature": 0, "maxOutputTokens": 0, "effort": "low", "thinking": "adaptive", "alwaysLoadedTools": [ "string" ] } }, "maxTokens": 0, "maxIterations": 0, "channels": [ "whatsapp" ], "behaviors": {}, "avatar": "avatar", "createdAt": "2024-08-25T15:00:00Z", "updatedAt": "2024-08-25T15:00:00Z", "readiness": { "ready": true, "missing": [ { "code": "no_stage", "message": "message" } ] }, "dryRun": true }
json
application/json

Pause an agent

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

Stops answering. Open conversations stay; it answers again when activated.

Required scope: agents:write.

Pause an agent › path Parameters

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

The id of the agent (agt_…).

Pause an 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.

Pause an agent › Responses

AgentWithReadiness
object
​string · enum · required
Enum values:
agent
id
​string · required
name
​string · required
audience
​string · enum · required

customers: talks to your customers. internal: a copilot for your team created with the scope agents:internal.

Enum values:
customers
internal
description
​string | null · required
status
​string · enum · required
Enum values:
draft
active
paused
archived
version
​integer · required

Goes up on every change. Send it back as expectedVersion.

instructions
​string · required

As you wrote them, with the {{name}} placeholders still in place.

​object | null · required
​ModelConfig · required
maxTokens
​integer · required
maxIterations
​integer · required
channels
​string[] · required
Enum values:
whatsapp
api
web
email
​object · required
avatar
​string | null · required
createdAt
​string · date-time · required
updatedAt
​string · date-time · required
​Readiness · required
POST/v2/agents/{id}/pause
curl https://api.lelemon.cl/v2/agents/:id/pause \ --request POST \ --header 'Authorization: Bearer <token>'
Example Responses
{ "object": "agent", "id": "agt_4Zq0x8bVw1TqS9mYp3RkLd", "name": "name", "audience": "customers", "description": "description", "status": "draft", "version": 0, "instructions": "instructions", "variables": { "key": "string" }, "llmConfig": { "model": "anthropic/claude-sonnet-4.6", "temperature": 0, "maxOutputTokens": 0, "effort": "low", "thinking": "adaptive", "alwaysLoadedTools": [ "string" ], "fallback": { "model": "anthropic/claude-sonnet-4.6", "temperature": 0, "maxOutputTokens": 0, "effort": "low", "thinking": "adaptive", "alwaysLoadedTools": [ "string" ] } }, "maxTokens": 0, "maxIterations": 0, "channels": [ "whatsapp" ], "behaviors": {}, "avatar": "avatar", "createdAt": "2024-08-25T15:00:00Z", "updatedAt": "2024-08-25T15:00:00Z", "readiness": { "ready": true, "missing": [ { "code": "no_stage", "message": "message" } ] } }
json
application/json

List versions

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

Newest first, without the text. A version is saved each time the instructions or variables change, and says who made it.

Required scope: agents:read.

List versions › path Parameters

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

The id of the agent (agt_…).

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

AgentVersionList
object
​string · enum · required
Enum values:
list
hasMore
​boolean · required
nextCursor
​string | null · required
​AgentVersion[] · required
GET/v2/agents/{id}/versions
curl https://api.lelemon.cl/v2/agents/:id/versions \ --header 'Authorization: Bearer <token>'
Example Responses
{ "object": "list", "hasMore": true, "nextCursor": "nextCursor", "data": [ { "object": "agent_version", "id": "agv_4Tn2Lm0x8bVw1TqS9mYp3R", "agentId": "agt_4Zq0x8bVw1TqS9mYp3RkLd", "version": 0, "author": { "type": "user", "id": "key_3PqA0x8bVw1TqS9mYp3RkL" }, "chars": 0, "createdAt": "2024-08-25T15:00:00Z" } ] }
json
application/json

Retrieve a version

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

Includes the instructions and variables of that version.

Required scope: agents:read.

Retrieve a version › path Parameters

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

The id of the agent (agt_…).

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

The id of the agent version (agv_…).

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

AgentVersionWithText
object
​string · enum · required
Enum values:
agent_version
id
​string · required
agentId
​string · required
version
​integer · required

The agent version this one left in place.

​VersionAuthor · required
chars
​integer · required

Length of the instructions.

createdAt
​string · date-time · required
instructions
​string · required

The instructions as written, with placeholders in place.

​object | null · required
GET/v2/agents/{id}/versions/{versionId}
curl https://api.lelemon.cl/v2/agents/:id/versions/:versionId \ --header 'Authorization: Bearer <token>'
Example Responses
{ "object": "agent_version", "id": "agv_4Tn2Lm0x8bVw1TqS9mYp3R", "agentId": "agt_4Zq0x8bVw1TqS9mYp3RkLd", "version": 0, "author": { "type": "user", "id": "key_3PqA0x8bVw1TqS9mYp3RkL" }, "chars": 0, "createdAt": "2024-08-25T15:00:00Z", "instructions": "instructions", "variables": { "key": "string" } }
json
application/json

Restore a version

POST
https://api.lelemon.cl
/v2/agents/{id}/versions/{versionId}/restore
Bearer (API key)

Writes that version's instructions and variables as a new version. History never shrinks.

Required scope: agents:write.

Restore a version › path Parameters

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

The id of the agent (agt_…).

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

The id of the agent version (agv_…).

Restore a version › 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.

Restore a version › Responses

Agent
object
​string · enum · required
Enum values:
agent
id
​string · required
name
​string · required
audience
​string · enum · required

customers: talks to your customers. internal: a copilot for your team created with the scope agents:internal.

Enum values:
customers
internal
description
​string | null · required
status
​string · enum · required
Enum values:
draft
active
paused
archived
version
​integer · required

Goes up on every change. Send it back as expectedVersion.

instructions
​string · required

As you wrote them, with the {{name}} placeholders still in place.

​object | null · required
​ModelConfig · required
maxTokens
​integer · required
maxIterations
​integer · required
channels
​string[] · required
Enum values:
whatsapp
api
web
email
​object · required
avatar
​string | null · required
createdAt
​string · date-time · required
updatedAt
​string · date-time · required
POST/v2/agents/{id}/versions/{versionId}/restore
curl https://api.lelemon.cl/v2/agents/:id/versions/:versionId/restore \ --request POST \ --header 'Authorization: Bearer <token>'
Example Responses
{ "object": "agent", "id": "agt_4Zq0x8bVw1TqS9mYp3RkLd", "name": "name", "audience": "customers", "description": "description", "status": "draft", "version": 0, "instructions": "instructions", "variables": { "key": "string" }, "llmConfig": { "model": "anthropic/claude-sonnet-4.6", "temperature": 0, "maxOutputTokens": 0, "effort": "low", "thinking": "adaptive", "alwaysLoadedTools": [ "string" ], "fallback": { "model": "anthropic/claude-sonnet-4.6", "temperature": 0, "maxOutputTokens": 0, "effort": "low", "thinking": "adaptive", "alwaysLoadedTools": [ "string" ] } }, "maxTokens": 0, "maxIterations": 0, "channels": [ "whatsapp" ], "behaviors": {}, "avatar": "avatar", "createdAt": "2024-08-25T15:00:00Z", "updatedAt": "2024-08-25T15:00:00Z" }
json
application/json

List the fixed facts of an agent

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

The facts the agent keeps in its memory and receives in every conversation: the ones you save here and the ones it saved on its own. Most recently updated first, up to 50 in total. Add q to keep the facts whose key or value contains that text. Facts are not versioned: saving one replaces the previous value. Read only. It is safe to repeat.

Required scope: agents:read.

List the fixed facts of an agent › path Parameters

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

The id of the agent (agt_…).

List the fixed facts of an agent › query Parameters

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

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

q
​string · maxLength: 120

Only the facts whose key or value contains this text.

List the fixed facts of an 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.

List the fixed facts of an agent › Responses

AgentFactList
object
​string · enum · required
Enum values:
list
hasMore
​boolean · required
nextCursor
​string | null · required
​AgentFact[] · required
GET/v2/agents/{id}/facts
curl https://api.lelemon.cl/v2/agents/:id/facts \ --header 'Authorization: Bearer <token>'
Example Responses
{ "object": "list", "hasMore": true, "nextCursor": "nextCursor", "data": [ { "object": "agent_fact", "key": "horario", "value": "Lunes a viernes de 9 a 18", "source": "manual", "createdAt": "2024-08-25T15:00:00Z", "updatedAt": "2024-08-25T15:00:00Z" } ] }
json
application/json

Save a fixed fact of an agent

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

Saves the value under the key. If the agent already has a fact with that key, the value is replaced; otherwise it is added. key is snake_case. It is safe to repeat with the same body: the result does not change.

Required scope: agents:write.

Save a fixed fact of an agent › path Parameters

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

The id of the agent (agt_…).

Save a fixed fact of an 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.

Save a fixed fact of an agent › Request Body optional

UpsertAgentFact

Save a fixed fact of an agent › Responses

AgentFact
object
​string · enum · required
Enum values:
agent_fact
key
​string · required
value
​string · required
source
​string · enum · required

manual when someone wrote it through the API or the dashboard, auto when the agent saved it on its own.

Enum values:
manual
auto
createdAt
​string · date-time · required
updatedAt
​string · date-time · required
PUT/v2/agents/{id}/facts
curl https://api.lelemon.cl/v2/agents/:id/facts \ --request PUT \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer <token>' \ --data '{ "key": "horario", "value": "Lunes a viernes de 9 a 18" }'
Example Request Body
{ "key": "horario", "value": "Lunes a viernes de 9 a 18" }
json
application/json
Example Responses
{ "object": "agent_fact", "key": "horario", "value": "Lunes a viernes de 9 a 18", "source": "manual", "createdAt": "2024-08-25T15:00:00Z", "updatedAt": "2024-08-25T15:00:00Z" }
json
application/json

Forget a fixed fact of an agent

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

The agent stops receiving that fact. Repeating the call returns 404 not_found, because the fact no longer exists, so do not retry a 404 as a failure.

Required scope: agents:write.

Forget a fixed fact of an agent › path Parameters

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

The id of the agent (agt_…).

key
​string · required

The key of the fact.

Forget a fixed fact of an 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.

Forget a fixed fact of an agent › Responses

Forgotten.

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

API keysModels and templates