API Reference

The Appstrate REST API: base URL, OpenAPI document, MCP endpoint, and the rules shared by every endpoint (versioning, pagination, long polling). Per-operation reference is generated from OpenAPI.

Everything the dashboard does is available over HTTP: agents, runs, schedules, packages, integration connections, models, spaces and roles, end-users, API keys, webhooks, files, and realtime streams. The dashboard and the appstrate CLI are clients of this same API. An organization contains spaces, and a space holds agents, runs, schedules, end-users, files, and API keys (see Multi-tenancy).

This page covers the conventions shared by every endpoint. Each operation's parameters, bodies, and responses are in the generated reference pages and in the live OpenAPI document, which is the source of truth.

Base URL

All endpoints are under /api on your instance, with no version in the path (versioning is a header, see Versioning):

http://localhost:3000/api

Use your instance's APP_URL in production; Appstrate Cloud is https://app.appstrate.com/api.

ResourcePathCredentials
OpenAPI 3.1 documentGET /api/openapi.jsonNone. Responds with an ETag; send If-None-Match to get 304
Swagger UIGET /api/docsNone
LLM-oriented indexGET /llms.txtNone

The OpenAPI document is generated by the instance you query, so it includes the modules that instance has loaded. The reference pages of this documentation come from the same source.

Browser clients on another origin must be listed in the instance's TRUSTED_ORIGINS. Cross-origin responses expose the headers described below (Request-Id, Appstrate-Version, RateLimit, Link, ETag, and others).

With the mcp module loaded (it is in the default MODULES set), the same operations are also exposed to MCP clients at one endpoint per organization, /api/mcp/o/{org}, that reaches every space the caller holds a role in (each call names its space_id), under the caller's own permissions. See Connecting MCP clients.

Authentication

API keys (apst_...), session cookies, and OIDC tokens are accepted. Context headers (X-Org-Id, X-Space-Id, Appstrate-User) select the organization, the space, and the end-user. All of it is in Authentication.

Versioning

The API uses date-based versions, sent in the Appstrate-Version header and echoed on every authenticated response:

Appstrate-Version: 2026-03-21
  • The version is resolved from the request header, then from the version pinned on the organization, then the current version, 2026-03-21. A header or a pin the server cannot serve is a 400 unsupported_api_version; it never silently falls back.
  • 2026-03-21 is currently the only version, and a version does not yet change any response: the header is a contract marker you can send now to pin your integration. No Deprecation or Sunset header is emitted yet.
  • The platform is still in beta (1.0.0-beta.x) and some releases change the wire contract on purpose. Breaking changes are called out in the changelog.

Errors

Errors are RFC 9457 application/problem+json with a stable code and a request_id. Every response, success or error, carries a Request-Id header (req_...). See Errors.

Rate limiting

Rate limits apply per route and per caller (the user, the API key, or the IP on public routes). A request over the limit is 429 with code: "rate_limited" and a Retry-After header, and rate-limited routes send RateLimit and RateLimit-Policy headers on every response. Limits and tuning are in Rate limits.

Idempotency

A handful of POST operations accept an Idempotency-Key. Others reject it. See Idempotency.

Pagination

List endpoints return an envelope:

{
  "object": "list",
  "data": [{ "id": "…" }],
  "hasMore": true
}

Some also return total or limit. The style depends on the resource, and the operation's parameters tell you which:

StyleParametersUsed by
Offsetlimit, offset/api/runs, /api/agents/{scope}/{name}/runs, /api/schedules/{id}/runs, /api/integrations
Cursorlimit, startingAfter (and endingBefore for end-users)/api/end-users, /api/files, /api/notifications, /api/webhooks/{id}/deliveries, /api/chat/sessions
Sequencesince, limit/api/runs/{id}/logs

limit defaults to 20 on most lists (50 for an agent's runs, 100 for integrations and chat sessions, 1000 for run logs) and is capped at 100 (1000 for run logs). Out-of-range values on most lists fall back to the default instead of failing.

When another page follows, the response carries an RFC 8288 Link header with rel="next", and rel="prev", first, last where they apply. A generic client can follow next until it disappears, whatever the body shape. Cursor values are resource ids: pass the id of the last item you received.

Waiting for a run

POST /api/agents/{scope}/{name}/run answers 201 with the created run as soon as it is queued. It does not wait for the run to finish. To wait without polling, long-poll the run:

curl "http://localhost:3000/api/runs/$RUN_ID?wait=true" \
  -H "Authorization: Bearer $APPSTRATE_KEY"

wait takes a number of seconds or true, and is capped at 55 seconds, below the idle timeout of common proxies. The call returns as soon as the run reaches a terminal status (success, failed, timeout, cancelled) or when the wait elapses, in which case the status is still non-terminal: call again. Each caller can hold at most 10 waits at once. Past that, the call returns immediately.

Realtime streams

Server-Sent Events streams under /api/realtime push run changes without polling. Authentication, events and delivery rules are in Realtime.

Conditional requests

A resource that supports optimistic concurrency returns a strong ETag. Send it back in If-Match on the next write. A stale tag is 412 precondition_failed, and a missing mandatory one is 428 precondition_required. The package draft save requires it. Other resources are last write wins.

On this page