LanaChat

API: scripts, steps and folders

5 min readUpdated Markdown

A script is a fixed sequence of steps for one creator: each step is a text, optional media from the Vault, a price in Stars and a wait before the next one. Scripts sit in folders. One script per creator can be marked first: it runs on new conversations.

Endpoints #

MethodPathDescriptionPermissionStatus
GET/scriptsList scripts (creator_id= required, folder_id=, active=true)can_setupPlanned
POST/scriptsCreate a script with its stepscan_setupPlanned
GET/scripts/{id}One script and its stepscan_setupPlanned
PUT/scripts/{id}Replace a script (name, steps, folder, accounts)can_setupPlanned
PATCH/scripts/{id}Turn it on or off, mark it first, move it to a foldercan_setupPlanned
POST/scripts/{id}/duplicateCopy a script (the copy is never first)can_setupPlanned
DELETE/scripts/{id}Delete a scriptcan_setupPlanned
GET/scripts/foldersFolders of a creator (creator_id=)can_setupPlanned
POST/scripts/foldersCreate a foldercan_setupPlanned
PATCH/scripts/folders/{id}Rename a foldercan_setupPlanned
DELETE/scripts/folders/{id}Delete a folder; its scripts move to "No folder"can_setupPlanned
POST/conversations/{id}/scriptRun a script on one conversation (see Conversations)can_chatPlanned

The script object #

{
  "id": "scr_204",
  "creator_id": "cr_lea",
  "name": "Welcome message",
  "goal": "First sale within the first day",
  "folder_id": "fld_12",
  "active": true,
  "first": true,
  "account_ids": null,
  "steps": [
    { "id": "st_1", "name": "Hello", "text": "Hey you 😊 glad you found me here", "media": [], "wait_minutes": 0, "pricing": { "mode": "free" } },
    { "id": "st_2", "name": "First set", "text": "Made this one this morning…", "media": ["med_5521", "med_5522"], "wait_minutes": 20, "pricing": { "mode": "paid", "stars": 250, "discount_stars": 200 } }
  ],
  "created_at": "2026-09-30T10:00:00Z",
  "updated_at": "2026-10-05T16:22:00Z"
}
FieldTypeDescription
idstringStarts with scr_
creator_idstringThe creator whose fans receive it
namestringIts name in the Console
goalstring or nullWhat the script is for, in your words
folder_idstring or nullIts folder; null is "No folder"
activebooleanfalse means it never runs
firstbooleantrue means it runs on new conversations
account_idsarray or nullnull means every Telegram account of the creator; an array means only those (at least one)
stepsarrayThe steps, in order (see below)
created_at, updated_atstringISO 8601, UTC

Each step has:

FieldTypeDescription
idstringStarts with st_
namestringIts name in the editor
textstringThe message the fan receives
mediaarray of stringsMedia ids from the creator's Vault
wait_minutesnumberWait before this step is sent
pricing.modestringfree, vault (each media at its Vault price) or paid (one price for the whole step)
pricing.starsnumberThe price in Stars, when mode is paid
pricing.discount_starsnumberOptional lower price in Stars

Setting first: true on a script removes it from the creator's other scripts.

Scripts #

List scripts #

GET /scripts · can_setup

ParameterTypeRequiredDescription
creator_idstringYesThe creator
folder_idstringNoOnly the scripts of this folder
activebooleanNotrue lists only the scripts that are on
limit, cursornumber, stringNoPagination
curl "https://api.lanachat.ai/v1/scripts?creator_id=cr_lea&active=true" \
  -H "Authorization: Bearer $LANACHAT_TOKEN"

The answer is a page of script objects in data, with next_cursor. Without creator_id the API answers 400.

Create a script #

POST /scripts · can_setup

ParameterTypeRequiredDescription
creator_idstringYesThe creator
namestringYesIts name
stepsarrayYesThe steps, as in the object above (without id)
goalstringNoWhat it is for
folder_idstringNoA folder of the same creator
account_idsarray of stringsNoOnly these accounts; leave it out for all
curl -X POST https://api.lanachat.ai/v1/scripts \
  -H "Authorization: Bearer $LANACHAT_TOKEN" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"creator_id": "cr_lea", "name": "Win back", "steps": [{"name": "Miss you", "text": "Hey stranger, where did you go?", "wait_minutes": 0, "pricing": {"mode": "free"}}]}'
{
  "id": "scr_231",
  "creator_id": "cr_lea",
  "name": "Win back",
  "goal": null,
  "folder_id": null,
  "active": true,
  "first": false,
  "account_ids": null,
  "steps": [ { "id": "st_1", "name": "Miss you", "text": "Hey stranger, where did you go?", "media": [], "wait_minutes": 0, "pricing": { "mode": "free" } } ],
  "created_at": "2026-10-06T14:30:00Z",
  "updated_at": "2026-10-06T14:30:00Z"
}

The answer is the new script (201), active, not first, in no folder. A media id from another creator's Vault is refused (400).

Get a script #

GET /scripts/{id} · can_setup

curl https://api.lanachat.ai/v1/scripts/scr_204 \
  -H "Authorization: Bearer $LANACHAT_TOKEN"

The answer is the script object with all its steps.

Replace a script #

PUT /scripts/{id} · can_setup

Send the whole script: name, steps, folder_id and account_ids, as in Create a script. Steps you leave out are removed.

curl -X PUT https://api.lanachat.ai/v1/scripts/scr_231 \
  -H "Authorization: Bearer $LANACHAT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name": "Win back", "folder_id": "fld_12", "account_ids": null, "steps": [{"name": "Miss you", "text": "Hey stranger, where did you go?", "wait_minutes": 0, "pricing": {"mode": "free"}}, {"name": "Gift", "text": "Kept this one for you", "media": ["med_5522"], "wait_minutes": 30, "pricing": {"mode": "paid", "stars": 200}}]}'

The answer is the updated script. An empty account_ids array answers 400: use null for every account.

Turn on, mark first, move #

PATCH /scripts/{id} · can_setup

ParameterTypeRequiredDescription
activebooleanNoTurn it on or off
firstbooleanNotrue makes it the script of new conversations
folder_idstring or nullNoMove it; null is "No folder"
curl -X PATCH https://api.lanachat.ai/v1/scripts/scr_231 \
  -H "Authorization: Bearer $LANACHAT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"first": true}'

The answer is the updated script. The creator's previous first script loses first.

Duplicate a script #

POST /scripts/{id}/duplicate · can_setup

curl -X POST https://api.lanachat.ai/v1/scripts/scr_204/duplicate \
  -H "Authorization: Bearer $LANACHAT_TOKEN" \
  -H "Idempotency-Key: $(uuidgen)"

The answer is the copy (201). The copy is never first.

Delete a script #

DELETE /scripts/{id} · can_setup

curl -X DELETE https://api.lanachat.ai/v1/scripts/scr_231 \
  -H "Authorization: Bearer $LANACHAT_TOKEN"

Folders #

List folders #

GET /scripts/folders · can_setup

ParameterTypeRequiredDescription
creator_idstringYesThe creator
curl "https://api.lanachat.ai/v1/scripts/folders?creator_id=cr_lea" \
  -H "Authorization: Bearer $LANACHAT_TOKEN"

Create a folder #

POST /scripts/folders · can_setup

ParameterTypeRequiredDescription
creator_idstringYesThe creator
namestringYesFolder name
curl -X POST https://api.lanachat.ai/v1/scripts/folders \
  -H "Authorization: Bearer $LANACHAT_TOKEN" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"creator_id": "cr_lea", "name": "Win back"}'

Rename a folder #

PATCH /scripts/folders/{id} · can_setup

curl -X PATCH https://api.lanachat.ai/v1/scripts/folders/fld_12 \
  -H "Authorization: Bearer $LANACHAT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name": "Welcome"}'

Delete a folder #

DELETE /scripts/folders/{id} · can_setup

curl -X DELETE https://api.lanachat.ai/v1/scripts/folders/fld_12 \
  -H "Authorization: Bearer $LANACHAT_TOKEN"

Its scripts are kept and move to "No folder".

Run a script on a conversation #

POST /conversations/{id}/script · can_chat

Starts a script on one fan's conversation: state becomes script until it ends. Body, example and rules are in Conversations.

Latest news about Lana on Telegram

New releases and beta invites, first in the channel.