Scripts that ship as versioned APIs
Write JavaScript, TypeScript or SQL next to your data and publish it as an authenticated endpoint with docs, environments and logs.
- acme
- Scripts
- forecast.ts
import { stirrup } from "@stirrup/sdk"; // GET /api/run/acme/forecast/{region}export default async function run(input) { const region = input.subpath.slice(1); const rows = await stirrup.spreadsheets.read( "q3-forecast", "Forecast!A2:F5" ); const row = rows.find((r) => r[0].toLowerCase() === region); if (!row) return { status: 404 }; stirrup.log.info("forecast served", { region }); return { body: { region, forecast: row[3], variance: row[5] } };}Published endpoint
GET /api/run/acme/
Environments
- prodv13Approved by FL
- stagingv1412 of 12 tests passing
- devv15Draft, 3 lines changed
- Auth
- x-stirrup-key
- Key scope
- forecast:read
- Rate limit
- 120 / min / key
- Cache
- ETag, 30 s
- CORS
- ops.acme.co
Recent runs
Streaming- 200/forecast/south38 ms
- 200/forecast/west41 ms
- 404/forecast/east12 ms
From a file to a production endpoint
There is no repository, deploy pipeline or gateway to set up, because the script is the service.
Write it in the browser
JavaScript, TypeScript or SQL, with lint, format, an outline, inline output and type-aware autocomplete for the stirrup SDK.
Test it
Test suites with snapshots and benchmarks run against the script before anyone else depends on it.
Publish an endpoint
The script gets a versioned URL at /api/run/{org}/{slug}, authenticated by scoped API keys, with OpenAPI docs generated.
Promote and observe
Move it from dev to staging to prod with approvals, then search its logs, read its metrics and replay any run.
The production parts are already built
Runtime, gateway, environments, scheduling and observability come with every script.
A sandbox that starts with nothing
Every run gets a fresh V8 isolate with 64 MB of memory and a 10-second hard limit. There is no host or network access by default.
You grant capabilities one at a time. Each grant is scoped and logged, and imports come from a vetted npm allowlist. Long work goes to the job queue instead of holding a request open.
- acme
- Scripts
- forecast.ts
- Capabilities
| Capability | Scope | State |
|---|---|---|
| stirrup.spreadsheets.read | q3-forecast | Granted |
| stirrup.http | api.fx-rates.example | Allowlisted |
| stirrup.secrets | FX_API_KEY | Injected |
| stirrup.store | forecast:* | Granted |
| Host and network access | Everything else | Denied |
Isolate memory 64 MB, hard limit 10 s, imports from the vetted npm allowlist
Every script is one click from an endpoint
Publishing gives a script a versioned URL at /api/run/acme/forecast, with subpath and method routing so one file can serve a whole API surface.
Configure methods, CORS, IP allow and deny lists, rate limits, ETag caching, idempotency keys and JSON-Schema request validation per endpoint. OpenAPI docs are generated for you.
curl https://api.stirruphq.com/api/run/acme/forecast/south \ -H "x-stirrup-key: sk_live_…9f2c" \ -H "If-None-Match: W/"7c1e""{ "region": "south", "forecast": 294000, "variance": 4000}Dev, staging and prod with approvals
Each publish is a version snapshot. Diff any two versions, run the test suite on staging, and promote to prod once a reviewer approves.
Restoring an earlier version is one click, and every promotion lands in the audit log.
- acme
- Scripts
- forecast.ts
- Promote
Promote v14 to prod requested by RO, awaiting approval
@@ forecast.ts v13 to v14 @@- return { body: { region, forecast: row[3] } };+ stirrup.log.info("forecast served", { region });+ return { body: { region, forecast: row[3], variance: row[5] } };- Tests
- 12 of 12 passing, 2 snapshots updated
- Benchmark
- p50 36 ms, p95 61 ms
- Approver
- Finance lead
Schedules, webhooks and queues
Run a script on a cron, an interval or once, in a real timezone, and preview the next ten runs before you save. Daylight saving changes are handled for you.
Inbound webhooks start a run. Outbound hooks keep a delivery log. A job queue with retries takes long work, and multi-step workflows pass output from one script to the next.
- acme
- Scripts
- nightly-rollup.sql
- Schedule
- Cron
- 0 2 * * *
- Timezone
- America/Chicago
- On failure
- Retry 3 times, then notify Finance lead
Next 10 runs
- Fri 30 Oct 2026 02:00 CDT
- Sat 31 Oct 2026 02:00 CDT
- Sun 1 Nov 2026 02:00 CST
- Mon 2 Nov 2026 02:00 CST
- Tue 3 Nov 2026 02:00 CST
- Wed 4 Nov 2026 02:00 CST
- Thu 5 Nov 2026 02:00 CST
- Fri 6 Nov 2026 02:00 CST
- Sat 7 Nov 2026 02:00 CST
- Sun 8 Nov 2026 02:00 CST
Logs, metrics and replay
Every execution is searchable, with metrics attached. Replay any run with its original input to see exactly what happened. Secrets are redacted from logs automatically.
Write alert rules on errors or latency and backtest them against run history before they page anyone.
- acme
- Scripts
- forecast.ts
- Logs
- 14:02:11.408infoforecast servedregion=south run_8f21 38 ms
- 14:02:09.112infoforecast servedregion=west run_8f20 41 ms
- 14:01:57.930warnunknown regionregion=east run_8f1f 404
- 14:01:40.006infofx rate fetchedapi_key=[redacted] run_8f1e
One SDK for the whole workspace
@stirrup/sdk has 15 capability-gated namespaces, and a script can use only the ones you grant it.
| Namespace | What it does | Methods |
|---|---|---|
| stirrup.spreadsheets | Read and write the grid | list, read, search, create, write, update, delete |
| stirrup.contracts | Rules and checks | list, get, create, update, delete |
| stirrup.files | Org file storage | list, get, create, update, delete |
| stirrup.graphs | Charts and dashboards | list, get, create, update, delete |
| stirrup.connections | External sources | list, get, create, update, delete |
| stirrup.documentation | Docs next to the data | list, get, create, update, delete |
| stirrup.store | Key-value storage with TTL | get, set, incr, decr, compareAndSet, getMany, setMany |
| stirrup.http | Allowlisted egress, private IPs blocked | get, post, put, patch, delete |
| stirrup.cache | Run-scoped memoization | get, set, del, wrap |
| stirrup.secrets | Injected, never logged | get |
| stirrup.util | Hashing, CSV, retries | hash, hmac, uuid, slugify, csv, base64, sleep, retry, parallel, chunk |
| stirrup.notify | Reach a person | send |
| stirrup.log | Structured logs with redaction | debug, info, warn, error |
| stirrup.runs | Execution history | list, get, replay |
| stirrup.scripts | Call another script | call |
Specs and limits
The runtime, the gateway and where each plan draws the line.
| Languages | JavaScript, TypeScript, SQL |
|---|---|
| Runtime | Sandboxed V8 isolate No host or network access by default; capabilities are granted, scoped and logged |
| Memory per run | 64 MB |
| Time limit | 10 seconds, hard limit Longer work goes to the job queue |
| Packages | Vetted npm allowlist |
| Endpoint path | /api/run/{org}/{slug}Versioned, with subpath and method routing |
| Per-endpoint settings | Methods, CORS, IP allow and deny, rate limits, ETag caching, idempotency keys, JSON-Schema validation |
| API keys | 1 on Free, 3 on Starter, 10 on Team, 50 on Business, unlimited on Scale and up Scopes, role ceilings, endpoint allowlists, expiry and revocation |
| SDK namespaces | Core on Free to Starter, full on Team and up |
| Schedules | Starter and up Cron, interval and one-shot, in real timezones |
| Tests, snapshots and benchmarks | Starter and up |
| Published endpoints and generated docs | Team and up |
| Dev, staging and prod environments | Team and up |
| Workflows and job queue | Team and up |
| Script alert rules | Team and up |
Works with
- Spreadsheets
Read and write the grid through stirrup.spreadsheets, so an edited cell changes what the endpoint returns.
- Contracts & Triggers
Check script output against rules before an endpoint serves it, and start runs from events.
- Docs & Doc Sites
Every published script gets an API reference page you can publish on a doc site.
Questions
Nothing until you grant it. Each run starts in a sandboxed V8 isolate with no host or network access. You grant SDK capabilities explicitly, and every grant is scoped and logged. Outbound HTTP goes only to allowlisted hosts, private IPs are blocked, and imports come from a vetted npm allowlist.
Each run has 64 MB of memory and a 10-second hard limit. Work that takes longer belongs in the job queue, which retries failed jobs, or in a multi-step workflow.
Endpoints authenticate with API keys sent in the x-stirrup-key header. Keys carry scopes, role ceilings, endpoint allowlists and expiry, and you can revoke them at any time. Each endpoint also has its own methods, CORS, IP allow and deny lists, rate limits and JSON-Schema request validation.
Yes. Cron, interval and one-shot schedules run in a real timezone with a preview of the next ten runs. Inbound webhooks start a run, outbound hooks keep a delivery log, and triggers can start work when a contract fails or a file is uploaded.
JavaScript, TypeScript and SQL. All three use the same editor, runtime limits, publishing and logs.
Turn a script into an endpoint
Write and run scripts on every plan, against the sheets you already have. Published endpoints are on Team and up.