Hosted Apps
A hosted app is a small web app that shows one folder and its subfolders: a gallery, a portfolio, a catalogue, a lookbook. You, or your AI assistant, write it as plain static files. Playbook hosts it at its own address and decides who can open it. All data stays in Playbook: the app has no database, and reads the folder through the same REST API documented here.
Prerequisites
writescope and permission to edit the folder the app shows.
App capabilities
| Its own address | Open to the folder's people after they sign in to Playbook, to anyone with a password, or to anyone with the link. Or your own domain. |
| Reads its folder | Every asset on the folder and its subfolders, with previews, colors, tags, statuses, custom fields and uploader names. Nothing outside the folder. |
| Searches | Keyword search and AI search inside the folder. |
| Reads PDFs | The text of each PDF and Illustrator file on the folder, page by page (below). |
| Takes uploads | Visitors' files go into the folder, when the folder allows uploads (below). |
| Watermarks and downloads | Follows the folder's share link: its watermark is on every image the app shows, and when the link allows downloads, visitors download original files, with the link's password when it has one (below). |
| Changes the folder | In an app for the folder's people: titles, descriptions, statuses, fields and tags, approvals and comments, as the signed-in visitor (below). |
| Shows comments | In an app for the folder's people: the comments on an asset, as the signed-in visitor sees them in Playbook (below). |
| Takes guests | In a public or password app: visitors without a Playbook account, by name or by a personal PIN, who reserve, approve, RSVP or vote through the actions the app declares (below). |
| Runs a backend | An optional worker.js for anything the browser cannot do, such as rendering a printable sheet. |
| Remembers per visitor | Favorites and settings in the browser's localStorage. |
Everything on the folder is visible to whoever can open the app, unapproved assets included. Confirm the folder with its owner before deploying: a public app on a folder publishes that folder.
Who can open an app
An app's access is one of:
access | Who gets in |
|---|---|
public | Anyone with the link, with no sign-in. |
password | Anyone who types the app's password (at least 8 characters; on plans with share-link passwords). People who can view the folder may sign in instead, and an app that takes guests by PIN also lets a guest in with their PIN (below). |
members | People who can view the folder in Playbook: workspace members and guests invited to the folder. They sign in to Playbook once. The default for a new app. Invite people by email with invite_to_folder (POST /v1/{workspace}/boards/{token}/guests); a visitor who changes assets needs role: "edit", which is full control of the folder (it also deletes assets, invites people and publishes). |
- Playbook checks access before the page loads, on every path of the app,
playbook/api/included. The page needs no code for it. - The folder's own share settings (its share link, password or expiry) do not protect the app. Only
accessdoes. The link's watermark and downloads do apply (below). - A change of access, or of the password, takes effect within about a minute, with no redeploy. Someone removed from the folder is out within an hour.
- When a visitor's sign-in ends, requests under
playbook/answer401. Reload the page then: it takes the visitor back through sign-in. Guest paths are the exception: there a401means the visitor is not a guest, or typed a wrong PIN (below). - A
passwordormembersapp can be framed only by its own pages and by Playbook's preview, never by another site. Link to it instead.
Coming soon: an option to show approved assets only.
Your own domain
An app can live on your own domain, such as gallery.example.com: write to support@playbook.com. Its old address then forwards there, url becomes the domain, and worker.js gets no cookies. Use a dedicated subdomain: the app's page can read and set cookies of its parent domain.
The files
An app is a set of text files with no build step.
index.htmlis required.- Allowed types:
.html.css.js.mjs.json.svg.txt.webmanifest. - At most 50 files and 1 MB in total. Images, video and fonts are not part of an app: images come from Playbook, fonts from a CDN.
- Paths are plain names joined by
/and., with no leading slash:app.js,lib/grid.js. - A top-level
worker.jsis the app's optional backend (below). It is not served as a file. - How many apps a workspace can have depends on its plan. Replacing the files of an existing app always works, even above the count.
How the page gets its data
The page reads the folder through its own address, with relative URLs and no key. Playbook answers two paths on every app:
GET playbook/appreturns{ "board": "<token of the app's folder>" }.GET playbook/api/<path>returns the REST API's answer toGET /v1/{org}/<path>, with the same query string. Playbook adds the credential, limited to the app's folder and its subfolders.
These are the calls it allows:
| Request | Returns |
|---|---|
playbook/api/boards/{board} | The folder: title, description, asset_count. |
playbook/api/boards?depth=all&displayable_assets=false | The folder and every subfolder under it, each with token, title, parent_id and sort. Without displayable_assets=false each folder also carries three preview assets, which makes the answer large and slow. playbook/api/boards/{token}/children returns one level. |
playbook/api/assets?nested_assets=true&per_page=100&page=1 | The assets of the folder and its subfolders. Leave nested_assets out for the folder alone. |
playbook/api/assets/{token} | One asset. |
playbook/api/assets/{token}/children | The members of a group (is_group: true), newest first. |
playbook/api/assets/{token}/text | The text of a PDF or Illustrator file, page by page (below). |
playbook/api/search?query=… | Keyword search across the folder and its subfolders. |
playbook/api/ai_search?query=… | AI search across the folder and its subfolders, best match first. |
Any other read answers 403 board_scoped_token. Anything that is not a GET, batch_show included, answers 405; in an app for members, anything but the changes it may make answers 400. The list rows above already carry everything batch_show would add.
A page holds at most 100 items. Answers are cached for up to five minutes, so a change to the folder can take that long to show. Each visitor may make 300 requests a minute to an app and cause 30 uncached reads, and an app may make 120 uncached reads a minute; more answer 429 with Retry-After. Once the workspace's API allowance is spent, reads answer 402.
What an asset row carries
| Field | |
|---|---|
token, title | |
description | Rich text: often wrapped in <p>…</p>, sometimes plain. Turn it into text before you show or parse it (below), and never insert it with innerHTML. |
media_type | image/jpeg, video/mp4, … |
display_url | The full-size render; for a video, its poster. |
thumbnails | Smaller renders, url, width and height each, from about 250 px up. Pick the smallest that fills its spot. |
primary_width, primary_height | The original's size in pixels. |
average_color, colors | One hex colour, and the dominant palette, most dominant first. |
tags | Tags, including the ones Playbook's AI adds. |
status, approved, fields | The built-in status, approval, and custom field values keyed by field name. |
collection_sort | The asset's position on its folder, as people arrange it in Playbook. Sort by it when order matters, such as a schedule. |
collection_token | The folder or subfolder the asset sits in. Match it against the tokens from boards?depth=all to group assets by subfolder. |
created_at, uploaded_by | Upload time, and { token, name } of who uploaded it. |
comment_count | How many comments and replies the asset has, internal ones included; on a group, its members' comments too, which you read from each member. Good for a badge and for skipping assets with none, but it can be higher than what a visitor's comment read returns. |
stream_url | Video only: a signed HLS manifest. Safari plays it in a <video>; elsewhere load hls.js from a CDN. null until the video has been encoded. On plans that encode on request, a list never starts the encode: when a visitor opens such a video, read playbook/api/assets/{token} once. That read starts it, and once the video is encoded it returns the stream; until then, say the video isn't ready to play yet. |
is_group | true for a stack of variants. The listing returns the group as one row with no file of its own; read its members with assets/{token}/children. |
// "<p>1760–70 · French · silk</p>" → "1760–70 · French · silk"
const plain = (html) => new DOMParser().parseFromString(html || '', 'text/html').body.textContent.trim()
Lists come in pages. Each answer carries pagy: { current_page, page_items, total_pages, total_count }. Ask for page=2, page=3, … until current_page reaches total_pages. The MCP tools show the same object as pagination; the page itself always gets pagy.
Sets and pairs
An app that shows sets — a burst of photos, a before/after pair, a camera original and its grade, the looks of one collection — can read them two ways:
- Groups. The listing returns each group as one row; one
assets/{token}/childrencall per group returns its members. Good for a few sets of variants. - Subfolders. Read the tree once with
boards?depth=all&displayable_assets=false, read the assets once withnested_assets=true, and sort them into sets bycollection_token: two calls for any number of sets. Subfolder titles make good labels, andsortgives their order on the folder.
The text of a PDF
Playbook extracts the text of every PDF and Illustrator file when it is uploaded. playbook/api/assets/{token}/text returns it, so an app can show what a document says, or pull figures out of a set of decks:
const response = await fetch(`playbook/api/assets/${token}/text`)
const { data } = await response.json()
// { token, status: 'ok', truncated: false, page_count: 12, pages: [{ number: 1, text: '…' }, …] }
statusisokwhen there is text.pendingmeans there is no text yet: extraction takes a few minutes after an upload or a new version, and a file stillpendingan hour later never gets any (older uploads, files over 500 MB).no_textis a scanned or image-only file (there is no OCR),encrypteda password-protected PDF,failedan extraction that did not work, andunsupportedany other file, Word, Excel and PowerPoint included.pagesis empty unlessstatusisok.- The text keeps no layout: tables and slides read as run-on lines. Look for labels (
ARR,Runway) rather than positions, and show a file whose figures you could not find rather than guessing. - Extraction stops at 500 pages or 200,000 characters;
truncatedsays so. - Read only PDFs and Illustrator files:
media_typecontainspdf, ororiginal_extensionis.ai. Everything else isunsupported. - An app does not poll. A file added to the folder drops the app's cached reads within about half a minute, so the listing read when the page opens has it; to pick up files added while the page stays open, read the listing again when the visitor comes back to it (
visibilitychange). A file uploaded through the app is in the upload's answer: show it at once. - Read the text of a file again only when its
updated_atchanges: a new version keeps the token. Apendingfile gets its text without changingupdated_at, usually seconds after the upload: retry that one file at growing intervals that add up to more than five minutes (answers stay cached that long), and give up after an hour. - Each text read counts toward the visitor's 30 uncached reads a minute. Read texts one at a time after the first render, and remember what you found (in
localStorage, keyed by token andupdated_at), so that a folder of many decks does not run into429each time it changes. Store the figures you pulled out, not the pages: a long document fillslocalStorage's few megabytes, so wrapsetItemintry/catch. - The text is part of what the app reads, like titles and descriptions: the share link's download settings and watermark do not cover it. Whoever can open the app can read the text of every PDF on the folder.
Uploads from visitors
An app takes uploads while the folder's share link allows them: Allow uploads or Enable upload-only page in the folder's Share tab (Pro). With the link off, expired, password-protected or collecting emails, uploads answer 403 uploads_not_allowed; ask the owner to change it. In an app that is not public, a visitor signed in to Playbook who may upload to the folder (Can edit, or a workspace member) can upload whatever the link says; their files are theirs and approved.
An upload takes two calls on the app's own address, with the bytes sent straight to storage in between. The uploader in playbook-sdk does the transfer:
<div id="uploader"></div>
<script src="https://unpkg.com/playbook-sdk@1.3.0/dist/playbook-uploader.min.js"
integrity="sha384-b5Wn9OnIWgIC9GXRziMnfqcsz1LE68hXvMMkT+8zurQM+HxWsQ87nSVOVzoWtsS2" crossorigin="anonymous"></script>
<script>
async function post(path, body) {
const response = await fetch(path, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) })
const answer = await response.json().catch(() => ({}))
if (!response.ok) throw new Error(answer.errors?.[0]?.message || answer.error || 'Upload failed')
return answer.data
}
PlaybookUploader.init({
containerId: 'uploader',
getUploadTarget: (file) => post('playbook/upload', { title: file.name, size: file.size, media_type: file.type || undefined }),
finishUpload: (target) => post('playbook/upload/complete', { signed_gcs_id: target.signed_gcs_id, multipart_upload_id: target.multipart_upload_id || undefined }),
})
</script>
POST playbook/uploadtakestitle,size,media_typeand, in an app for members, adescriptionfor the new asset; it returns where to send the bytes.POST playbook/upload/completetakessigned_gcs_idandmultipart_upload_idfrom that answer, and returns the new asset. Each upload completes once.- Files from an anonymous visitor arrive with no uploader, in the app's folder. If the folder hides new uploads they arrive unapproved, but the app still shows them to every visitor. Reads are cached, so a new file can take five minutes to appear in the app.
- At most 2 GB a file, and no larger than the
sizethe upload started with. The uploader sends a large file in parts and resumes after a dropped connection; an uploader of your own must do the same, since one request can carry at most about 100 MB. 20 uploads a minute per visitor, about 60 a minute and 500 a day per app; more answer413or429. The workspace's storage and file-type limits apply.
Styling the uploader
The uploader draws its own button or drop area; the page decides how it looks.
variant: 'button'draws one.pb-uploader-button; the default draws a drop area,.pb-uploader-dropzone.labels: { button, prompt, hint }sets their words, andacceptthe file types.- The uploader adds its own styles to the head when it starts, after the page's. Style its parts through a parent of yours, such as
#uploader .pb-uploader-button, so your rules win. - To show uploads your own way, hide
.pb-uploader-listand draw tiles from the hooks:onSelect(files)when files are picked,onProgress(file, percent),onFileComplete(asset, file)with the new asset,onError(error, file)with a readable message, andonComplete(assets)when all have settled. - Leave
maxFileSizeBytesat its default or higher: Playbook enforces the real limit and explains it.
The upload recipe draws the button as a tile and each upload as a thumbnail with its progress.
Watermark and downloads
An app shows its folder the way the folder's share link would, with the link's settings from the folder's Share tab (Pro), or from share_folder / POST /v1/{workspace}/boards/{token}/share:
- Watermark. When the link has a watermark, every
display_urlandthumbnails[].urlthe app reads carries it, andpermalink,source_urlandthumbnails[].uuidarenullor left out. It stays while the link is switched off. Video streams are not watermarked. Reads are cached, so a change shows within five minutes. - Downloads. When the link is on and allows downloads, a visitor can download the original files. If the link has a password, the visitor types it in the app, like a PIN. The owner is notified of downloads as from the share page.
- A PIN per subfolder. A folder under the app's folder can have its own share link with a password. Its files then take that password instead of the app folder's, and follow that link's download settings. A subfolder link without a password, or one that is off or expired, changes nothing: those files follow the next password-protected link up, and finally the app folder's. The app folder's link must stay on: switching it off, or letting it expire, stops every download. An event gallery gives each event its own PIN this way. Switch downloads off on the app folder's link too: its password opens every event on its share page, so with downloads on there, it would download every event's files. The watermark always comes from the app folder's link.
async function download(tokens, password) {
const response = await fetch('playbook/download', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ assets: tokens, password }),
})
const answer = await response.json()
if (!response.ok) throw Object.assign(new Error(answer.errors?.[0]?.message || answer.error), { status: response.status })
// answer.data: [{ token, url, filename, size }]; answer.skipped: tokens it may not hand out
for (const file of answer.data) {
// The files are on another origin: a hidden frame per file downloads each one, where link clicks cancel each other.
const frame = Object.assign(document.createElement('iframe'), { src: file.url, hidden: true })
document.body.append(frame)
setTimeout(() => frame.remove(), 120000)
await new Promise((resolve) => setTimeout(resolve, 400))
}
}
POST playbook/downloadtakes up to 100 asset tokens and thepassword. Eachurlis the original file, served as an attachment, and works for about an hour.- Files outside the folder, unapproved files the link hides, links and notes come back in
skipped. - When the link turns Download all off, ask for one file per request.
- Ask for one subfolder's files at a time when subfolders have their own passwords: files that follow different share links in one request answer
422 mixed_share_links, and the app folder's link counts as one of them. - The browser may ask the visitor once to allow several downloads.
401 wrong_password: the password is missing or wrong.403 downloads_not_allowed: the link is off, expired, collects emails or does not allow downloads, the folder is licensed, or several files were asked for while Download all is off.- 10 requests a minute per visitor and 100 a minute per app; more answer
429. 1,000 wrong passwords a day per app.
Changes from signed-in visitors
In an app whose access is members, the page can change assets on its folder. Each change is made as the visitor, with their own permissions in Playbook: someone who can only view the folder gets 403. Comments, approvals and date, person and link fields record the visitor, as the same changes through the REST API do. Public apps and apps with a password stay read-only, apart from uploads and guest actions.
| Request | Body | Changes |
|---|---|---|
PATCH playbook/api/assets/{token} | { "asset": { "title", "description", "status", "fields", "tags" } }, any of them | The asset. status takes a status that already exists; tags replaces the asset's own tags (an empty list changes nothing: remove tags with change_tags); fields below. |
POST playbook/api/assets/{token}/update_status | { "status": "Done" } | The built-in status. |
POST playbook/api/assets/{token}/change_tags | { "add_tags": [], "remove_tags": [] } | Tags. A new tag joins the workspace's list. |
POST playbook/api/assets/set_approval | { "tokens": [], "approved": true } | Approval, when the visitor may approve. |
POST playbook/api/comments | { "asset_token": "…", "comment": { "description": "…" } } | A comment on an asset. |
const response = await fetch(`playbook/api/assets/${token}`, {
method: 'PATCH',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ asset: { fields: { 'Bug bash status': 'Done' } } }),
})
const { data: asset } = await response.json() // the asset as it is now
fieldsmaps a field's name to its new value; fields left out keep theirs. A select takes one of its options, a multi-select a list of them ({ "Platforms": ["Web", "iOS"] }) and then holds exactly those, a date fieldYYYY-MM-DD, a person field a member's token, a link field anhttp(s)URL, a text field one line of at most 500 characters.""(or[]) clears a field. An unknown field or option, the built-in Status (set it withstatus), or a list for anything but a multi-select answers422; the app can't create fields or options.GET playbook/api/custom_fieldslists the workspace's fields, each with itsname,field_type(select,multi_select,date,person,url,text) andoptions, read as the visitor and never cached. Only in an app for members, for a signed-in visitor; elsewhere it answers403. In an asset row a multi-select reads as its options joined by", ".- Only these. Deleting, moving, copying or grouping assets, versions, and anything on folders answer
400, and so does a field not in the table. - Only assets on the app's folder and its subfolders: any other answers
404. - An asset change answers with the asset as it is now, an approval with the approved assets, a comment with the comment. Reads stay cached for up to five minutes, so show the answer rather than reading the folder again; other visitors see the change within five minutes.
- Visitors who can no longer open the app, and apps whose access changed, are refused from the next change:
403, or401when the sign-in has to start again. - 60 changes a minute per visitor. They count toward the workspace's API allowance. A
503means Playbook could not take changes right now; waitRetry-Afterseconds.
Comments on an asset
In an app for members, GET playbook/api/assets/{token}/comments lists an asset's comments, oldest first, with replies nested under each comment in the order they were written. They are read as the visitor and never cached, so each visitor sees what Playbook shows them on that asset, internal comments included when they may see them.
const response = await fetch(`playbook/api/assets/${token}/comments`)
const { data: comments, pagy } = await response.json()
// [{ token, description, user_token, user_name, internal, created_at, resolved_at, replies: [...] }]
descriptionis rich text, like an asset's: often HTML, with mentions as<span>elements. Turn it into text with theplainhelper above, and never insert it withinnerHTML.resolved_atis empty while a comment is open.user_nameis who wrote it.internalistruefor a team-only comment: mark it, as Playbook does, so nobody mistakes it for something the client can see.pageandper_page(up to 100) page through the threads; each thread arrives with all its replies. The rest of the query is dropped.- Only assets on the app's folder and its subfolders, and not in the trash: any other answers
404. Comments on a folder itself are not available. - In a public app or an app with a password it answers
403. A visitor whose sign-in has ended gets401, as on everyplaybook/path: reload the page to sign in again. - Read comments when a visitor opens an asset, not for the whole grid. Each read is uncached and counts toward the visitor's 30 uncached reads a minute, shared by everyone behind the same address, and toward the workspace's API allowance; a grid that reads every asset's comments runs into
429. Usecomment_countfrom the listing for badges, and skip assets where it is0. - A new comment answers with itself, so add it to the list rather than reading the comments again.
Guests and guest actions
A public or password app can let people without a Playbook account act on its folder as guests: a buyer reserving an item at a garage sale, a client approving a design or asking for changes, someone saying they'll come to a workshop. Guests do only what the app declares in a playbook.json file at its root, one item at a time.
How it works:
- Make the fields first. Every field and option an action names must exist when you deploy; a guest's email or phone needs a members-only field. Fields belong to the whole workspace: check
list_custom_fieldsbefore creating one, becausecreate_custom_fieldon a select that already exists replaces its options and clears the missing ones from every asset. When a name is taken by another use, pick one specific to this app. - Deploy with
playbook.jsonandaccess: "public"or"password". A new app withoutaccessismembers, which takes no guests: itsplaybook.jsonis refused, and an app with guest actions can't be switched tomemberseither. - Visitors become guests by giving their name (
"signup": "open") or a PIN the owner hands them ("signup": "pin"), and the page calls the actions, below. - The owner follows along in Playbook: the items change on the folder, and guests and answers are under Developer → Custom apps → Guests.
The client approval, garage sale and workshop RSVP recipes are complete guest apps to start from.
{
"guests": { "signup": "open" },
"guest_actions": {
"reserve": {
"label": "Reserve",
"when": { "Status": ["Available", null] },
"set": { "Status": "Reserved" },
"input": { "name": "Buyer", "email": "Buyer email", "phone?": "Buyer phone", "note?": "Buyer note" },
"limit": { "active_per_guest": 3 },
"notify": true
},
"release": {
"label": "Cancel my reservation",
"undoes": "reserve",
"set": { "Status": "Available", "Buyer": "", "Buyer email": "", "Buyer phone": "", "Buyer note": "" }
},
"rsvp": {
"label": "Attend",
"record": true,
"input": { "choice": ["Yes", "Maybe"], "note?": true },
"limit": { "per_asset": 20 }
}
}
}
How visitors become guests. "signup": "open": a visitor gives their name, and an email or phone if the actions need them. "signup": "pin": the folder's owner adds each guest (create_app_guest over MCP, POST /v1/{workspace}/hosted_apps/{slug}/guests, or Developer → Custom apps → Guests in Playbook) and hands them an 8-character PIN, shown once. In a password app the guest types the PIN on the password page; in a public app the page asks for it. Open sign-up has no captcha: someone determined can sign up many times, so keep limits and watch the guest list.
Sign-up does not check the contacts the actions need: an action that writes an email or phone the guest didn't give answers 422 input_missing. A guest can't add one later: a second sign-up is refused while they are a guest, and after signing out it makes a new guest, whose limits start over and who can't undo the old one's runs. So ask for every contact the actions need on the sign-up form itself.
What an action does.
- A state action (the default) changes one item:
setwrites constants into the built-in Status, single-select fields (options that exist) and date, person, link or text fields, andinputwrites the guest'sname,email,phoneandnoteinto text fields. Text fields are not yet in every workspace: wherecreate_custom_fieldrefusesfield_type: "text", use actions withsetonly, or record actions, which need no fields. It runs only whilewhenholds: each listed field holds one of the listed values, wherenullor""means empty.whentakes the same fieldssetwrites, so{ "Volunteer": [null] }on a text field works too. A guest'snamemay go into an ordinary text field, where every visitor of the app reads it: use a members-only field when names should stay private as well. Of two guests claiming one item at once, exactly one gets it.limit.active_per_guestcaps the items where a guest's run is still current; with"signup": "open", every state action that undoes nothing needs one, of 1 to 50. - A record action (
"record": true) writes nothing on the item. It keeps the guest's answer, achoicefrom a declared list and/or anote, one current answer per guest and item: a new answer replaces it.limit.per_assetcaps current answers on an item. undoesnames an action of the same kind that this one takes back. Only the guest whose run is current may run it: a run stops being current once someone changes what it wrote, in the app or in Playbook.- A key ending in
?is optional; a missing optional input clears its field.notify: trueemails the app's creator at most every 10 minutes, with guest names but never contacts. - Fields and options are named as on the folder. Playbook checks every name, option and type at deploy and refuses the deploy with the reason.
Guests' contacts. email and phone may only go into members-only fields (create_custom_field with members_only: true, or the field's settings in Playbook): their values reach only people signed in to Playbook who can see the item — workspace members, and anyone invited to the folder — and never an app, a share link or any other folder-limited token, this app included. Make those fields first, and don't invite one client to a folder that holds other clients' contacts.
The calls. Writes need the app's own page and JSON, like the rest of playbook/:
| Request | Body | Answer |
|---|---|---|
POST playbook/guest | { "name", "email"?, "phone"? } | { name }, and the guest's pass in a cookie. open only. 409 already_guest while the visitor is still a guest: sign out first. |
POST playbook/guest/pin | { "pin" } | { name } and the pass. pin only; 401 for a wrong PIN. |
GET playbook/guest/me | { name, email, phone, runs: [{ action, asset, choice? }] }, the guest's own current runs of every action, undo actions included: an item reserved and then released shows a run of release. Keep the runs of the action you mean. 401 for a visitor who is not a guest. | |
POST playbook/guest/actions/{name} | { "asset": "<token>", "note"?, "choice"? } | { action, asset, counts? }: the item as it is now, and for a record action its fresh counts. |
GET playbook/guest/actions/{name}/results?assets=a,b | { "<token>": { total, choices: { "<choice>": n } } } for up to 100 items: counts only, no names. Any visitor of the app may read them. | |
POST playbook/guest/signout | Ends the guest's pass. |
const response = await fetch(`playbook/guest/actions/reserve`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ asset: token }),
})
const answer = await response.json()
if (!response.ok) showError(answer.error) // answer.code says why, below
- Every refusal carries
{ error }to show the visitor; an action's refusal also carriescode.409:condition_failed(the item changed, usually because someone was first),limit_reached,full,not_your_run,conflicting_options.422:input_missing(the guest has no email or phone the action needs),invalid_note,invalid_choice,grouped_asset(groups and the items in them take no guest actions).404:action_unavailable(the action is not declared, or a field it names was deleted or changed type) orasset_not_found(the item is not in the app's folder, or in the trash).403 app_cannot_write: whoever deployed the app may no longer edit the folder.400: noasset.401: not a guest (any more): show the sign-up, don't reload. Don't tell a visitor to reload aftercondition_failed: a reload can show the old state for minutes. Show the item as taken or decided instead. - A note is one line of at most 500 characters, without
<or>. Show every guest's name and note withtextContent, neverinnerHTML. - Reads stay cached for up to five minutes, and a guest action clears them within about 15 seconds. Overlay an action's answer on the page instead of reading the folder again to see it. A state run in
guests/meis current only while nobody has changed what it wrote, so what it wrote is still on the item: trust it over a read that may be older. - Guest passes last 30 days and are rechecked hourly: a guest the owner removed, or whose PIN was reset, is out within the hour. 60 actions a minute per guest.
For the owner. create_app_guest, list_app_guests, list_app_answers and remove_app_guest over MCP, the REST endpoints, and Developer → Custom apps → Guests in Playbook show each guest with their contacts, each action spelled out, and every answer. Over REST: GET /v1/{workspace}/hosted_apps/{slug}/guests; POST …/guests with { "guest": { "name", "email"?, "phone"? } }, which answers the guest with its pin, once; POST …/guests/{guest_token}/reset_pin; DELETE …/guests/{guest_token}?undo=true; GET …/answers?action_name=rsvp. Removing a guest erases their email, phone and PIN. With undo, their answers are withdrawn, and each change they made through an action that another action undoes is undone, where the item hasn't changed since; changes made by an action nothing undoes stay. If such an undo is refused for another reason, the guest is not removed.
What it cannot express. Actions over several items at once, reservations that expire, party sizes, ranked or multiple choice, forms with several questions, conditions on time or on who the guest is, limiting a guest to "their own" items (use one folder and one app per client), guest comments, and payments.
Rules that keep an app working
- Every URL is relative. Write
playbook/api/assets,app.js,styles.css, never/playbook/api/assetsor/app.js. An app does not always sit at the root of its address, and a leading slash points outside it. - Navigate with the hash. A path that matches no file is a 404, so keep views in
location.hash(#/item/abc), not in the path. - Never call
api.playbook.comfrom the page, and never put a token in a file. The page has no key, and every file of the app is public. - Do not keep image URLs.
display_urland thumbnail URLs are signed and expire. Read the folder again instead of storing them. - Key browser storage by the app's path, for example
`favorites:${location.pathname}`. Apps can share an origin. - Mind the API allowance. Reads that miss the cache count against the workspace's API quota. Load a page of assets once, and poll rarely if at all.
- Retry busy and cold reads. The first uncached read of a folder can take up to half a minute and answer
503. Retry a5xxor429a couple of times, waitingRetry-Afterseconds when it is given, before showing an error. The recipes below do this.
Start from a recipe
Copy the recipe closest to what the user asked for and change it; do not start from a blank page. Each is a complete app, checked on a phone and a desktop in light and dark themes:
| Recipe | For |
|---|---|
| Gallery | Showing a folder: a portfolio, lookbook, event photos, a catalogue. Sections from subfolders, a full-screen viewer, video. |
| Upload against a brief | One person sending files for a list of tasks written on the folder, with the team's feedback on each task. |
| Review and approve | The folder's people approving work or asking for changes, written back to Playbook with comments. |
| Client approval | A client without a Playbook account approving work or asking for changes, with a personal PIN: guest actions with undo, and a note per item. |
| Garage sale | Anyone with the link claiming items, first come first served: open sign-up, reserve and cancel, buyers' contacts kept members-only. |
| Workshop RSVP | Anyone with the link answering per item, such as an RSVP or a vote: open sign-up, answers with a note, places per item. |
Each recipe shows how its folder is set up, the full files, what to change, and how to check the result.
Build an app people will use
- Keep what changes on the folder, not in the files. A brief, captions, prices, dates and names belong in the folder's description, asset titles and descriptions, and fields. The team edits them in Playbook and the app follows, with no redeploy. Write into the files only what never changes: layout and labels.
- Choose access for the audience, and ask the user.
publicfor anyone with the link;passwordfor one outside person or group without Playbook accounts;memberswhen the folder's own people change it from the page, or when the folder is internal. Guests without accounts who reserve, approve or answer needpublicorpassword: amembersapp refusesplaybook.json. - Show the result of every action at once. After an upload or a change, show Playbook's answer: reads are cached for up to five minutes, so reading the folder again would not show it yet.
- Name what visitors send. Give every upload a title the team can sort by, such as the task it belongs to.
- Design for a phone first. Most visitors open a link on a phone: one column, targets a thumb can hit, nothing wider than the screen.
- Give every state a screen: loading, an empty folder, a failed read, and nothing left to do.
Design
Good-looking apps come from a short process, not from taste:
- Decide the one thing a visitor does — look, upload, approve — and make it the largest thing on the page.
- Pick a typeface (or one for headings and one for text) from Google Fonts and set it in one place.
- Define colours as tokens on
:root, with a dark set forprefers-color-scheme: darkand for adata-themetoggle. The recipes show the pattern; set the visitor's choice in an inline script in the head, so the page does not flash. - Let the content carry the page. Images at their own shape,
average_colorbehind an image while it loads, no decoration that is not from the folder. - Make each app its user's own. When reusing an app built for someone else, change its name, logo, colours, type and wording; only the code that reads the folder carries over.
- Look at it before showing it.
preview_appreturns screenshots of the live app 390 px and 1280 px wide, password and members apps included. With a browser, also check both themes and each state. Fix what looks off, then send the link.
Deploy
Over MCP, call deploy_app with the folder's token, a slug, a name, and files: the contents of every file as text, keyed by path. Add access (and password for password) unless the default, members, is what the user wants; a later deploy without access keeps the app's access. See Connect AI Assistants via MCP.
Over the API:
curl -X POST "https://api.playbook.com/v1/my-org/hosted_apps" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"hosted_app": {
"slug": "acme-lookbook",
"name": "Acme Lookbook",
"board_token": "FOLDER_TOKEN",
"access": "public",
"files": {
"index.html": "<!doctype html>...",
"app.js": "let session..."
}
}
}'
{
"data": {
"slug": "acme-lookbook",
"name": "Acme Lookbook",
"url": "<the app's address>",
"access": "public",
"board_token": "FOLDER_TOKEN",
"enabled": true,
"head_version_number": 1,
"created_at": "2026-10-12T10:00:00Z",
"updated_at": "2026-10-12T10:00:00Z"
}
}
Use the address from the response; do not build it from the slug. A new address can take a minute or two to start answering: until then it answers 404 Not found, which does not mean the deploy failed. A redeploy of an existing slug can serve the previous files for about a minute.
The slug is the app's address: lowercase letters, digits and hyphens, at most 63 characters, starting with a letter or a digit. It is unique across all of Playbook, so make it specific.
To update an app, deploy again with the same slug. A deploy replaces the whole file set, so send every file each time; it keeps the app's access unless access is given. To change a few files without resending the rest, use PATCH …/source.
Every deploy, even of the same files, is saved as a new numbered version, and head_version_number is the one that is live. The app reads the folder as whoever deployed it last; when that person changes, signed-in visitors have to reload the page before their next change. Two optional fields guard a redeploy: expected_version, the head_version_number you last read, refuses the deploy if someone changed the app since (409 stale_app); comment is a note stored with the new version.
List, change access, switch off, delete
| Request | What it does |
|---|---|
GET /v1/{org}/hosted_apps | The workspace's apps. MCP: list_apps. |
GET /v1/{org}/hosted_apps/{slug} | One app. Needs permission to edit the folder it shows. |
PATCH /v1/{org}/hosted_apps/{slug} with {"hosted_app": {"access": "password", "password": "..."}} | Changes who can open the app, without a redeploy. |
PATCH /v1/{org}/hosted_apps/{slug} with {"hosted_app": {"enabled": false}} | Switches the app off: its address answers 404 and it can no longer read the folder. true switches it back on. |
DELETE /v1/{org}/hosted_apps/{slug} | Takes the app offline and deletes it. The slug becomes free. MCP: delete_app. |
Versions: read, edit and roll back
Playbook keeps the files of an app's last 50 versions; past that, each new version drops the oldest. Read them, change some of them, or put an older version back live. Over MCP: get_app_source, list_app_versions, edit_app_source and revert_app, which take the same arguments as the requests below. The AI agent in Playbook can open and edit an app's files too.
| Request | What it does |
|---|---|
GET /v1/{org}/hosted_apps/{slug}/source | The live version's version_number and its files, each with path and bytes. Add version=N for an older version. |
GET /v1/{org}/hosted_apps/{slug}/source?path=app.js | Also returns that file's content, in slices: 12,000 characters by default, limit up to 50,000. Pass offset= the next_offset of the answer until it is null. |
GET /v1/{org}/hosted_apps/{slug}/versions | Every kept version, newest first: number, created_at, created_by, file_count, bytes, comment and, for a rollback, reverted_from_number; plus head_version_number. |
PATCH /v1/{org}/hosted_apps/{slug}/source | Replaces and deletes only the files named, keeps the rest, and deploys the result as a new version. |
POST /v1/{org}/hosted_apps/{slug}/revert | Deploys an older version's files again as a new version, so the version you leave stays in the history and the rollback can itself be undone. |
# Change one file and remove another, on top of version 4.
curl -X PATCH "https://api.playbook.com/v1/my-org/hosted_apps/acme-lookbook/source" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "hosted_app": { "expected_version": 4, "files": { "app.js": "..." }, "delete_files": ["old.js"], "comment": "Bigger thumbnails" } }'
# Put version 2 back live.
curl -X POST "https://api.playbook.com/v1/my-org/hosted_apps/acme-lookbook/revert" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "hosted_app": { "version": 2, "expected_version": 5 } }'
expected_versionis required for an edit and a rollback: thehead_version_numberyou read. If the app changed since, the answer is409 stale_app, with the live number inextensions.current_version; read the files again and redo the change.- A file cannot be both in
filesand indelete_files. A path indelete_filesthat the app does not have is ignored, so take paths from thesourcefile list. The result must still be a valid app: anindex.html, at most 50 files and 1 MB. - Each answer is the app as it is now, with its new
head_version_number. Like any deploy, the new files can take about a minute to be served, and the app then reads the folder as you. - A
versionorpaththat is not kept answers404. - An app not deployed since Playbook began keeping versions has no stored files until it is deployed once more: reading and editing answer
409 source_unavailable, and a rollback answers404.
An optional backend
Most apps need none. Add a top-level worker.js only for something the page cannot do in the browser, such as rendering a printable sheet as one finished document.
worker.js is a JavaScript module that exports a fetch handler. It runs for every request that matches no file and is not under playbook/, and sees paths relative to the app, such as /sheet.
- It can call only the Playbook API, and only to read:
GETrequests underhttps://api.playbook.com/v1/{org}/. Playbook adds the credential and limits it to the app's folder; send noAuthorizationheader. Any other request answers 403. - Limits per request: 50 ms of CPU time and 20 outgoing requests. Its reads are not cached and count toward the app's 120 a minute. No environment variables, no storage.
const API = 'https://api.playbook.com/v1/my-org'
export default {
async fetch(request) {
const { pathname } = new URL(request.url)
if (request.method !== 'GET' || pathname !== '/count') {
return new Response('Not found', { status: 404 })
}
const answer = await fetch(`${API}/assets?nested_assets=true&per_page=1`)
const { pagy } = await answer.json()
return Response.json({ assets: pagy.total_count })
},
}
Errors
| Response | Meaning |
|---|---|
403 or 404 on the folder | The token's owner cannot edit that folder, or the folder token is wrong. |
422 | The message says what to fix: a missing index.html, a file type or path that is not allowed (nothing may sit under playbook/), too many or too large files, a slug that is malformed or taken by another workspace, the plan's limit on apps, or a password that is missing, too short or not on the plan. |
429 from the app | Too many requests from one visitor, or too many uncached reads by the app. Wait Retry-After seconds. |
503 from playbook/api/ | A cold read took too long. Send it again. |
403 board_scoped_token from playbook/api/ | The read is not one an app may make (see the table of calls). |
405 from playbook/api/ | A change in an app that is not for members: those can only read. |
400 from playbook/api/ | A change an app may not make, or a missing or wrong field (see the table of changes). |
403 on a change | The visitor may not make it in Playbook, or may no longer open the app. |
422 on a change | A status or option that does not exist; the message names it. |
401 from playbook/ | The visitor's sign-in ended or was revoked. Reload the page. |
401 from playbook/guest/me | The visitor is not a guest yet, or no longer: show the sign-up or PIN form. Do not reload. |
401 from playbook/guest/pin | A wrong PIN: let the visitor try again. |
403 uploads_not_allowed from playbook/upload | The folder's share link takes no uploads, and the visitor is not signed in as someone who may upload. |
422 upload_unknown from playbook/upload/complete | The upload was already completed, or was not started on this app. |
401 wrong_password from playbook/download | The share link the files follow has a password, and the visitor did not give it: a subfolder whose own link has a password takes that password. |
422 mixed_share_links from playbook/download | The files follow different share links: subfolders with their own passwords, or one of them and the app folder. Ask for each folder's files apart. |
403 downloads_not_allowed from playbook/download | The folder's share link is off, expired, collects emails or does not allow downloads; the folder is licensed; or several files were asked for while Download all is off. |
404 Not found right after the first deploy | The new address is not live yet. Wait a minute or two. |
402 from playbook/api/ | The workspace's API allowance is spent. |
502 | The app could not be changed right now. Send the same request again. |
409 stale_app | The app changed after the head_version_number you sent as expected_version. Read it again; the live number is in extensions.current_version. |
409 app_busy | Another change to the same app is under way. Try again in a moment. |
409 source_unavailable | The app has no stored files yet. Deploy its files once to start its version history. A rollback of such an app answers 404 instead. |