Skip to content
Stirrup

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.

  1. acme
  2. Scripts
  3. forecast.ts
TypeScript
forecast.tsforecast.test.tsLint: 0 issues
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/forecast/:region

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.

  1. Write it in the browser

    JavaScript, TypeScript or SQL, with lint, format, an outline, inline output and type-aware autocomplete for the stirrup SDK.

  2. Test it

    Test suites with snapshots and benchmarks run against the script before anyone else depends on it.

  3. Publish an endpoint

    The script gets a versioned URL at /api/run/{org}/{slug}, authenticated by scoped API keys, with OpenAPI docs generated.

  4. 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.

  1. acme
  2. Scripts
  3. forecast.ts
  4. Capabilities
CapabilityScopeState
stirrup.spreadsheets.readq3-forecastGranted
stirrup.httpapi.fx-rates.exampleAllowlisted
stirrup.secretsFX_API_KEYInjected
stirrup.storeforecast:*Granted
Host and network accessEverything elseDenied

Isolate memory 64 MB, hard limit 10 s, imports from the vetted npm allowlist

One SDK for the whole workspace

@stirrup/sdk has 15 capability-gated namespaces, and a script can use only the ones you grant it.

The 15 namespaces of @stirrup/sdk and their methods
NamespaceWhat it doesMethods
stirrup.spreadsheetsRead and write the gridlist, read, search, create, write, update, delete
stirrup.contractsRules and checkslist, get, create, update, delete
stirrup.filesOrg file storagelist, get, create, update, delete
stirrup.graphsCharts and dashboardslist, get, create, update, delete
stirrup.connectionsExternal sourceslist, get, create, update, delete
stirrup.documentationDocs next to the datalist, get, create, update, delete
stirrup.storeKey-value storage with TTLget, set, incr, decr, compareAndSet, getMany, setMany
stirrup.httpAllowlisted egress, private IPs blockedget, post, put, patch, delete
stirrup.cacheRun-scoped memoizationget, set, del, wrap
stirrup.secretsInjected, never loggedget
stirrup.utilHashing, CSV, retrieshash, hmac, uuid, slugify, csv, base64, sleep, retry, parallel, chunk
stirrup.notifyReach a personsend
stirrup.logStructured logs with redactiondebug, info, warn, error
stirrup.runsExecution historylist, get, replay
stirrup.scriptsCall another scriptcall

Specs and limits

The runtime, the gateway and where each plan draws the line.

Scripts and endpoints specifications and plan limits
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
  • 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.

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.