AbraTabia AI Storyteller Chat API Reference

Updated July 2026
Everything your game sends and receives goes through a handful of JSON endpoints, and one of them, api.php/chat, does nearly all the work for all three bot types. This page documents every request field, every response field, the action signals, and the supporting endpoints for knowledge, memory, and crawling. If you have not installed the server yet, start with getting started.

Authentication and Request Format

All endpoints are POST with a JSON body. Send your key in the X-API-Key header, or as an apiKey field in the body. Paths use path info, and if your server does not support that, api.php?action=chat works the same as api.php/chat.

curl -X POST https://yourserver.com/api.php/chat \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_KEY" \
  -d '{"chatbotID": "my-storyteller", "prompt": "I push open the tavern door.", "convoID": ""}'

POST api.php/chat: Request Fields

Three fields carry a basic conversation, everything else is optional or gamehost-specific.

FieldNotes
chatbotIDRequired. The bot ID from the admin area.
promptRequired. The user or player message.
convoIDBlank starts a new conversation, then echo back the returned value on every following message.
userInfoOptional object stored with the conversation. Its fname value is told to the bot, so the narrator can use the player's name.
userKnowledgeBaseOptional per-user memory tag. Setting it enables long-term memory recall and saving for that player. See knowledge base and memory.
passedRulesOptional extra rules string appended for this request only, useful for temporary constraints like "the player is poisoned this scene".
gameRulesGamehost only. The rules of your game as text.
actionsListGamehost only. Object of {"actionName": "when to fire it"} custom actions.
numPlayersGamehost only. Required on the first message of a new game, 1 to 10.
playerGamehost only. Which player number is talking.
startDataGamehost only. That player's secret setup info during pre-game.
playerDataGamehost only. That player's submission for the current turn.

POST api.php/chat: Response Fields

FieldNotes
messageThe bot's reply text.
actionBlank, or an action word your UI can react to (see below).
convoIDThe conversation ID to send with the next message.
errorBlank on success.
noticeOnly present when a non-fatal problem occurred, like a failed knowledge lookup. The reply still came back, but you may want to log it.
billingRough token usage for the request, handy for cost tracking per session.
playerDataGamehost only. Submissions received for the current turn.
currentTurnGamehost only. -1 during pre-game setup, then 0 and up.

Action Signals

Bots return an action field alongside each message so your UI can react without parsing the prose:

Bot typeActions
Storytellerchoice (a real decision point), chapter (scene break), encounter (someone or something important appeared), cleanup (history was compacted).
Assistantangry (the user is frustrated), cleanup.
GamehostWhatever you define in actionsList.

How to use the storyteller actions well is covered in the storyteller bots guide, and the gamehost turn flow in the gamehost guide.

POST api.php/knowledge/add

Store text in the knowledge base. Long text is chunked automatically, and unchanged chunks are skipped for free on re-submits, so pushing the same document twice costs nothing.

FieldNotes
dataRequired. The text to store.
tagRequired. Which collection to store it in.
name, titleOptional labels for managing content later.

POST api.php/knowledge/search

Search the knowledge base directly, useful for debugging retrieval or building your own lookups.

FieldNotes
promptRequired. The search text.
tagOptional. Blank searches everything.
numResultsOptional. How many scored matches to return.

POST api.php/memory/add

Store a user memory directly, bypassing the automatic after-response saving. Fields: data (the memory text) and tag (the user's memory tag).

POST api.php/crawl

Crawl a website into the knowledge base. This endpoint also requires the admin password in the X-Admin-Password header, since a crawl is an administrative action that spends embedding credits.

FieldNotes
urlRequired. Where to start crawling. Same-domain pages only.
tagOptional. Defaults to the domain.
maxPagesOptional. Up to 200.
Key Takeaway

One endpoint carries the whole conversation: send chatbotID, prompt, and convoID, get back message, action, and the next convoID. Add userKnowledgeBase for per-player memory, the gamehost fields for multiplayer, and the knowledge endpoints to keep your lore current.