Back to API Overview

Apps API

Install the apps Serenities ships, and build, save and release your own app from its files.

21 endpoints

Endpoints

POST
/api/v1/workspaceApp/setRecordAccess

Set one record type of an installed app (a table its app.json declares) to "Mine only" or back to "All" (params: installId, the install id from workspaceApp_list; table, the record type's name from workspaceApp_getRecordAccess; scope, "mine" or "all"). With "Mine only", Developers and Viewers (anyone without "See every record when a record type is set to Mine only") see only the records they own through the app's own data steps (its screens' data and its step actions, also when the chat or an agent runs them), and another person's record answers "not found" to them there, exactly like a missing one; while any record type of the app is "Mine only", the app's base is closed to them in Databases and the database tools (it answers "not found", like a missing base), so the app is their door; an app's function they run follows the same scope; the Owner, the built-in Admin role, anyone who holds that permission, and automations see every record. Only record types whose app names an owner field can be "Mine only" (mayBeMine in workspaceApp_getRecordAccess); any other is refused naming it. In effect at once. Only the Owner or an Admin can change it; call it only when asked, and repeat back the app, the record type and the choice. Returns { table, scope }.

Parameters

installIdstringrequired

The install id (from workspaceApp_list)

tablestringrequired

The record type: the table's name in the app (from workspaceApp_getRecordAccess)

scopestringrequired

"mine": people without "See every record when a record type is set to Mine only" see only the records they own; "all": everyone who can open the app sees every record

Example Request

curl -X POST https://app.serenitiesai.com/api/v1/workspaceApp/setRecordAccess \
  -H "Authorization: Bearer mk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "installId": "example",
  "table": "example",
  "scope": "example"
}'
POST
/api/v1/workspaceApp/getRecordAccess

Each record type of an installed app and whether it is "Mine only" or "All" (params: installId, the install id from workspaceApp_list). Returns { tables: [{ table, label, scope ("mine" or "all"; "all" when never set), mayBeMine (whether it can be "Mine only": the app names an owner field), needsOwnerField (only when it is "Mine only" but the app's version no longer names an owner field: then only people with "See every record when a record type is set to Mine only" see its records) }] }. Anyone who can open the app may read it: when a person sees fewer records than they expect, or a record answers "not found", this says whether the record type is "Mine only". A record type the app's version no longer declares but that is still stored as "Mine only" is listed too (inApp false, with a note): it keeps the app's base closed to people without "See every record when a record type is set to Mine only" until it is set back to "All" with workspaceApp_setRecordAccess, which removes it.

Parameters

installIdstringrequired

The install id (from workspaceApp_list)

Example Request

curl -X POST https://app.serenitiesai.com/api/v1/workspaceApp/getRecordAccess \
  -H "Authorization: Bearer mk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "installId": "example"
}'
POST
/api/v1/workspaceApp/list

The apps Serenities ships, with this account's install state (for example Social: a calendar and composer for the account's social channels). For each: installed or not, the install id to open it at /dashboard/apps/i/<installId>/open, the version it runs, whether a newer release exists, access (what the app can access: the items its release declares, as its Permissions screen names them; empty when it declares nothing), and legacyProjectId when an older copy install has not yet moved onto a release. stage is "preview" when the install runs a Preview version (or the app has only a Preview), else "live"; preview is { version } when this workspace may install a newer Preview with workspaceApp_install({ key, version }) (only a workspace whose owner is on Serenities' team), else null.

Example Request

curl -X POST https://app.serenitiesai.com/api/v1/workspaceApp/list \
  -H "Authorization: Bearer mk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{}'
POST
/api/v1/workspaceApp/getInstall

One install of this account's (params: installId): its app, name, version, whether it is ready to open, access (what the version it runs can access, the same label workspaceApp_list shows), stage ("preview" when it runs a Preview version, else "live") and preview (a newer Preview this workspace may install, or null).

Parameters

installIdstringrequired

Example Request

curl -X POST https://app.serenitiesai.com/api/v1/workspaceApp/getInstall \
  -H "Authorization: Bearer mk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "installId": "example"
}'
POST
/api/v1/workspaceApp/usage

How many workspace apps this workspace has and how many its plan allows: { used, limit } (limit is null when the plan has no limit; 0 means the plan includes no workspace apps). Apps built here and apps installed from the app store count together. Check it before creating or enabling an app.

Example Request

curl -X POST https://app.serenitiesai.com/api/v1/workspaceApp/usage \
  -H "Authorization: Bearer mk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{}'
POST
/api/v1/workspaceApp/install

Enable an official app for this account (params: key, e.g. "social"). One release of the app is built once and shared by everyone who has it; enabling creates a row and a base of the account's own — no copy, no build. Re-running moves an existing install to the newest release and is never refused (it never moves an install back to an older version). Optional version: leave it out for the newest Live version; a Preview version is installed only when workspaceApp_list offers it as preview (only in a workspace whose owner is on Serenities' team; anywhere else the call is refused saying only Live versions can be installed: tell the person that, never retry). The answer carries access: what the installed version can access, the same label workspaceApp_list shows. A NEW install is a workspace app and counts against the plan's limit on workspace apps: when the workspace is full, or its plan includes none, the call is refused with a plain message and an upgrade link — tell the person that message and give them the link, never retry.

Parameters

keystringrequired

App key from list, e.g. "social"

versionstring

Leave out to install the newest Live version. A Preview version, as workspaceApp_list offers it in `preview` (only in a workspace whose owner is on Serenities' team)

Example Request

curl -X POST https://app.serenitiesai.com/api/v1/workspaceApp/install \
  -H "Authorization: Bearer mk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "key": "example",
  "version": "example"
}'
POST
/api/v1/workspaceApp/uninstall

Remove an official app from this account (params: key). Deletes the install row; the account's base, social channels and posts are kept, and nothing of the vendor's is touched. Act only on what the person named or picked.

Parameters

keystringrequired

App key from list, e.g. "social"

Example Request

curl -X POST https://app.serenitiesai.com/api/v1/workspaceApp/uninstall \
  -H "Authorization: Bearer mk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "key": "example"
}'
POST
/api/v1/workspaceApp/pause

Pause one installed app (params: installId): a safety stop. While paused, people can still open it and read, but nothing it does can change anything (writes, sends, its automations and agents are refused, and say it is paused). Undo with workspaceApp_resume. Pausing an app that is already paused changes nothing.

Parameters

installIdstringrequired

The install id (from workspaceApp_list)

Example Request

curl -X POST https://app.serenitiesai.com/api/v1/workspaceApp/pause \
  -H "Authorization: Bearer mk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "installId": "example"
}'
POST
/api/v1/workspaceApp/resume

Resume an app a person paused (params: installId). The person who paused it may; when you may not, the refusal says whom to ask. An app paused by the platform (over the plan's app count, or its daily limit) cannot be resumed here: it starts again by itself when the cause clears, and the refusal says what to do. Resuming a running app changes nothing. Only a person resumes an app: flows, functions and agents are refused.

Parameters

installIdstringrequired

The install id (from workspaceApp_list)

Example Request

curl -X POST https://app.serenitiesai.com/api/v1/workspaceApp/resume \
  -H "Authorization: Bearer mk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "installId": "example"
}'
POST
/api/v1/workspaceApp/createRelease

Save app: a Preview release of this workspace's own app (params: projectId, notes, checkOnly; manifest is not read: the app.json in its files is what is saved). Builds from the app's FILES (their current version): the app needs its files first (app.json for SDK 2 with its version x.y.z, its pages and its functions, written with workspaceApp_filesWrite); an app with no files is refused and a pages-only app has to get its files first; nothing runs a Preview. Refused naming the key when app.json is wrong or removes what Live has. Each save builds (paid): 10 an hour per workspace, then refused saying how long to wait. checkOnly: true runs every check of a save with no build, no credits, and not counted in that limit (answers { version, stage: "checked" }): use it to test app.json before saving. An app's actions ask the owner first: the first run shows a pending card the OWNER allows, and an outside AI can never approve its own pending action (tell the person a card is waiting). Listing or selling a workspace app on the Serenities Store is not open to users yet; to charge for what they build, they sell it through their site's payments.

Parameters

projectIdstringrequired
manifestobject

Not needed: the app's own app.json (in its files) is what is saved

notesarray
checkOnlyboolean

true: only run every check of a save (app.json, version, what Live has) and answer { version, stage: "checked" }: nothing is built, no credits are used, and it is not counted in the saves an hour (checks have their own light limit, 60 an hour per workspace). Refused with the same words as a real save when something is wrong.

Example Request

curl -X POST https://app.serenitiesai.com/api/v1/workspaceApp/createRelease \
  -H "Authorization: Bearer mk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "projectId": "example",
  "manifest": {},
  "notes": {}
}'
POST
/api/v1/workspaceApp/promoteRelease

Make a saved Preview of this workspace's own app Live for the whole workspace (params: projectId, version). Refused naming the field when it removes what Live has now.

Parameters

projectIdstringrequired
versionstringrequired

Example Request

curl -X POST https://app.serenitiesai.com/api/v1/workspaceApp/promoteRelease \
  -H "Authorization: Bearer mk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "projectId": "example",
  "version": "example"
}'
POST
/api/v1/workspaceApp/rollbackRelease

Move this workspace's own app back to an earlier version that was Live (params: projectId, version); later versions are no longer offered.

Parameters

projectIdstringrequired
versionstringrequired

Example Request

curl -X POST https://app.serenitiesai.com/api/v1/workspaceApp/rollbackRelease \
  -H "Authorization: Bearer mk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "projectId": "example",
  "version": "example"
}'
POST
/api/v1/workspaceApp/listReleases

The versions of this workspace's own app (params: projectId): version and stage (live, earlier, preview; Previews only when you may create apps).

Parameters

projectIdstringrequired

Example Request

curl -X POST https://app.serenitiesai.com/api/v1/workspaceApp/listReleases \
  -H "Authorization: Bearer mk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "projectId": "example"
}'
POST
/api/v1/workspaceApp/filesList

The source files of this workspace's own app (params: projectId): headHash (the current version; null when it has no files yet), updatedAt, and each file's path, size and hash. Pass headHash as expectedHeadHash to workspaceApp_filesWrite / filesEdit / filesRename / filesDelete / filesRestore.

Parameters

projectIdstringrequired

Example Request

curl -X POST https://app.serenitiesai.com/api/v1/workspaceApp/filesList \
  -H "Authorization: Bearer mk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "projectId": "example"
}'
POST
/api/v1/workspaceApp/filesRead

Read one source file of this workspace's own app (params: projectId, path from workspaceApp_filesList): a text file answers its whole content; an image or font answers its size and type, never its bytes.

Parameters

projectIdstringrequired
pathstringrequired

A file path from workspaceApp_filesList, e.g. "pages/Home.tsx"

Example Request

curl -X POST https://app.serenitiesai.com/api/v1/workspaceApp/filesRead \
  -H "Authorization: Bearer mk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "projectId": "example",
  "path": "example"
}'
POST
/api/v1/workspaceApp/filesWrite

Save one source file of this workspace's own app, whole (params: projectId, path, content, expectedHeadHash = headHash from workspaceApp_filesList; left out for the first file of an app with no files). BIG FILE (an app.json of about 20 KB or more, a long page): do not send it as content, because every character would pass through you; instead call files_createUploadTicket (fileName, exact sizeBytes), PUT the bytes to its uploadUrl, then call this tool with fileId (the id the upload answers) INSTEAD of content (give content or fileId, never both). The file must be a Drive file of this workspace that you may see, UTF-8 text, and is held to exactly the same rules as content; it stays in Drive afterwards (delete it with files_delete when no longer needed). Makes a new version (earlier ones are listed by workspaceApp_filesHistory); nothing goes live until a release. Refused when someone saved first (list again, redo the change), when it breaks a file rule (path, 1 MB per file, 500 files, 25 MB) or holds a secret (declare it in app.json instead). Writing app.json also runs the save check and answers its problems as "warnings" (the file is still saved): fix them before workspaceApp_createRelease.

Parameters

projectIdstringrequired
pathstringrequired

e.g. "pages/Home.tsx": app.json, or a file in pages, components, functions, assets or api

contentstring

The whole file, as text (UTF-8). For a big file (about 20 KB or more, an app.json especially) use fileId instead, so the text does not pass through you.

fileIdstring

Instead of content: the id of a Drive file of this workspace that holds the whole file as UTF-8 text (get one with files_createUploadTicket, PUT the bytes to its uploadUrl, use the fileId the upload answers). The same rules as content (1 MB, no secret, same path rule). Give content or fileId, not both.

expectedHeadHashstring

headHash from workspaceApp_filesList; leave it out for the first file of an app with no files

Example Request

curl -X POST https://app.serenitiesai.com/api/v1/workspaceApp/filesWrite \
  -H "Authorization: Bearer mk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "projectId": "example",
  "path": "example",
  "content": "example"
}'
POST
/api/v1/workspaceApp/filesDelete

Remove one source file of this workspace's own app (params: projectId, path, expectedHeadHash = headHash from workspaceApp_filesList). Makes a new version (earlier ones are listed by workspaceApp_filesHistory); the last file cannot be removed. Undo it with workspaceApp_filesRestore (headHash = the version before the delete, first in workspaceApp_filesHistory).

Parameters

projectIdstringrequired
pathstringrequired
expectedHeadHashstringrequired

headHash from workspaceApp_filesList

Example Request

curl -X POST https://app.serenitiesai.com/api/v1/workspaceApp/filesDelete \
  -H "Authorization: Bearer mk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "projectId": "example",
  "path": "example",
  "expectedHeadHash": "example"
}'
POST
/api/v1/workspaceApp/filesHistory

The earlier versions of this workspace's own app's files, newest first, at most 100 (params: projectId): headHash, when it was replaced, and who had saved it (a person's name and role, or an automation's name and kind). Pass a headHash to workspaceApp_filesRestore to make that version current again.

Parameters

projectIdstringrequired

Example Request

curl -X POST https://app.serenitiesai.com/api/v1/workspaceApp/filesHistory \
  -H "Authorization: Bearer mk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "projectId": "example"
}'
POST
/api/v1/workspaceApp/filesEdit

Change one passage of one text file of this workspace's own app (params: projectId, path, find, replace, expectedHeadHash = headHash from workspaceApp_filesList): `find` must occur exactly once in the file (copy it exactly, with enough around it to match one place; 0 or several matches are refused, saying how many) and becomes `replace`. Makes a new version, held to the same rules as workspaceApp_filesWrite (1 MB per file, 25 MB, no secret); nothing goes live until a release.

Parameters

projectIdstringrequired
pathstringrequired

A text file path from workspaceApp_filesList, e.g. "pages/Home.tsx"

findstringrequired

The exact text to change; it must occur exactly once in the file

replacestringrequired

The text to put in its place (empty removes it)

expectedHeadHashstringrequired

headHash from workspaceApp_filesList

Example Request

curl -X POST https://app.serenitiesai.com/api/v1/workspaceApp/filesEdit \
  -H "Authorization: Bearer mk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "projectId": "example",
  "path": "example",
  "find": "example"
}'
POST
/api/v1/workspaceApp/filesRename

Rename or move one source file of this workspace's own app (params: projectId, from, to, expectedHeadHash = headHash from workspaceApp_filesList). The file keeps its content; `to` must follow the file path rules and must not exist yet. Makes a new version, undone with workspaceApp_filesRestore.

Parameters

projectIdstringrequired
fromstringrequired

The file's path now, from workspaceApp_filesList

tostringrequired

Its new path (the same file rules as a write)

expectedHeadHashstringrequired

headHash from workspaceApp_filesList

Example Request

curl -X POST https://app.serenitiesai.com/api/v1/workspaceApp/filesRename \
  -H "Authorization: Bearer mk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "projectId": "example",
  "from": "example",
  "to": "example"
}'
POST
/api/v1/workspaceApp/filesRestore

Make an earlier version of this workspace's own app's files current again (params: projectId, headHash = an earlier version from workspaceApp_filesHistory, expectedHeadHash = headHash from workspaceApp_filesList). It is a new version: the one it replaces goes to workspaceApp_filesHistory, so a restore is undone the same way. Refused when a file of that version is no longer stored.

Parameters

projectIdstringrequired
headHashstringrequired

The earlier version to make current: a headHash from workspaceApp_filesHistory

expectedHeadHashstringrequired

headHash from workspaceApp_filesList (the version now)

Example Request

curl -X POST https://app.serenitiesai.com/api/v1/workspaceApp/filesRestore \
  -H "Authorization: Bearer mk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
  "projectId": "example",
  "headHash": "example",
  "expectedHeadHash": "example"
}'