API conventions
Base path /api/v1. JSON only. Auth: Authorization: Bearer <token> (session token or
mn_pat_ PAT) or the session cookie (web). See authentication.
Resource layout
Section titled “Resource layout”GET /meGET|POST /workspacesGET|PATCH /workspaces/:ws (no DELETE: to delete a workspace, contact support)GET|POST /workspaces/:ws/spaces PATCH|DELETE /spaces/:spaceGET|POST /workspaces/:ws/members POST /workspaces/:ws/invitesGET|POST /workspaces/:ws/databases (create takes space_id)GET|PATCH|DELETE /workspaces/:ws/databases/:dbGET|POST /.../databases/:db/fields PATCH|DELETE /fields/:fieldPOST /.../fields/:field/options PATCH|DELETE per optionPOST /.../databases/:db/fields/formula-preview ← dry-run a formula, saves nothingPOST /workspaces/:ws/relations DELETE /relations/:relGET|POST /.../databases/:db/records (POST supports batch ≤100)GET|PATCH|DELETE /.../records/:rec (:rec is a uuid or a public number)GET /.../records/by-number/:number ← resolve a public number to its recordGET /workspaces/:ws/records/by-identifier/:identifier ← resolve ISSUE-5201 (see Record identifiers)POST /.../databases/:db/records/query ← the workhorsePOST /.../records/:rec/move { before_record_id? | after_record_id?, values? }GET|PUT /.../records/:rec/links/:field (list/replace) · POST add · DELETE removeGET|PUT /.../records/:rec/document (PUT requires expected version → 409)GET|POST /.../records/:rec/comments PATCH|DELETE /comments/:idGET|POST /.../records/:rec/attachments DELETE /attachments/:idGET /.../records/:rec/activityGET|POST /.../databases/:db/views PATCH|DELETE /views/:viewPOST /workspaces/:ws/templates/:slug/applyGET|POST /me/tokens DELETE /me/tokens/:id:rec is a record’s uuid or its public number. Every route under records/:rec/... accepts
either one: reading, editing, deleting, restoring, comments, links, versions, attachments, watchers and
the rest. The number is looked up inside the database named by :db in the same path, so it never
reaches a record in another database. A number answers exactly as that record’s uuid would. A number
for a record you cannot read gets the same 404 as a number that matches nothing. Only plain whole
numbers count (17, not 017, 1.5 or -1); anything else that is not a uuid is a 404.
GET .../records/by-number/:number still works when you only want to turn a number into the record.
The MCP tools that take a record accept a uuid or a public number, as before.
The complete, always-current list with schemas is the API Reference.
The query endpoint
Section titled “The query endpoint”Filter trees don’t fit in GET params, so POST /records/query carries them. GET /records
remains for the simple case (?limit&cursor&q= title search, default order).
{ "filter": { "and": [ { "field": "f-uuid", "op": "eq", "value": "opt-uuid" }, { "or": [ { "field": "f2", "op": "gt", "value": 5 }, { "field": "f3", "op": "is_empty" } ] } ] }, "sorts": [ { "field": "f2", "direction": "desc" } ], "q": "acme", "expand": ["project"], "limit": 50, "cursor": "opaque..."}Limits: nesting depth ≤ 3, ≤ 50 conditions, limit ≤ 200, expand one level.
Two meanings of id
Section titled “Two meanings of id”id means two different things in the same round trip — the one place this API is genuinely
inconsistent, kept deliberately:
- In a filter or sort, the api_name
idis the record’s permanent number (the “issue 759” people cite).{ "field": "id", "op": "eq", "value": 759 }finds record number 759. - In a record payload, the top-level
idis the record’s UUID (d211835f-…), not the number.
So the record you get back from that filter has record.id set to a UUID, never 759. A caller
who assumes one meaning applies in both places will write a filter that silently matches nothing.
The number’s older api_name, number, still works in filters, sorts and formulas — it is
deprecated, not removed, so stored views don’t break — but id is the name to use. The UI labels it
“ID” and never offers number as a field. To go from a number to a record’s UUID, use
by-number (or an id filter); the payload field is not being renamed,
because that would break every existing SDK, MCP and script caller for naming alone. This will be
revisited only at a major version.
Operator × type matrix
Section titled “Operator × type matrix”| Op | text/url/email | number | date | checkbox | select | workflow | multi_select | user | relation |
|---|---|---|---|---|---|---|---|---|---|
eq / neq |
✅ | ✅ | ✅ | ✅ | ✅ | ✅ | — | ✅ | — |
contains |
✅ | — | — | — | — | — | — | — | — |
not_contains |
✅ | — | — | — | — | — | — | — | — |
gt gte lt lte |
— | ✅ | — | — | — | — | — | — | — |
before / after / within |
— | — | ✅ | — | — | — | — | — | — |
has / has_none |
— | — | — | — | ✅ | ✅ | ✅ | ✅ | ✅ (record ids) |
category_is / category_is_not |
— | — | — | — | ✅ | ✅ | — | — | — |
is_empty / not_empty |
✅ | ✅ | ✅ | — | ✅ | ✅ | ✅ | ✅ | ✅ |
within accepts relative ranges (today, next_7_days, this_month, …). before and after also
accept a relative day such as $date:-90d or $date:+3d. category_is / category_is_not take
state categories (backlog, unstarted, started, completed, canceled) rather than option ids; both
are described in Querying records. User filters accept the
literal "me", resolved server-side. An invalid op-for-type returns 422.
not_contains treats an unset field as a match — null/empty counts as “doesn’t contain X”,
the same direction is_empty already goes, rather than being silently excluded the way a bare
negated contains would leave it.
A workflow field filters exactly like select — same ops, same option-id values (not
labels; the MCP tools resolve a label to its id for you, the raw API always wants the id). It’s
easy to miss precisely because it’s identical to select rather than its own thing — see the
MCP tools page for how describe_database and query_records/count_records
make this discoverable and filterable by label over MCP.
Bulk operations
Section titled “Bulk operations”Three tiers, by how many records you’re touching:
| Selection | Use | Behaviour |
|---|---|---|
| up to 5,000 | POST .../records/batch (one patch, many records) · POST .../records/batch-delete · POST .../records/batch-restore |
Answers in one call. Processed in chunks of 200 server-side; a failure on one record is reported per record, not a failed call. |
| up to 50,000 | POST .../records/batch-jobs with { op: "update" | "delete", record_ids, values? } |
A durable background job. Returns a job id at once; poll GET .../records/batch-jobs/:id. |
| any update | POST .../records/batch-update-undo |
Reverts a bulk field edit using the restorable list its response carried. |
- An update’s response carries
restorable— one{ record_id, version_id }pair per record actually changed. Pass that array back, verbatim, tobatch-update-undoto restore each record to its exact pre-edit snapshot. Use the list from the call you want to undo; a stale list from an earlier call restores to the wrong point in time. - A job survives a restart. It advances one chunk at a time and records its position only once a chunk is saved, so a crash resumes where it stopped rather than starting over or double-counting.
- Polling a job returns
status(queued,running,succeeded, orpartially_failed),total/processed/succeeded, afailedlist of{ record_id, message }, and — for an update — the samerestorablelist, which feedsbatch-update-undo. A job is never silently partial: per-record failures are listed, not dropped. valuesis required for an update job and omitted for a delete.
Over MCP: update_records and delete_records take up to 200 ids per call (the REST
endpoints above take 5,000), undo_batch_update takes the restorable list, and
enqueue_bulk_record_job / get_bulk_record_job are the large-selection pair.
Exporting a document to PDF
Section titled “Exporting a document to PDF”GET /workspaces/:ws/documents/:doc/export/pdf returns the document as a PDF attachment. It is
rate-limited, and images that can’t be embedded (an external address, another workspace’s file, or
over the size budget) are drawn as a visible placeholder and counted in the
x-storyos-export-skipped-images response header, so nothing is dropped silently. The document page has an
“Export as PDF” button beside Print (greyed out, with the reason, while the renderer is unavailable), and an MCP client can’t use this route (the result is binary;
read the content with get_document).
It depends on a renderer. The PDF is made by a separate Gotenberg container. StoryOS doesn’t ship
that container in its compose files yet. A self-hosted instance turns the feature on by pointing
PDF_RENDERER_URL at a Gotenberg it runs itself; with the variable unset, the route answers 503
pdf_export_not_configured. Two limits are tunable: PDF_RENDER_TIMEOUT_MS (default 30000, a render
past it fails with 504) and PDF_RENDER_MAX_PENDING (default 4, renders accepted at once; renders
run one at a time).
Ask before you offer it. GET /api/v1/capabilities (authenticated) returns
{ "pdf_export": { "configured", "reachable", "available", "checked_at" } }. Gate on available: it
is true only when the renderer answered its health check, not merely when the variable is set. An
answer is reused for about 15 seconds, and checked_at says how stale it is.
Every refusal carries a stable error.code:
| Situation | Status | error.code |
Extra |
|---|---|---|---|
| Not configured | 503 | pdf_export_not_configured |
|
| Another render running and the queue is full | 503 | pdf_export_busy |
Retry-After header and meta.retry_after_seconds |
| Renderer hung | 504 | pdf_render_timeout |
meta.timeout_ms |
| Renderer unreachable | 503 | pdf_renderer_unreachable |
|
| Renderer failed | 502 | pdf_render_failed |
|
| Document too large | 413 | document_too_large |
meta.limit, meta.measured, meta.unit (characters of generated content) |
Pagination
Section titled “Pagination”Keyset cursors only — an opaque base64url of {sort_values, id}. Responses are
{ "data": [...], "next_cursor": "..." | null, "has_more": true }. No offset pagination anywhere.
Joining by invite link
Section titled “Joining by invite link”Three calls cover an invite link. The person-facing flow is on Settings: Workspace.
GET /api/v1/public/invites/details?token=<token> needs no sign-in; the token in the link is the
only credential. It reads and never accepts. The response is never cached and is limited to 20 reads
per minute per client address.
{ "status": "valid", "inviter_name": "...", "workspace_name": "...", "workspace_logo_url": null, "invited_email": "..." }status is valid, expired, used, revoked or not_found. The other four fields are filled for
the first four and are all null for not_found. A token that never existed, is malformed or was
replaced by a resend returns the same not_found body. A revoked invite reads as revoked for 30 days
after the revoke, then as not_found.
POST /api/v1/workspaces takes invite_token. With a token, a signed-in person joins the invited
workspace and nothing is created: the response is that workspace plus joined_via_invite: true.
name is required only when there is no token. A refused token creates nothing.
POST /api/v1/invites/accept accepts the same token and refuses in the same way. Refusals carry
these error.code values:
| Situation | Status | error.code |
|---|---|---|
| Unknown, replaced or already accepted token | 404 | invite_not_found |
| Invite past its expiry | 404 | invite_expired |
| Invite revoked by an admin | 404 | invite_revoked |
| Signed in with a different email than the invite | 403 | invite_email_mismatch |
| Signed in as the invited address, but the account’s email is not verified | 403 | invite_email_unverified |
| Already a member of that workspace | 409 | already_a_member |
The address is checked before verification, so the answer for someone else’s invite never depends on whether
the caller’s account is verified. A refusal creates no membership or workspace and does not use the token up.
An account created through the invite link is verified at creation: send the token as invite_token in the
body of the ordinary POST /api/v1/auth/sign-up/email. It counts only when it names a pending invite issued to
exactly the address signing up (not used, not revoked, not expired); any other value leaves the account
unverified and the sign-up response unchanged, and a sign-up for an address that already has an account is
refused as before and verifies nothing. An unverified account verifies by POST /api/v1/auth/send-verification-email
({ "email", "callbackURL" }, signed in) and the link in the email it sends.
Errors — one envelope everywhere
Section titled “Errors — one envelope everywhere”{ "error": { "code": "validation_failed", "message": "...", "details": [{ "path": "values.f-uuid", "message": "expected number" }], "request_id": "req_..." } }Stable codes: unauthorized, forbidden, not_found, conflict, validation_failed,
rate_limited. Optimistic-concurrency conflicts return 409 with the current version in details.
Guest access to unshared spaces returns not_found (404), never 403 — the API doesn’t leak
existence.
Record payloads
Section titled “Record payloads”Values are keyed by stable api_name in requests and responses (field UUIDs are internal).
Relation fields return {id, title} chips. System fields are read-only.
When an AI last changed a record
Section titled “When an AI last changed a record”Every record read (a list or a single record) carries last_ai_change_at: the time of the latest change
made by an agent or through an MCP connection, or null if neither has ever changed it. Only those two
sources set it: a change made by an automation does not, and neither does one made by a person in the
web app. An ordinary API token is recorded as MCP, so it counts. It is set on create, update and
restoring a version; a person or an automation editing afterwards does not clear it, and a write that
changes nothing does not move it. The source is the credential’s, not a header, so a session that
claims to be an agent is still a person. Values written before this narrowing were recomputed from each
record’s history with the same rule.
Marking a view as seen
Section titled “Marking a view as seen”POST /workspaces/{ws}/databases/{db}/views/{view}/seen records that you opened the view now and
returns { "seen_at", "previous_seen_at" }. previous_seen_at is your last time before this call (null
the first time), so “changed since you last looked” can compare it with last_ai_change_at.
- Per person. There is no way to name another member, nothing lists these times, and an admin cannot read someone else’s.
- People only. An agent, MCP or automation credential gets a 403, so an agent reading a board does not clear what it caused.
- Another member’s personal view is a 404.
Creating a record from a view
Section titled “Creating a record from a view”POST /workspaces/{ws}/databases/{db}/records takes an optional view_id, the view a person would
press New on. The values that view’s filter requires are filled in under yours, and your own
values always win, even an explicit null. See
New on a filtered view for what is filled.
The response is the record plus view_match:
{ "id": "…", "number": 12, "view_match": { "matches": false, "unmet": ["due_date"] } }matchessays whether the new record is inside the view, asked of the same evaluator the view uses. When it isfalsethe record exists anyway.unmetlists theapi_nameof each field behind a condition the record does not meet. It is empty whenmatchesistrue.view_matchis absent when you send noview_id, when the view is not one you may read (another member’s personal view, a view of another database, a deleted view), or when the filter cannot be evaluated for you. Absent means unknown, not “in the view”.
Rate limiting
Section titled “Rate limiting”Keyed per PAT / per session. Default 300 req/min, configurable via RATE_LIMIT_PER_MINUTE. Over
the limit returns 429 with Retry-After.