Developer API
Turn any inbox into a SlyOS channel.
You have somewhere people write to you — a helpdesk, a ticketing system, your own app’s chat. Send those messages to SlyOS and it writes the reply, using the same Brain, the same learned voice and the same history as your own inbox. You send the reply yourself, however you already send things.
10¢ per AI response. Taking messages in, reading things back, checking your balance and reporting what you sent are all free. So is a retry. So is the sandbox, up to 50 drafts a day.
Step 1 — get a key
Open Settings, press Plan, then Developer. Press Create my first key.
That one press makes three things: a project, a sandbox channel to send messages to, and your first key. The key is shown once — copy it then. We keep only a fingerprint of it, so nobody, including us, can show it to you again.
Keys starting sly_test_ are the sandbox: free, they reach nobody, and they write up to 50 replies a day per account — plenty to build and test with, not a way to run a helpdesk. Keys starting sly_live_ are real, and cost 10¢ a reply. Start in the sandbox.
A key created this way can take messages in, ask for drafts, read them back, report deliveries and check the balance — 5 permissions, which is what an integration needs and nothing more. It cannot change what SlyOS believes about anybody. To teach replies about your business from your own server (step 5), give a live key brain:read and brain:write as well: live and sandbox replies use the same knowledge, so a sandbox key may read it but not change it.
Step 2 — set up your terminal
Paste this once. Take the channel id from the Channels list on the same screen — tap it to copy.
export SLY=https://api.slyos.world/v1/developer
export K=your_key_here
export CH=your_channel_id_here
export A="Authorization: Bearer $K"
export J="Content-Type: application/json"Check it works. This is free:
curl -s $SLY/wallet -H "$A" | jqBefore the first reply — teach SlyOS your business
A reply is only as good as what SlyOS knows about the business it speaks for. Before the first one, hand it the material your answers must agree with — every reply is then given your rules and the passages nearest the message, and written in the voice SlyOS has learned for the account:
- Links and whole sites.
POST /v1/developer/knowledge/sourceswith{"url": "…"}reads one page — your pricing, your policies, a regulation your answers must respect. Add"crawl": trueto read the whole site. - Files. The same call as
multipart/form-data, with the file in afilefield: PDF, Word, plain text, Markdown or CSV. It is read to the end. - Rules.
"rules": true(arules=trueform field, for a file) marks a source replies must follow rather than draw on: terms, a returns policy, a regulation. Every reply carries the rules whole while they fit in one reply; past that, each reply gets the rules nearest its message, and the source saysrules_fit: false. - Who you are.
PUT /v1/developer/knowledge/profilesays what the business is and how it wants to sound.
Sources are read in the background: status goes queued, processing, then ready — or failed, with status_reason saying why. A web page is read without running its scripts, so a page that builds its content with JavaScript (prices drawn from a script, a template filled in after it loads) can be missing what a visitor sees: the source is then ready with a warning naming those pages in incomplete_pages — add that text as a file, or as a single link to a page that shows it. Adding and changing them needs a live key carrying brain:write — sandbox and live replies share them, so a sandbox key may only read them; listing them, brain:read. GET /v1/developer/knowledge/sources/{sourceId}/passages shows exactly what was read. Replies use what you add, the conversation they answer and that customer’s earlier ones — never another customer’s, and never a sandbox conversation in a live reply. They also use everything SlyOS knows about the account owner: facts from their own conversations and the ones they told it, their past replies on their other channels, their documents, calendar and saved details, and their About you. The owner can turn that off on the Developer screen (use_personal_context); a key cannot change it. Off, a reply still uses the owner’s name, rules and writing style. Sources added with a key belong to its project unless the request sends "scope": "account". When sources disagree. Each reply is given the passages nearest the message. The closest always goes in. The best passage of each other source about as relevant goes in ahead of the rest, in up to half of what a reply carries, so a long website cannot crowd out a short policy; after that, no one source takes more than half while another has something about as relevant. Where two disagree, the reply follows the higher one — rules, then uploaded files, then single links, then pages read from a whole site — and never contradicts the business’s own documents. That order settles disagreements only: a reply answers from the passage that answers the question, and says what another organisation’s page says as theirs. Every reply then says what it relied on: sources, on the POST /v1/developer/drafts answer and on GET /v1/developer/drafts/{draftId}, lists the passages it was given — rules first — with the source, the page range or section, an excerpt of the passage’s own text, and a SHA-256 of the stored passage (with carried_chars when only its start fit).
Your website, every page of it:
curl -s -X POST $SLY/knowledge/sources -H "$A" -H "$J" -d '{"url":"https://www.example.com/","crawl":true}' | jqA file your replies must follow:
curl -s -X POST $SLY/knowledge/sources -H "$A" -F 'file=@returns-policy.pdf' -F 'rules=true' -F 'title=Returns policy' | jq '{id, status}'Who you are, and how you sound:
curl -s -X PUT $SLY/knowledge/profile -H "$A" -H "$J" -d '{"business_name":"Example Co","description":"We make and sell refillable kitchen goods online, shipping to the US and Canada. We do not take phone orders.","tone_notes":"Warm and brief. Sign off as “The Example Co team”."}' | jqStep 3 — the four calls
That is the whole API. Everything else is a convenience.
A message arrives in your system · Free — always
Send it to SlyOS the moment it lands. This is free even when your balance is zero, on purpose: a support ticket must never be lost because an account ran out of credit.
POST /v1/developer/messages
Ask SlyOS to write the reply · 10¢
The only call that costs anything. The reply is written by the same Brain your inbox uses — your facts, the voice it has learned for that channel, and the conversation so far.
POST /v1/developer/drafts
Tell SlyOS what happened to it · Free
You send the reply through your own system. This is how every SlyOS surface learns it went out, so the conversation reads the same on the web and on your phone.
POST /v1/developer/deliveries
Check what you can still afford · Free
Call it before a burst. An adapter that checks first can queue or escalate to a human; one that does not finds out in the middle of answering somebody.
GET /v1/developer/wallet
Step 4 — run it
Send a message in. It appears in your SlyOS inbox immediately. The ids are your system’s own; sending the same external_message_id again stores nothing new.
export TICKET=ticket-$(date +%s)
export MSG=$(curl -s -X POST $SLY/messages -H "$A" -H "$J" -d "{
\"channel_id\": \"$CH\",
\"external_thread_id\": \"$TICKET\",
\"external_message_id\": \"$TICKET-comment-1\",
\"body\": \"Do you ship to Canada, and how long does delivery take?\",
\"sender_display_name\": \"Dana\"
}" | jq -r .message_id); echo $MSGNow ask for the reply:
export DRAFT=$(curl -s -X POST $SLY/drafts -H "$A" -H "$J" -d "{
\"generation_id\": \"${MSG}:reply-1\",
\"message_id\": \"$MSG\"
}" | tee reply.json | jq -r .draft_id)
jq '{held_for_review, hold_reasons, body, sources}' reply.jsonOnly send it without a person looking if held_for_review is false. true means SlyOS’s checks held it for a person — money, a sensitive subject, a rule you set, somebody asking whether they are talking to a person — and hold_reasons says which. Route it to a person instead. null means the verdict could not be read back: treat it as held. A retry’s answer carries the same hold. sources lists what the reply relied on of what your business handed SlyOS (step 5).
Send it however you already send things, then tell SlyOS it went. Name the draft you sent, so the conversation shows it as SlyOS’s reply and the ticket stops waiting, and your own id for the sent message, so a report you repeat is one message:
curl -s -X POST $SLY/deliveries -H "$A" -H "$J" -d "{
\"message_id\": \"$MSG\",
\"status\": \"delivered\",
\"draft_id\": \"$DRAFT\",
\"external_message_id\": \"comment-1\"
}" | jqIf a person edited the draft before it went, send what actually went as body beside the draft_id. If a person at your end wrote a reply of their own, send it as body with no draft_id: that is your voice, and it is what SlyOS learns your voice from. It never learns from its own drafts.
Step 5 — what replies rely on
Every reply is written from the parts of what you handed SlyOS that answer the message, in your voice. Mark a short policy as rules and every reply carries it whole — up to about 8,000 characters of rules, two or three pages. Past that, each reply gets the rules nearest its message, and the source says so with rules_fit: false: keep as rules what every reply must follow, and add long documents, like a regulation, as reference. Adding knowledge is free; it is also on the Developer screen, under Knowledge. Changing it needs a live key — sandbox and live replies share it, so a sandbox key can only read it.
Each source is read in the background: queued, then ready, or failed with a status_reason that says why in plain words. Read it back, see exactly what was read, read a link again, or delete it. A link read again that has not changed is kept as it was, and costs nothing. A page that builds its content with JavaScript is read without running it, so what it draws can be missing: the source is then ready with a warning naming those pages in incomplete_pages — add that text as a file, or as a single link to a page that shows it:
When your sources disagree, a reply follows the higher one: rules, then files you uploaded, then single links, then pages read from a whole site — and it never contradicts your own documents. That order settles disagreements only: a reply answers from the passage that answers the question. The passage closest to the message always goes in, and the best passage of each other source about as relevant goes in ahead of the rest, so a long website cannot crowd out a short policy.
Every reply says what it relied on. POST /drafts and GET /drafts/:id carry sources: the source, the page range or section, an excerpt of the passage's own text, how close it was to the message, and whether it was a rule.
"sources": [
{ "source_id": "…", "title": "Customer policy.pdf", "page": 4, "page_end": null, "rule": true, "rank": 1, "score": 0.41 },
{ "source_id": "…", "title": "Support policy.pdf", "page": 11, "page_end": 12, "rule": false, "rank": 1, "score": 0.38 },
{ "source_id": "…", "title": "Pricing", "url": "https://acme.example.com/pricing", "rule": false, "rank": 2, "score": 0.58 }
]Replies use what you add here, the conversation and this customer's earlier ones — never another customer's, and never a sandbox conversation in a live reply. They also use everything SlyOS knows about the account owner: facts from their own conversations and the ones they told it, their past replies on their other channels, their documents, calendar and saved details, and their About you. The owner can turn that off on the Developer screen (use_personal_context); a key cannot change it. Off, a reply still uses the owner's name, rules and writing style. Sources added with a key belong to its project unless you send "scope": "account".
Limits: 25 MB a file, two uploads at a time, 200 sources and about 12 million characters an account, and 2 million characters a source. PDFs are read page by page, up to 2,000 pages every 30 days on a paid plan or with money in the wallet, 100 without. Each limit is said in words when it is reached.
The one rule worth learning
generation_id is your name for one reply, and it is what you are billed on.
So make it unique and reproducible: build it from the message_id SlyOS gave you, as <message_id>:reply-1 — the sample above does. A message_id is unique across every SlyOS account, so yours cannot collide with anybody else’s; your own ticket numbers can, because every helpdesk starts counting at 1. If your network drops mid-call, send the identical request again and you will not be charged twice.
A reply that fails is never charged for. Neither is one we refuse, one the model could not produce, or one you cancel.
When it says no
Every refusal has the same shape, whatever the status — a code you can branch on and a message written for a person. Some carry extra fields beside them; a 402 tells you what you had and what the reply needed.
{ "code": "insufficient_funds", "message": "…", "available_cents": 0, "needed_cents": 10 }generation_in_progress means another request with your generation_id is still being written. Wait for Retry-After and send the same request again, with the same id — you get that reply, charged once. So is not_stored, video_busy, video_no_takes_ready on a message you send in: send the same request again. It is safe — a message is stored once — and a ticket is never dropped.429Too many calls this minute, or the sandbox’s 50 drafts for the day are used. Wait for Retry-After and send it again.503Our providers are unreachable. Wait for Retry-After and retry with the same generation_id. You were not charged.Every refusal worth sending again, exactly as the API declares it. Anything not on this list will answer the same way the second time:
Optional — get told instead of asking
Set an endpoint on the Developer screen and SlyOS will post to it when a draft is ready, instead of you polling. Sandbox and live are separate endpoints: drafts made with a sandbox key go to the sandbox one, drafts made with a live key to the live one, so your production server never receives a test. A live endpoint must be https; the sandbox one may be plain http, for a tunnel while you build. Neither may point at a private or internal address, and both must listen on port 443 (or 80). Read the reply with GET /v1/developer/drafts/{draft_id} and send it only when it is not held for review — the event and the read both carry held_for_review, and a reply that does not say false is held. Send from the webhook or from the answer to your POST, not both: every reply raises the event, including the ones you already sent. Every delivery is signed:
POST <your endpoint>
SlyOS-Signature: t=<unix seconds>,v1=<hex>
Content-Type: application/json
{
"id": "<event id — the same on every retry of this event>",
"type": "draft.ready",
"created": 1791100800,
"environment": "live",
"data": {
"draft_id": "…",
"card_id": "…",
"generation_id": "<yours>",
"generation": 1,
"environment": "live",
"held_for_review": false,
"hold_reasons": [],
"hold_detail": null
}
}Never send a draft whose held_for_review is true without a person reading it first. SlyOS held it on purpose, and hold_reasons says why (each reason as a code and a label). The event types are draft.ready and webhook.test and video.ready and video.failed and video.evaluated; webhook.test is what the Send test button sends.
Answer with any 2xx within ten seconds. Anything else — an error, a timeout, or a redirect, which is never followed — is retried: 8 attempts in all, thirty seconds apart and doubling, over about 62 minutes. After the last one the event is shown as failed on the Developer screen, where Retry sends it again. An endpoint that stops answering is tried less often, so that window can stretch. Delivered and failed events, with their attempts, are kept for 30 days. A retry can reach you after an attempt that did in fact arrive, so dedupe on the event’s id.
The signature is HMAC-SHA256 of the string "<t>.<raw body>" using your endpoint secret. Check the timestamp is within 5 minutes and compare in constant time — the timestamp is signed with the body so that a delivery somebody captures cannot be replayed at you forever. Every retry is signed afresh.
During a secret rotation you will see two v1= values in one header. Accept the request if either matches; that is what lets you redeploy without dropping deliveries. The old secret keeps verifying for an hour.
A complete, dependency-free adapter — the four calls, this check, and the rule that a held reply is never sent — in one file: adapter.mjs.
Optional — read the business
A key with business:read reads what SlyOS shows the business on its Marketing, Ads, Outreach and Affiliates pages; one with revenue:read reads its store sales and its Value page; one with account:read reads Settings › Channels. Each answers in one shape — a title, summary lines, one row per thing, and open_in_slyos. Nothing here changes anything: starting an ad, sending an email, paying an affiliate and posting are done in SlyOS. Store sales and the Value page carry money, so they answer only a key whose maker holds Revenue on the team.
GET /v1/developer/posts(business:read) — The business’s scheduled posts, from today: each one’s time, place, first line and state. Read-only: nothing is posted from here.GET /v1/developer/post-plan(business:read) — The post planner’s current two-week plan: what it was made from, and each draft’s day, place, words and state.GET /v1/developer/marketing-results(business:read) — How the business’s posts and ads did over the last 7 or 30 days: what worked, what to change, and each place side by side.GET /v1/developer/ads(business:read) — Every ad made in SlyOS, on every network: its state, what it spent, its clicks — and the spend, clicks and orders of the last 7 and 30 days.GET /v1/developer/outreach/campaigns(business:read) — The business’s outreach emails, one by one and to many: each campaign’s state and how far it got.GET /v1/developer/affiliates(business:read) — The business’s affiliates: who is selling, what they sold and earned this month, and what is owed — as much of the money as the key’s maker may see — with its campaigns, applications, contracts and their signatures, and how many affiliate messages are unread.GET /v1/developer/store-sales(revenue:read) — What the business’s store sold, as the Sales page’s store strip counts it: orders, sales, net sales, refunds and the affiliates’ share, per currency; each store connected and its health; and the orders behind the figures. Needs Revenue on the team.GET /v1/developer/value(revenue:read) — What the business got back this week, month or quarter, as the Value page counts it: time given back, replies sent and how, the work done, and the sales that came after. Needs Revenue on the team.GET /v1/developer/connected-channels(account:read) — Every channel connected to the account (email, chat, social, calendar) and whether each is working, in the words Settings shows.
Optional — videos
Where Brain video is switched on for the account, a key with video:write writes a script and makes a short video from takes, and one with video:read lists the videos it made, reads one, its shot list and how likely a platform is to take it down. A key reaches only the videos its own project made, in its own environment. Each route says whether it spends one of the month’s videos or checks; reading never does.
POST /v1/developer/videos— Start a video: your own script, or none yet. `kind: check` starts one whose only take is a video you want checked. The same `request_id` twice makes one video. (video:write)POST /v1/developer/video-scripts— Have SlyOS write a script from a topic — from the business’s About you and the links you send — and start a video with it. The same `request_id` twice is one script. (video:write)GET /v1/developer/videos/:videoId— Everything about one video: its script, every take and its upload, the job under way, the finished cuts with links to play them, the caption and hashtags. (video:read)DELETE /v1/developer/videos/:videoId— Delete a video: its script, transcripts and checks at once, and every file of it queued for deletion from storage. What it used of the month is not given back. (video:write)POST /v1/developer/videos/:videoId/takes— Open the upload of one take, straight to storage in parts: the take, its part size, and addresses for the first parts. Refused before a byte travels when the take is over the plan’s size or length, or the month’s footage. (video:write)GET /v1/developer/videos/:videoId/takes/:takeId— One take: where it stands, and while it uploads, the parts storage already holds — so an upload that was interrupted continues where it stopped. (video:read)POST /v1/developer/videos/:videoId/takes/:takeId/part-urls— Addresses for more parts of a take’s upload, or fresh ones for parts whose addresses lapsed. Each works for fifteen minutes. (video:write)POST /v1/developer/videos/:videoId/takes/:takeId/complete— Finish a take’s upload with every part’s ETag. The take is checked to be the size it was opened for and prepared. Sent again, it answers with the same take. (video:write)POST /v1/developer/videos/:videoId/assemble— Make the video from its ready takes, or change the last one with your notes. Spends one of the month’s videos — a change spends one only past the plan’s changes per video. The same `request_id` twice is one assembly. (video:write)GET /v1/developer/videos/:videoId/renders/:renderId/download— A link that downloads one finished cut as an MP4, minted on the request and good for ten minutes. Fetch it from your server; do not publish it. (video:read)POST /v1/developer/videos/:videoId/evaluate— Check a video against the business’s About you and the links you send: its words and stills are read, and the feedback cites what it relied on. Spends one of the month’s checks. The same `request_id` twice is one check. (video:write)GET /v1/developer/video-evaluations/:evaluationId— One check: still checking, the feedback with the references it cites, or why it failed. (video:read)GET /v1/developer/video-usage— What the account’s plan includes and what this month has used — videos and checks as counts, footage as a percentage — and when they reset. One meter for every door: the app, the Brain, this API and MCP. (video:read)GET /v1/developer/videos— The videos this key’s API project made in its environment, newest started first, a page at a time: what each is called, where it stands, and a still. (video:read)GET /v1/developer/videos/:videoId/storyboard— A video’s shot list — what to show under each line of its script — and the video as it now stands. A shot list is written by the SlyOS Video page from a website; any other video has none. (video:read)GET /v1/developer/videos/:videoId/risk— How likely a platform is to take a video down: its script as written, or its finished cut’s words, read by the checks an ad or a post gets (Meta’s and TikTok’s rules, the business’s banned words, claims its website does not make, research-use words). Each reason is a check’s own line, and `checked` names the checks that ran. No model is asked and nothing is spent. (video:read)
Everything else
Every endpoint, field, status, error and rate limit — generated from the schemas the server validates with, so it cannot describe an API the server does not run.
The same document as OpenAPI 3.1, for code generators and API tools: /openapi.json.