Building apps
REST API
Everything the editor and the admin panel do, as a REST API described in OpenAPI - authorized by an app's editor key, or by the admin token for the operator's routes.
The REST API at /api/v1/ is what the editor and the admin panel themselves call. It does what the MCP tools do, and lists an app on the showcase, which no tool does. Use it from scripts, CI jobs, or an agent that prefers HTTP.
- Reference:
/api/v1/scalar/on your installation, to read and try every operation;/api/v1/openapi.jsonfor clients and code generators. - Authorization: an app is addressed by its editor key in the path -
/api/v1/lambdas/<editor key>/…- which is also what authorizes the call. The operator’s routes - below/api/v1/admin/, and/api/v1/telemetryand/api/v1/logs- need the admin token in anX-Admin-Tokenheader. - Errors come with a status and a body of the form
{ "status": 409, "error": "Conflict", "message": "…" }, whereerrorisInvalid(400),Forbidden(403),Blocked(403, for an app the operator blocked - do not retry),NotFound(404),Conflict(409) orTooMany(429). The message says why, in a sentence.
Create, save, deploy#
Shell
BASE=https://lambda.example.com/api/v1
# a new app, as a copy of a demo - the answer holds its editor key as "privateKey"
curl -s -X POST $BASE/lambdas -H 'Content-Type: application/json' \
-d '{ "publicKey": "tasks", "template": "demo-crud" }'
KEY=<editor key>
# change one passage of one file, as a new version, and put it online
curl -s -X POST "$BASE/lambdas/$KEY/versions/changes?deploy=true" -H 'Content-Type: application/json' -d '{
"change": "Named the list \"Team tasks\"",
"specification": "The list is for our team, and should say so.",
"edits": [ { "file": "resources/web/index.html", "find": "<h1>Tasks</h1>", "replace": "<h1>Team tasks</h1>" } ]
}'
# put an older version back online
curl -s -X POST $BASE/lambdas/$KEY/deployment/start -H 'Content-Type: application/json' -d '{ "version": 1 }'
Edit locally, as a zip#
For larger changes, download the files, edit them where you work, and put them back:
Shell
curl -s -o app.zip "$BASE/lambdas/$KEY/versions/3/zip?layout=project"
# unzip, change, zip the folder's contents again (dot files included: zip -r ../app.zip .)
curl -s -X POST "$BASE/lambdas/$KEY/versions/zip?layout=project&deploy=true" \
-H 'Content-Type: application/zip' --data-binary @app.zip
With ?layout=project, the app’s files are named as in a git clone - Project.cs rather than lambda.cs - without the platform’s files; without it, as the platform names them (lambda.cs, resources/…). A zip put back follows the .gitignore files in it, as git add would - but its size is counted as it is sent, so leave out what a build installed (node_modules/) when you zip.
On the showcase#
An entry is a title, a description and a picture, sent as base64 in JSON. A picture of a few megabytes is too long for a command line, so write the body to a file and send that:
Shell
{ printf '{"title":"Team tasks","description":"A list the team adds to, changes and ticks off.","image":"'
base64 < screenshot.png | tr -d '\n'; printf '"}'; } > entry.json
curl -s -T entry.json -H 'Content-Type: application/json' $BASE/lambdas/$KEY/showcase
The title and the description go with every PUT; the picture only with the first, or to replace it. GET answers the entry and what one may hold - the sizes, the kinds of picture and how it should read - and DELETE takes the app off the showcase.
The main routes#
All below /api/v1/lambdas/<editor key>:
| Route | Does |
|---|---|
GET, PATCH, DELETE (the app itself) |
reads it; changes its public key or its view; deletes it |
GET, POST /versions |
lists versions; saves all files as a new one |
POST /versions/changes |
changes some files, as a new version |
GET /versions/{n}/zip, POST /versions/zip |
a version as a zip; a zip as a new version |
GET /deployment, POST /deployment/start, /stop |
what is online; puts a version online; takes it offline |
GET, POST /features, and /features/{feature}/… |
drafts: their files, changes, zip, preview/start, merge, logs, and their test data |
GET, PUT, DELETE /data/{kind} |
database, workspace or secrets: reads one kind, switches it on, switches it off and deletes it |
GET /database, /database/tables/{table} |
tables and rows |
GET /secrets, PUT, DELETE /secrets/{name} |
secret names, what the code waits for; stores a value (never read back); removes one |
GET /files, GET, PUT, DELETE /files/{path} |
the workspace; …/files/{path}/content streams a file of any size |
GET /logs, /traffic, /summary, /analytics |
the log, requests over time, the overview, visitors |
GET, PUT, DELETE /connectivity |
permission to connect to other servers; asks for it with a purpose |
GET, PUT, DELETE /showcase |
its entry on the showcase - see above |
GET /export |
the newest version as a runnable .NET project, with its database |
Paths inside a route - a file in the workspace, for one - are encoded: uploads%2Fphoto.jpg.
For the operator#
With the admin token, /api/v1/admin/… does what the admin panel does: list and filter apps (GET /admin/lambdas), move an app to another tier (PUT /admin/lambdas/{public key}/tier), block it, decide connectivity requests, set the limits, the guide for agents and the branding. Without LAMBDA_ADMIN_TOKEN, these routes do not exist.
Shell
curl -s -X PUT $BASE/admin/lambdas/tasks/tier -H "X-Admin-Token: $ADMIN_TOKEN" \
-H 'Content-Type: application/json' -d '{ "tier": "Production" }'