Search Documentation
Search for a documentation page...
Elliot Runs API
Hand Elliot, the store's AI operator, a job over the Store API, follow the run and answer the approvals it waits on.
Elliot is the store's AI operator in the admin. A run hands him a job from outside: he works it the way he does in the dashboard chat (reads and changes the store, edits the storefront, writes copy) as the team member the connection acts for, with that member's permissions. Use a run for work that needs judgement or several steps. For one lookup or one change, call that operation directly.
Who can start a run
Only a team member can hand Elliot a job: connect over OAuth. A store API key gets 403, because a narrowly scoped key could otherwise do through Elliot what its own scopes refuse. Every member may start runs, as every member may talk to Elliot in the dashboard. The OAuth connection needs the ai:write scope.
A run spends the store's AI credits like any Elliot conversation, and is refused with 402 when they are spent. Reading a run and answering it spend nothing themselves; the work an answer resumes does. Get AI credits shows what is left.
Approvals stay on
A step that needs the team's approval (deletes, refunds, customer sends, publishing and the like) pauses the run as needs_input until someone answers it, through Answer a run or in the dashboard. There is no mode that skips approvals.
Start a run
| Field | Type | Required | Description |
|---|---|---|---|
message | string | Yes | What to ask Elliot, as a person on the team would write it. Up to 20,000 characters |
threadId | string | No | Continue this conversation, from an earlier run. Omit to start a new one |
approvalMode | "supervised" | "read_only" | No | supervised (default): every step that needs approval pauses the run. read_only: Elliot only looks things up, and anything that would change the store is refused |
waitSeconds | integer | No | Hold the answer for up to 50 seconds until the run needs input or ends. Defaults to 0 |
idempotencyKey | string | No | Send the same key again when a request may not have arrived. A repeat returns the run the first request started instead of sending the message twice |
Response (202)
| Field | Description |
|---|---|
id | The run. Use it to read and answer the run |
threadId | The conversation. Send it with the next run to continue. The conversation also shows in the team's Elliot panel |
status | running, needs_input (an approval or a question waits, see pendingInputs), completed or failed (error says why) |
pendingInputs | What the run waits on: { id, kind, title, prompt, options, allowsText, action, answerable }. kind is approval, question, sign-in or budget. For an approval, action is the exact operation and input Elliot wants to run |
reply | Elliot's answer as markdown, once he has written one |
files | Download links, { url, filename }, to files Elliot shared in this run |
waitTimedOut | true when the wait ran out while the run kept going. It is not a failure: read the run again instead of starting it over |
Errors
| Status | Description |
|---|---|
402 | The store has no AI credits left |
403 | The caller is not a team member: a store API key, or Elliot himself |
404 | Thread not found |
409 | The thread has ended. Start a new one |
Get a run
Where the run stands: still working, waiting on an approval or a question, or done with its reply. waitSeconds (up to 50) holds the answer until the run needs input or ends. The response has the same shape as Start a run. A run of another store answers 404.
Answer a run
Approves or denies the actions the run waits on, or answers its questions, then lets the run go on.
| Field | Type | Required | Description |
|---|---|---|---|
answers | object[] | Yes | 1–20 answers, each naming a pending input's id |
answers[].decision | "approve" | "deny" | For an approval | Let the action run, or stop it |
answers[].optionId | string | For a question | The id of the chosen option |
answers[].text | string | For a question that takes text | The answer |
waitSeconds | integer | No | Hold the answer for up to 50 seconds until the run needs input again or ends |
idempotencyKey | string | No | As for starting a run |
An approval lets Elliot run exactly the action shown in pendingInputs[].action, which can delete data, move money or reach customers. Show the person you work for what will happen, and answer with their decision. A sign-in can only be finished in the YNS dashboard.
Errors
| Status | Description |
|---|---|
403 | The answer was refused, or the caller is not a team member |
404 | Run not found |
409 | The run is not waiting for these inputs, or its thread has ended |
Related
- MCP Server – the full server offers runs as
startElliotRun,getElliotRunandanswerElliotApprovals; the directory versions leave them out - Scripts – many calls in one request, without Elliot