Platform API
Your app calls the platform over its SKY service binding: env.SKY.fetch("https://sky/<path>"). The binding tells
the platform which app is calling, so there is no token or key. These paths aren't on the public internet. Running
on its own, SKY is your app's own stand-in, which answers the same calls (Runtime → Running on its own).
| Endpoint | Use |
|---|---|
GET /api/app/init |
Who your app is and what it may use. Call it at start-up and cache it for ttl seconds (see below). |
POST /auth/token |
{code, redirect}: swap a sign-in code for {email, name, owner, staff} (needs platform_signin). People sign in at GET {CONSOLE_URL}/auth in their browser. See Sign in with the platform. |
POST /api/app/mail/send |
Transactional email (needs email.transactional in the manifest): {fromName?, to, subject, text?, html?, replyTo?}, up to 10 recipients (rate-limited per recipient and per app). Always sent from noreply+<subdomain>@mail.sleeksky.app; set replyTo for where replies should go. Returns {from}. |
POST /api/app/mail/conversation/send |
Conversational email (needs email.conversational): {from, fromName?, to, subject, text?, html?, inReplyTo?, references?}. Sent from <from>--<subdomain>@sleeksky.app, where replies come back to your endpoint. from is the part before -- (lowercase letters, numbers, ., -, _, up to 40), so you can give each conversation its own address (ticket-812). inReplyTo and references (Message-IDs like <id@host>) thread it in the recipient's mail app. Returns {from}. |
(mail in) POST <email.conversational.endpoint> |
The platform calls your app: mail to <anything>--<subdomain>@sleeksky.app arrives parsed, as {to, local, from, dmarc, header_from, reply_to, cc, subject, message_id, in_reply_to, references, date, text, html, attachments} (local is the part before --; attachment content is base64). Trust from only when dmarc is "pass". Answer 2xx to accept, 404 to bounce, anything else to have the sender retry. Up to 10 MB. |
POST /api/app/mail/signin-code |
{email, code, siteName?}: send a 6-digit sign-in code from noreply+<subdomain>@mail.sleeksky.app (rate-limited). Every app can, no manifest entry needed. |
POST /api/app/signins/remove |
{email}: you removed this person; takes your app off their Your apps. |
POST /api/app/analytics/sql |
{ "sql": "SELECT … FROM PAGEVIEWS …" }, naming your Analytics Engine binding as the table. One SELECT; FROM/JOIN may only name your bindings or a subquery; no comments, ;, quoted names, FORMAT or SETTINGS. Data is kept 3 months. |
POST /api/app/cache/invalidate |
Retire everything the edge cache holds for your app (only useful with edge_cache). Call it after a change visitors should see. One call per 5 seconds; sooner gets 429 with retry-after. See Runtime → Edge cache. |
GET/POST /api/app/domains, POST …/<host>/check, DELETE …/<host> |
Custom domains: request one, get its DNS record (a CNAME to the instance), have it verified and routed. How many is a product limit. |
const res = await env.SKY.fetch("https://sky/api/app/cache/invalidate", { method: "POST" });
init
{
"app": { "id": "t-abc123", "name": "Studio52", "subdomain": "studio52", "product": "sleeksite", "account": "a-…" },
"services": ["openrouter", "dataforseo", "ai"],
"allowance": { "total": 5, "spent": 1.2, "left": 3.8 },
"storage": "ok",
"mail": { "transactional": "noreply+studio52@mail.sleeksky.app", "conversational": "*--studio52@sleeksky.app" },
"ttl": 300
}
| Field | Meaning |
|---|---|
app |
This app: its id, name, subdomain, product and account. |
services |
The platform services it can use right now. |
allowance |
The account's AI allowance this month, or null. |
storage |
ok, warn or over against the product's storage allowance. Over: refuse writes that grow storage, pointing owners to the console. |
mail |
The addresses your mail goes out from: transactional and conversational (* is your part before --), each null when your manifest doesn't include it. |
managed |
What the platform runs for this app: domains, edge_cache, billing. [] when running on its own. Platforms that leave it out manage all three. |
ttl |
Seconds to cache this answer. Changes (keys, allowance, storage) show up at your next call. |
Copies. Store app.id the first time. If init later returns a different id, your data was copied from another
app (an owner cloned it): clean up what belonged to the original, such as its sessions, owners and scheduled sends,
then store the new id.
Write analytics with the binding: env.PAGEVIEWS.writeDataPoint({ indexes, blobs, doubles }).