API Endpoints
Sometimes the thing you want is a small endpoint — take some JSON, do something, return some JSON. Publish a script at a URL and you have exactly that, without standing up a service for it.
JSON in, JSON out
A script becomes an endpoint at a stable path. POST a JSON body or GET with query parameters — either way it lands on the script's input — and whatever the script returns comes back as the JSON response.
{ "email": "a@example.com" }{ "ok": true, "id": "9f3c…" }Open or gated
Mark an endpoint public and anyone can call it — handy for a webhook receiver or a public form. Leave it private and a caller needs execute permission on the script, enforced before a line of it runs. Either way, a run is bounded by a timeout.
You own the request
Because it's real code, the endpoint's behavior is yours. Validate the body, verify a webhook signature, branch on a header, decide what to return — it's all just Kotlin, right where the request arrives.
val email = context.input.jsonObject["email"]
require(email != null) { "email required" }
val leads = provide<MetadataService>()
// …store the lead, return a resultKeep exploring