HTTP API
Everything the Studio does goes through a small JSON API. Use it from a script or from CI. For an agent, MCP is the better fit.
Basics#
| Base address | https://shots.beffa.xyz/api |
| Sign-in | The header Authorization: Bearer <token> |
| Bodies | JSON up to 2 MB, except file uploads, which send the file itself as the body |
| Errors | { "error": "A sentence saying why" } with status 400, 401, 403, 404 or 413, or 409 for a change made on an older revision. A body over its limit gets 413, and the sentence names the limit, as does a picture with too many pixels or an upload the account has no room left for. While the server shuts down, a request gets 503 with Retry-After. Something the server did not expect is a 500, { "error": "Internal error", "ref": "1a2b3c4d" }: whoever runs the server finds the details under ref in its log |
Create the token under Connect an agent in the Studio. The examples expect it in APPSHOTS_TOKEN.
Projects#
| Request | What it does |
|---|---|
GET /api/projects |
Lists your projects. One whose stored file cannot be read is listed with damaged, saying what is wrong |
POST /api/projects |
Creates one. Body: name, and optionally locales, targets, theme, slides, deviceSlides, creatives, variants |
GET /api/projects/:id |
Returns the project with its screenshots, images and rendered files, and its revision, also sent as the ETag |
PUT /api/projects/:id |
Changes any of name, locales, targets, theme, slides, deviceSlides, creatives, mockups, variants. Each one given is replaced as a whole. Answers like GET, with the new revision |
PATCH /api/projects/:id |
As PUT, except that a theme changes only the fields it names and keeps the others, as update_project does |
PATCH /api/projects/:id/slides/:index |
Changes one slide, counting from 0. See One slide |
GET /api/projects/:id/revisions |
Lists the versions kept of the project, newest first. See Revisions |
POST /api/projects/:id/restore |
Makes an earlier version current again. Body: { "revision": 4 } |
DELETE /api/projects/:id |
Deletes it with everything in it: its screenshots, images, renders, app preview layers and earlier versions, and a damaged one as well. Its renders that were done leave GET /api/renders; one it cancelled stays, saying so |
GET /api/usage |
What the account keeps on the server: the number of projects, slides, shots and images, and their size in bytes. uploadBytes is the part that is screenshots and images, and uploadLimit the room the account has for those, where it has a limit. See Limits |
GET /api/meta |
The options the Studio offers: layouts, fonts, backgrounds, sizes and the rest. deviceCatalog lists each device with its models, and for each model its sizes in pixels and the export sizes made for it under targets |
curl -s https://shots.beffa.xyz/api/projects \
-H "Authorization: Bearer $APPSHOTS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name":"Streaks","locales":["en-US","de-DE"]}'
The answer holds the project's id, which every other request uses. The shape of slides, theme and creatives is on Slides, Header and search results and Banners. deviceSlides holds the sets single devices have of their own, by iphone, duo, ipad and mac, such as { "ipad": [ … ] }. A device that is not in it draws slides. See A set for each device. creatives holds both, by name: header, search, universal, readme, social, link, post. variants is a list kept beside the set, each entry another take on some slides with an id of its own. See Variants. targets is the list of sizes the project exports, such as ["iphone-6.9","iphone-5.5"]. Leave it out, or send null or [], for the standard sizes. See Sizes. locales holds each language once, and en and EN count as the same one: a language given twice is kept in its first spelling, and the answer to a PUT says so under warnings.
A field a project or a slide does not have, such as a misspelt headlne, is left out and the change goes through. The answer then names it under warnings, such as ["Ignored, because a project has no such field: slides[0].headlne."]. warnings is only there when there is something to say.
One slide#
PATCH /api/projects/:id/slides/:index changes one slide and leaves the others as they are, as the MCP tool update_slide does. :index counts from 0, so /slides/2 is the third slide. The body:
| Field | What it is |
|---|---|
changes |
Fields to set. They are merged over the slide, device included |
remove |
Names of fields to clear, such as ["subheadline", "badges"] |
of |
iphone, duo, ipad or mac: the slide is in this device's own set. Left out, it is in the shared set |
curl -s -X PATCH https://shots.beffa.xyz/api/projects/streaks/slides/2 \
-H "Authorization: Bearer $APPSHOTS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"changes":{"headline":"See your *progress*","device":{"offsetY":6}}}'
It answers like GET, with the slide as it is now under slide. A slide that is not there is a 400, such as Slide 4 does not exist; the project has 3. So is a body with neither changes nor remove, or with both empty, such as {"headline": "…"} with the slide's field outside changes. A change that leaves the slide as it was, such as one with only a misspelt field, is answered like any other but saves no revision. Under warnings it names a field the slide does not have, a screenshot that is not uploaded yet, a name in remove that slides do not have and a field of the body other than these three. It takes If-Match like PUT.
Revisions#
Every change to a project is saved as its next revision: 1 when it is made, one up with each change after that. Screenshots, images and renders are not part of it. The last 50 revisions are kept.
To change a project without saving over somebody else's edit, send the revision you made the change on in If-Match. When the project has moved on since, nothing is saved and the answer is 409, with the project as it is now:
curl -s -X PUT https://shots.beffa.xyz/api/projects/streaks \
-H "Authorization: Bearer $APPSHOTS_TOKEN" \
-H "Content-Type: application/json" \
-H 'If-Match: "7"' \
-d '{"name":"Streaks Pro"}'
{ "error": "Project \"streaks\" was changed since revision 7 and is at revision 8 now. Load it again and make the change on that.", "revision": 8, "project": { "project": { … }, "revision": 8, … } }
If-Match takes the ETag as GET sent it, such as "7", or the bare number. Without it, a change is saved on whatever revision is current, as it always was.
GET /api/projects/:id/revisions answers { "revision": 8, "revisions": [ … ] }, with one entry per version kept, newest first: its revision, the time it was saved, the actor that saved it (studio, api or mcp, and unknown for one saved before revisions were counted; the Studio says it is the Studio with the header X-Appshots-Client: studio) and its size in bytes. revision is null while the project is damaged.
POST /api/projects/:id/restore with { "revision": 4 } saves revision 4 again as a new revision, so a restore can be undone the same way. It answers like GET, and takes If-Match too. Under warnings it names the screenshots and images the restored version uses that are not uploaded. It is also how a damaged project gets its work back: it opens again at the version restored.
Screenshots#
curl -s -X PUT https://shots.beffa.xyz/api/projects/streaks/shots/home \
-H "Authorization: Bearer $APPSHOTS_TOKEN" \
--data-binary @home.png
| Request | What it does |
|---|---|
PUT /api/projects/:id/shots/:name |
Uploads a raw screenshot under that name. PNG, JPEG or WebP, up to 40 MB. An existing one with that name, device and language is replaced |
PATCH /api/projects/:id/shots/:file |
Files one under another device, another language, or both. Body: { "device": "ipad" }, { "locale": "de-DE" }, or { "locale": null } for the first language. Replaces what was there under the name |
DELETE /api/projects/:id/shots/:file |
Deletes one. :file is the file value from the project's shots list |
iPhone, iPhone Duo, iPad or Mac is read from the size and shape of the image. Add ?device=iphone, ?device=duo, ?device=ipad or ?device=mac to the upload to say it yourself. Any other value is refused with status 400. See Sizes.
A captured Mac window is stored without the shadow macOS adds, so its width and height in the shots list are those of the window. Its entry has corner, the radius of its round corners in pixels. See Mac apps.
A screenshot is for the project's first language unless you add ?locale=de-DE. The language has to be one of the project's locales, and de finds de-DE. Each entry of the project's shots list says which locale it is for; the first language's have none. See Languages.
The screenshots of a language taken out of locales are kept, so adding the language again brings them back, but no slide shows them, in no language. The project lists them apart, under orphanedShots, with the same keys as shots. Move one to a language the project has with PATCH, or delete it with DELETE. A file that cannot be read as a picture is left out of both lists, and the project's warnings name it so it can be uploaded again or deleted.
Limits#
A screenshot of more than 40 million pixels, or of more than 10000 pixels on a side, is refused with status 413 before it is decoded: no screen has that many, and a 6K display has about 20 million. A logo or other image is kept at no more than 2048 pixels a side, so it may also be a photo of up to 268 million pixels, as a JPEG that is not progressive, the way a camera saves one. Other images have the screenshot's limits. An SVG is drawn at a size that fits.
On a server with sign-in, each account other than the admin has room for 2 GB of screenshots and images across its projects. Rendered files do not count. An upload past it is refused with status 413, and the sentence says how much room is left and how much the upload needs. Replacing a screenshot or image counts only what it adds, so a full account can still replace one with a smaller one. GET /api/usage gives uploadBytes and uploadLimit.
Logos and images#
| Request | What it does |
|---|---|
PUT /api/projects/:id/images/:name |
Uploads a logo or artwork. PNG, SVG, JPEG or WebP, up to 20 MB |
DELETE /api/projects/:id/images/:file |
Deletes one |
An image that cannot be read as a picture is left out of the project's images, and its warnings name it, as they do a screenshot.
Render and download#
curl -s -X POST https://shots.beffa.xyz/api/projects/streaks/render \
-H "Authorization: Bearer $APPSHOTS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"locales":["en-US"]}'
| Request | What it does |
|---|---|
POST /api/projects/:id/render |
Renders and answers when it is done. Body, all optional: targets, locales, slides, creatives, variant, background. Without targets, every size the project exports. See Variants for variant |
POST /api/projects/:id/check |
Says what a render with the same body would do, without drawing anything or using a render. See Check first |
POST /api/projects/:id/exports |
Renders and answers with the ZIP when it is done. The same body as a render. With background, answers at once with the job and where to fetch the ZIP |
GET /api/renders |
Your renders that are waiting or running, and those that ended in the last hour, the newest eight at most. Newest first, with rendersLeft |
GET /api/renders/:job |
One of them. One that ended longer ago, or is past the eight newest, is a 404 |
DELETE /api/renders/:job |
Cancels one that is waiting or running. It keeps nothing it drew |
GET /api/projects/:id/export.zip |
The files of the last render as a ZIP. ?render=1 renders what it sends first. ?slides=1,2, ?locales=de-DE, ?targets=iphone-6.9 and ?variant= send a part of it. See Part of a render |
GET /files/:id/out/<language>/<size>/<number>.png |
One rendered file |
GET /files/:id/out/<language>/creative-assets/<name>.png |
One header or search results image |
GET /files/:id/out/<language>/banners/<name>.png |
One banner |
GET /files/:id/out/variants/<variant>/<language>/<size>/<number>.png |
One slide of a variant |
slides counts from 0 here, unlike the MCP tool, which counts from 1.
A finished render answers with files, sheets, creatives and warnings, one sentence each. Two more keys hold what the warnings about the copy say, as data:
lint: one entry per finding and language, with itsrule(such asprice,apple-recognition,headline-scaledorsafe-area), where it is (slidecounting from 0,ownSetfor a device's own set, orplacement), thelocale, thefieldsuch asheadlineorbadges[0].title, the words or icons found undermatch, a measuredvaluewith itslimit, and thetextof the warning. A finished job ofGET /api/rendershas it too.fit: how the copy of each page came out: the share of its size it was set at (scale), whether it fits at all (fits), thelinesof its headline, and whether text standsoutsidethe safe area or the picture.
See Slides for what is checked.
The whole set in one request:
curl -s -o streaks.zip "https://shots.beffa.xyz/api/projects/streaks/export.zip?render=1" \
-H "Authorization: Bearer $APPSHOTS_TOKEN"
Rendering takes a while, so give the request a generous timeout. A client that gives up and closes the connection cancels the render, which then uses none. See Render and export for the layout of the ZIP.
A ZIP is sent with its Content-Length, so a download that was cut short is shorter than that and can be told from a whole one. It holds the files as they were when the download began, even when a render finishes meanwhile. Archives past 4 GB or 65,535 files are written as ZIP64, which unzip and the archive tools of macOS and Windows open.
?render=1 with the session of a browser, rather than a token, renders only for a request from the Studio's own pages or one typed into the address bar: browsers send Sec-Fetch-Site, older ones Referer, and a link on another site is refused with 403, as is a request that sends neither, so it cannot spend a render. With sign-in off, a link on another site is refused the same way, so it cannot replace what was rendered, while a request that sends neither, such as the CLI's, renders. A page uses POST /api/projects/:id/exports instead.
Part of a render#
export.zip takes what to send in its query, each as a list with commas or as the parameter given twice:
| Parameter | What it sends |
|---|---|
slides |
These slides, counting from 1 as the files are named: ?slides=1 is 01.png of every language and size. The header, search and banner images stay out |
locales |
These languages, such as ?locales=de-DE,fr-FR |
targets |
These sizes, such as ?targets=iphone-6.9,ipad-13. The header, search and banner images stay out |
variant |
One variant's slides in place of the set's. slides, locales and targets pick among them |
curl -s -o undercover-spy-view.zip "https://shots.beffa.xyz/api/projects/undercover/export.zip?variant=spy-view&locales=en-US" \
-H "Authorization: Bearer $APPSHOTS_TOKEN"
With ?render=1 the render draws only what is sent, and uses one render. A part that has not been rendered yet is a 400 that says so; a variant the project does not have is a 404. POST /api/projects/:id/exports takes variant in its body, as a render does, and sends what it drew.
Without waiting#
With "background": true the request answers at once, with status 202 and the render as a job:
curl -s -X POST https://shots.beffa.xyz/api/projects/streaks/render \
-H "Authorization: Bearer $APPSHOTS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"background":true}'
{ "job": { "id": "5f0c…", "project": "streaks", "name": "Streaks", "state": "queued", "done": 0, "total": 0 }, "rendersLeft": 6 }
Ask GET /api/renders/<id> until state is no longer queued or running, or follow it on the event stream. It ends as done, failed (with error) or cancelled. done of total is how many pictures are drawn so far. Then fetch export.zip. POST /api/projects/:id/exports with "background": true answers the same way, with download added: the address of that ZIP.
A server that is told to stop, such as for an update, answers every request from then on with 503, gives the renders under way a few seconds to finish, and cancels the rest. A cancelled render keeps nothing and uses no render, so ask for it again once the server is back. The render draws the project as it was when you asked, so changes made while it runs are not in it. Its files replace the old ones all at once when it is done; one that fails or is cancelled leaves the old ones as they were.
locales takes the project's own languages, matched without regard to case, and de finds de-DE. A language the project does not have is refused with status 400 before anything is drawn or counted.
Check first#
POST /api/projects/:id/check takes the body of a render and answers with what that render would do. It draws nothing, queues nothing and uses no render, so it can be asked before every render:
curl -s -X POST https://shots.beffa.xyz/api/projects/streaks/check \
-H "Authorization: Bearer $APPSHOTS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"locales":["en-US"]}'
{
"ok": true,
"refused": [],
"warnings": ["Slide 3: no screenshot named \"stats\" has been uploaded, so a placeholder was drawn."],
"plan": { "locales": ["en-US"], "targets": ["iphone-6.9"], "slides": { "iphone": [0, 1, 2] }, "creatives": [], "pictures": 3 },
"rendersLeft": 6
}
oksays whether the render would start. When it would not,refusedgives each reason in the words the render would answer with, and the status is still 200: the check itself went through.warningsare the ones the render would give before it draws: a screenshot or image name nothing is uploaded under, and copy or logos App Review turns away, such as a price or "free". How the copy fits, such as a headline that had to shrink, is measured only as it is drawn, so the render alone warns about it.planis what it would draw: the languages, the sizes, the slides of each device counted from 0 (a device with a set of its own counts in that set), the header, search results and banner images, and how many pictures the browser draws, every language counted. It is left out when what was asked for cannot be drawn.backgroundis taken and ignored, so the body you are about to render with can be sent as it is. Only a body that does not have the shape above, such as an unknown size or a negative slide, is refused with status 400, and an unknown project is a 404. Everything else a render would refuse with 400, such as a language the project lacks, a slide it does not have or an account without renders left, comes back inrefusedwith status 200.
Counted renders#
Every answer to a render carries rendersLeft: how many the account has left, or null where they are not counted. Each render uses one, and one that fails or is cancelled uses none. At zero a render is refused with status 400. See Render and export.
Variants#
A variant is another take on some slides, kept beside the set: its fields are on Slides. variants is a list on the project, set with PUT /api/projects/:id as a whole, up to 12 variants:
curl -s -X PUT https://shots.beffa.xyz/api/projects/undercover \
-H "Authorization: Bearer $APPSHOTS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"variants":[{"id":"spy-view","note":"Open on the spy reveal","at":0,"slides":[{"layout":"statement","headline":"One of your friends is *lying*"}]}]}'
Here at counts the slide a variant starts at from 0, where the MCP tool set_variant counts from 1 with from. A variant left out of the list is deleted with its rendered files. Applying a variant, which makes its slides the set's, is a PUT of slides and deviceSlides with them in place, or set_variant with apply over MCP.
A render with "variant": "spy-view" in its body draws the variant's slides alone, numbered as the slides of the set they stand in for, with a contact sheet of the whole set as the variant makes it:
slidescounts in that set, from 0, and may name only slides the variant changes; the variant's other slides stay as they were last drawn.- The answer has the variant's slides under
files. POST /api/projects/:id/checktakes the same body, and itsplanthen names thevariant.
Where the files land, under /files/:id/out/, and their names in a ZIP of export.zip?variant=:
| What | In out/ |
In the ZIP |
|---|---|---|
| A variant's slide | variants/<variant>/<language>/<size>/01.png |
<language>/<size>/01.png |
| A variant's contact sheet | variants/<variant>/<language>/<size>/sheet.jpg |
Not sent |
Each ZIP has a README.txt that says what it holds. GET /api/projects/:id lists what is rendered under variantOutputs, one entry per variant, language and size with its files and sheet. appshots pull <project> --variant <id> downloads the same. See The appshots command.
Mockups#
Each screenshot in its device on a transparent background. They are drawn when they are asked for and use no render. See Mockups.
curl -s -o home-iphone.png "https://shots.beffa.xyz/api/projects/streaks/mockups/home.iphone.png?width=1200" \
-H "Authorization: Bearer $APPSHOTS_TOKEN"
| Request | What it does |
|---|---|
GET /api/projects/:id/mockups |
Lists them: settings, and per mockup its name, device, the png address and the name to save it as. ?locale=de-DE for another language |
GET /api/projects/:id/mockups/:file |
One as a PNG. :file is the file value of a screenshot. ?width=1200 sets the width for this request, and ?download=1 sends it as a download |
GET /api/projects/:id/mockups.zip |
All of them as a ZIP. ?locale=de-DE for one language only |
How the device is drawn is the project's mockups value, set with PUT /api/projects/:id:
{ "mockups": { "device": { "style": "clay", "color": "silver", "shadow": "soft", "rotate": -8 }, "width": 1200 } }
device takes frame, style, color, shadow, rotate, perspective, statusBar, statusBarTime and statusBarColor, as on Slides. Without width, the screenshot is shown pixel for pixel. To try settings without saving them, add them to a request as ?settings=<the same JSON, URL-encoded>.
App preview layers#
The pictures that go over and around an app preview video, in the project's style: the background, a caption per scene and language, the intro and outro cards and a touch ring. Each is a PNG at the size of the video, transparent but for the background, except the touch ring: a small square that appshots video compose places wherever a touch was logged. The video itself is recorded and cut on the Mac by appshots video, which asks for these by itself. See App preview videos.
curl -s -X POST https://shots.beffa.xyz/api/projects/streaks/video-layers \
-H "Authorization: Bearer $APPSHOTS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"display":"iphone","captions":[{"id":"today","text":{"slide":2}}],"intro":{"headline":{"slide":1}},"outro":{"disclosure":["subscription"]}}'
| Request | What it does |
|---|---|
POST /api/projects/:id/video-layers |
Draws a set of layers and answers when it is done. Body below |
GET /api/projects/:id/video-layers/:set |
A set drawn before. Each project keeps its three newest; an older one is a 404, and asking for it again draws it anew |
GET /api/projects/:id/video-layers/:set/layers.zip |
All the pictures of a set as a ZIP |
GET /files/:id/video/:set/<file>.png |
One picture, as the set's layers name it |
| Field | What it is |
|---|---|
display |
iphone, ipad, mac, iphone-5.5, iphone-4.7 or ipad-9.7. The pictures get that display's preview size. Either this or size |
orientation |
portrait (default) or landscape. A mac preview is landscape only |
size |
[width, height] in pixels, even numbers from 320 to 3840, for a size of your own |
locales |
The languages. Default: all of the project's |
captionStyle |
panel (default), a card in the theme's background; shadow, text with a soft shadow; band, a band the full width |
captions |
Up to 12, each { "id", "text", "position" }. id is lowercase letters, digits and -. text is one text, one per language, or { "slide": 2 } for that slide's headline, with "field": "eyebrow" or "sub" for another line. position is top (default) or bottom |
intro |
{ "headline", "logo" }, or false. logo defaults to true |
outro |
{ "lines", "logo", "disclosure" }, or false. Up to three lines. disclosure takes iap, subscription and login |
plate |
The theme's background as an opaque picture. Default true |
touch |
The ring drawn where a touch was logged. Default false |
background |
true answers at once. See below |
intro and outro also take seconds, so a plan's card can be sent as it is; the pictures do not depend on it. A field the body does not have is refused with status 400, as is a language or slide the project does not have.
The answer is the set:
{
"set": "0846fa627ccafb92",
"size": [886, 1920],
"display": "iphone",
"locales": ["en-US", "de-DE"],
"warnings": [{ "locale": "de-DE", "layer": "outro-text", "kind": "fallback", "detail": "no de-DE wording for the \"subscription\" notice, drawn in en" }],
"layers": [
{ "id": "plate", "locale": null, "kind": "plate", "file": "/files/streaks/video/0846fa627ccafb92/plate.png", "width": 886, "height": 1920, "box": [0, 0, 886, 1920] },
{ "id": "caption-today", "locale": "en-US", "kind": "caption", "file": "/files/streaks/video/0846fa627ccafb92/en-US/caption-today.png", "width": 886, "height": 1920, "box": [138, 192, 610, 130], "text": "Build the habit", "fallback": false, "fit": 1 }
],
"zip": "/api/projects/streaks/video-layers/0846fa627ccafb92/layers.zip",
"charged": true,
"rendersLeft": 6
}
layers.kindisplate,caption,intro-logo,intro-text,outro-logo,outro-textortouch.localeisnullfor a picture every language shares.boxis[x, y, width, height]of the part that is drawn. A text'sfallbackistruewhen it is drawn in another language, for want of one in its own, andfitis the scale it was drawn at: 1, or less when it had to shrink to fit.warnings. Each names itslocaleandlayer, and itskind:fallbackfor a text drawn in another language,fitfor one shrunk below 70 %,logofor a card without a logo because the project has none.setandcharged. The set's id is made from what it draws. Asking for the same layers again answers with the set drawn before, withcharged: false, and uses no render. A new set uses one of the account's renders, as a render does, andrendersLeftsays how many are left. At zero a new set is refused with status 400.
Layers without waiting#
With "background": true, a new set answers at once with status 202, the run as a job and the id the set will have:
{ "job": { "id": "1f89c4c9c44e68a4", "project": "streaks", "name": "Streaks", "state": "running", "done": 0, "total": 2, "set": "23a1c80026a0fb56" }, "set": "23a1c80026a0fb56", "rendersLeft": 6 }
GET /api/renders/<job id> follows it, as it does a render, and DELETE /api/renders/<job id> cancels it. When state is done, fetch the set with GET /api/projects/:id/video-layers/<set>. A set drawn before is answered at once, with status 200, background or not. One account has at most two runs of layers waiting or running at a time.
/files/:id/video/… pictures never change, as a set's id says what is in it, so they are sent with Cache-Control: private, max-age=31536000, immutable. No answer under /api is kept by a shared cache: answers are sent with private, no-cache or private, no-store, and errors with no-store.
Live updates#
GET /api/events tells what changes in the account as it happens, as Server-Sent Events, for as long as the connection stays open. The Studio follows it, so a change made through MCP, the CLI or this API shows up there at once. A script can follow it instead of asking again and again:
curl -sN https://shots.beffa.xyz/api/events \
-H "Authorization: Bearer $APPSHOTS_TOKEN"
retry: 5000
event: ready
data: {"heartbeatMs":20000}
event: project
data: {"id":"streaks","revision":9,"actor":"mcp"}
Each event's name says what happened, and its data is one line of JSON:
| Event | When | Fields |
|---|---|---|
ready |
Once, first. The stream works from end to end | heartbeatMs |
ping |
Every heartbeatMs, 20 seconds |
None: its data is {} |
project |
A project was changed or restored | id, the new revision, and the actor that made the change, as in Revisions |
project-created |
A project was made, or moved into the account | id, actor: admin for one the admin moved |
project-deleted |
A project was deleted, or moved out of the account | id |
assets |
A screenshot or an image was uploaded, moved or deleted | project, and kind: shots or images |
job |
A render was queued, drew more, or ended | id, project, name, state, done, total, createdAt, and once they are known startedAt, finishedAt, files and error. Warnings and lint stay with GET /api/renders/:job |
An event names what changed, not all of it: fetch what you show of it again, such as GET /api/projects/:id when its revision is newer than the one you have. Progress of a render is told at most four times a second, and its start and end at once.
- The
pingkeeps a proxy in between from taking a quiet stream for dead, and tells a client that the stream still works. A connection can die without a word, such as while a laptop sleeps: a client that hears nothing at all for two heartbeats should close the stream and open it again. The Studio does. - Nothing is kept for a client that was not connected: there is no replay and no
Last-Event-ID. After the stream was cut off, open it again and fetch everything you show once more.retrytells a browser'sEventSourceto wait five seconds before it does that by itself. - A stream ends when the sign-in it was opened with ends: when its session signs out, its token is revoked or its account is deleted. It ends as well when the server stops, such as for an update. A client that reads more slowly than events come is cut off.
- One account may hold 10 streams open at once. One more is refused with 429 and
Retry-After. - It takes a token or the session of a browser, like the rest of
/api. An OAuth access token that was issued for the MCP endpoint alone reaches only that, so an MCP client follows its own changes through the tools. - The answer is sent with
Cache-Control: private, no-store, no-transformandX-Accel-Buffering: no, so that neither a cache nor a proxy holds it back or compresses it. A proxy of your own in front of the server must still pass the answer on as it comes rather than collect it. Where one does not, the Studio never getsreadyand asks for what it shows every few seconds instead.
What a token cannot do#
Creating and revoking tokens, deleting the account and managing who can sign in need a signed-in browser. A token that leaks can therefore not make more tokens.
Deleting a project or an account first cancels its renders, and the runs drawing the layers of its app previews, and waits for them to stop, so nothing drawn for it comes back afterwards.
For the admin#
These need the admin's signed-in browser, and answer Cache-Control: private, no-store.
| Request | What it does |
|---|---|
GET /api/admin/health |
How the server is doing: the browser that draws, the render and mockup queues, the renders under way, the mockups and usage numbers kept in memory, and the projects whose stored file cannot be read. Those of the server's own space are named; for an account only their number is given |
POST /api/admin/projects/move |
Moves a project between spaces. Body: project, from and to, each space as main for the server's own or the address of an account. Answers with project, its id where it went: its own, or its own with a number behind it when that is taken there. Its renders are cancelled first. An account that has as many projects as it may keep gets none: that is a 400 |
The admin's projects are the server's own space, and the projects an account made are in a folder of its own. When ADMIN_EMAIL comes to name somebody else, the new admin works in the server's space, and what they made before is in their own folder, which the Studio does not show them. Moving names that folder by the admin's address.
Public addresses#
These need no token:
| Address | What it is |
|---|---|
/healthz |
Answers when the server is up |
/skill.md |
The skill, as the server hands it out |
/skill.json |
A short hash of the skill and one of the command, which appshots compares its own copies with, and under references one of each of the skill's reference files |
/skill/<file>.md |
One of the skill's reference files, such as /skill/screens.md: the full text of a step that /skill.md names |
/install.sh |
The setup script. Without PUBLIC_URL, a request whose Host is not a plain name and port is a 400 |
/cli/appshots.mjs |
The appshots command |
/docs/<page>.md |
Any page of these docs as Markdown. Pages come with an ETag, so a reader that sends it back in If-None-Match gets a 304 while the page is the same |
/llms.txt, /llms-full.txt |
The docs as an index, and in one file, for language models |