Skip to content

API reference

Every endpoint of the Cases API, its authentication and its errors.

Applies to EngineCloud
View as Markdown
On this page
  1. Authentication
  2. Me and workspaces
  3. Who am I
  4. List workspaces
  5. Create a workspace
  6. Members
  7. Invite someone
  8. Change a role
  9. Remove a member
  10. Maps and versions
  11. List maps
  12. Create a map
  13. Get a map
  14. Change a map
  15. List versions
  16. Diff two versions
  17. Export
  18. Audit
  19. Links
  20. Link a Data project
  21. Link a Telemetry project
  22. Upload a map from code
  23. Cases
  24. Search cases
  25. Get a case
  26. Links of a case
  27. Comments on a case
  28. Comment on a case
  29. Navigation and events
  30. Navigation tree
  31. One place
  32. Where is it?
  33. Event graph
  34. Deliveries and dead letters
  35. Deliveries
  36. Dead letters
  37. Send dead letters again
  38. Drop a dead letter
  39. Proposals and comments
  40. List proposals
  41. Open a proposal
  42. Get a proposal
  43. Ask for reviews
  44. Approve
  45. Close
  46. Comments on a proposal
  47. Comment
  48. Checks
  49. Run the check
  50. The last check
  51. Project tokens
  52. List project tokens
  53. Create a project token
  54. Revoke a project token
  55. Errors
  56. The endpoints of external starts
  57. Start an external case

Base address: https://cases.api.sypnia.com/v1 in Sypnia Cloud; https://<your host>/v1 when you run the server. The whole API is also written as an OpenAPI 3.1 file, spec/openapi.yaml in the Cases repository, which the server’s tests keep equal to its routes.

Authentication

Send a token in the Authorization header:

TokenHeaderNotes
A Sypnia session or OAuth tokenAuthorization: Bearer <token>signed by the sign-in service (Sypnia’s, or the issuer your server trusts)
A personal access token, syp_pat_…Authorization: Bearer syp_pat_…checked at the issuer’s user endpoint and kept a minute; its scopes come from that answer
A session bound to a key: the CLI’s login, an agent sessionAuthorization: DPoP <token> and a DPoP proof for this method and addresssent as Bearer, it is refused, so a copied token is useless
A Cases project token, syp_cpt_…Authorization: Bearer syp_cpt_…one map only; acts as an editor and never approves (Project tokens)
A call between Sypnia Cloud productsAuthorization: Service <key> and x-sypnia-useronly Sypnia Data’s control plane, with the key the two share, on behalf of a person it verified (it forwards maps uploaded to Data this way)

Scopes: cases:read, cases:write (drafts and proposals), cases:approve, cases:operate (send dead letters again, or drop them), and cases:* for all of them. They limit a token that carries at least one cases: scope; any cases: scope also reads. A plain session carries none, so what it may do is decided by the person’s role alone.

Roles, per workspace: owner, editor, approver, reviewer (Who can do what). Reviewers read the plain level only: no tables, no code, no production data. operate is for owners, editors and approvers. In Sypnia Cloud a workspace is a Sypnia organization, and its roles map onto these (Security).

In Sypnia Cloud, the server reads your organization’s roles, your Data project and its deliveries on your behalf. It calls Sypnia Data’s control plane with a key the two services share, Authorization: Service <key> with the id of the person it verified (x-sypnia-user), so every kind of token works here, sessions bound to a key included. The control plane takes such a call only on the routes Cases needs (who you are, the Data project, its link to the map, its schema and the SQL that reads deliveries), and still checks your role in the Data project. A server you run yourself without CASES_SERVICE_KEY presents your own token to the other product instead, as a Bearer token; a session bound to a key cannot be presented, since it can be used only at the address it was made for.

Lists answer { items, next_cursor }. Pass limit (at most 200, 50 by default) and, for the next page, cursor with the last next_cursor.

Me and workspaces

Who am I
GET /v1/me EngineCloud
Who the token is (user_id, email, name, kind: account or project), its scopes, the directory (self or sypnia) and the workspaces with your role. For a project token, its map.
Authentication
any token
List workspaces
GET /v1/workspaces EngineCloud
The caller’s workspaces and their roles.
Authentication
any token
Create a workspace
POST /v1/workspaces Engine
{ name, slug? }; you become its owner. In Sypnia Cloud a workspace is a Sypnia organization, so this answers 422.
Authentication
cases:write
Members
GET /v1/workspaces/{ws}/members EngineCloud
Members, reviewers and open invitations.
Authentication
cases:read
Invite someone
POST /v1/workspaces/{ws}/members EngineCloud
{ email, role }. Someone who already signed in is added at once; anyone else when they first sign in. In Sypnia Cloud only reviewers are invited here: members are managed in the organization.
Authentication
cases:write, owners
Change a role
PATCH /v1/workspaces/{ws}/members/{user} Engine
{ role }.
Authentication
cases:write, owners
Remove a member
DELETE /v1/workspaces/{ws}/members/{user} EngineCloud
Removes a member or a reviewer.
Authentication
owners, or yourself

Maps and versions

List maps
GET /v1/maps EngineCloud
The maps of the caller’s workspaces (a project token: its own map); ?workspace= for one.
Authentication
cases:read
Create a map
POST /v1/maps EngineCloud
A Cases project: one app’s map, with version 1. { name, slug?, workspace?, files?, data_project? }: from a name, or from the files of the format (files: [{ path, content }]); data_project links it at once, both ways. Without workspace, your only workspace.
Authentication
cases:write
Get a map
GET /v1/maps/{map} EngineCloud
The latest approved version; ?version=4 for another one; ?draft=1 applies your own draft and open proposals, oldest first, on top of the latest version; ?level=plain|working|technical.
Authentication
cases:read
Change a map
PATCH /v1/maps/{map} EngineCloud
{ name?, required_approvals?, repository? }. required_approvals is { count } (or a number): how many approvals a proposal needs, 1 by default.
Authentication
cases:write, owners
List versions
GET /v1/maps/{map}/versions EngineCloud
Every version, newest first, with its author, approvers, date and summary.
Authentication
cases:read
Diff two versions
GET /v1/maps/{map}/diff?from=3&to=4 EngineCloud
Cases added, removed and changed, field by field; without to, the latest. Reviewers do not see technical fields.
Authentication
cases:read
Export
GET /v1/maps/{map}/export?format=files EngineCloud
The map as the files of the format (a zip of cases/map.yaml, cases/navigation.yaml and cases/<area>/<id>.case.yaml, each starting with its $schema line), the default; or format=json. ?version= for another version.
Authentication
cases:read, members
Audit
GET /v1/maps/{map}/audit EngineCloud
Every change to the map, newest first.
Authentication
cases:write, owners
Link a Data project
PUT /v1/maps/{map}/data-project Cloud
{ data_project: "<ref>" }. Checks with your token that you can open the Data project, then stores the link on both sides; the answer’s reverse_link says whether the Data side took it. A Data project links to one map (409 otherwise). DELETE unlinks.
Authentication
cases:write
Link a Telemetry project
PUT /v1/maps/{map}/telemetry EngineCloud
{ project, token, api? }: a Telemetry read token for this map, kept encrypted and used to read each case’s production health. DELETE unlinks.
Authentication
cases:write, owners
Upload a map from code
POST /v1/maps/{map}/uploads EngineCloud
The output of npx @sypnia/cases map --json, the document map --upload sends, or { files }. It becomes a draft proposal of what the code owns (each case’s tables and allowed actors; a skeleton for a use case the map does not have) and never changes an approved version. With a code side, the check runs too (From code).
Authentication
cases:write

Cases

Search cases
GET /v1/maps/{map}/cases EngineCloud
Cases matching words (q), an actor, a table (members only) or a status; ?version=, ?limit=.
Authentication
cases:read
Get a case
GET /v1/maps/{map}/cases/{case} EngineCloud
One case; ?level=plain|working|technical, ?version=.
Authentication
cases:read
Links of a case
GET /v1/maps/{map}/cases/{case}/links Cloud
Tables and their policies (the linked Data project), production health (Telemetry), commits and pull requests (Git), agent tasks (Agent), each read as you within 2 seconds; one that does not answer is not_available (Links).
Authentication
cases:read, members
Comments on a case
GET /v1/maps/{map}/cases/{case}/comments EngineCloud
The comments on a case outside any proposal.
Authentication
cases:read
Comment on a case
POST /v1/maps/{map}/cases/{case}/comments EngineCloud
{ body, field? }. Reviewers comment too.
Authentication
cases:read
Navigation tree
GET /v1/maps/{map}/navigation EngineCloud
Roots, places with their paths, shortcuts and the cases on each place, and the in_app cases with no place; ?root=shop, ?version=4. With Telemetry linked, each place carries its findings.
Authentication
cases:read
One place
GET /v1/maps/{map}/places/{place} EngineCloud
The place, its path, its route and permission, the actionable that opens it, its shortcuts and its cases.
Authentication
cases:read
Where is it?
GET /v1/maps/{map}/find?q= EngineCloud
From words, a case id or a route, the best places with their path, route and cases, and, for members, the files behind them: the case files and the code files of the last upload.
Authentication
cases:read
Event graph
GET /v1/maps/{map}/events EngineCloud
Every case with the outcomes it emits and listens to, public and internal outcomes per area, cycles and bounded loops; ?from=<event name> follows one chain.
Authentication
cases:read

Deliveries and dead letters

These read your app’s database, where the runtime keeps them: on a self-hosted server, the database in CASES_APP_DATABASE_URL; in Sypnia Cloud, the map’s linked Data project, with your token (so a Data viewer cannot replay). Members only; reviewers see none of it. Without an app database: 409 no_app_database; with one where no area service has started: 409 no_runtime.

Deliveries
GET /v1/maps/{map}/listeners/{listener}/deliveries EngineCloud
Recent deliveries to one listening case: event id, state (pending, running, done, dead), attempts, wait, last error, trace; ?state=. The listener is a case of the latest version that starts on an event.
Authentication
cases:read, members
Dead letters
GET /v1/maps/{map}/dead-letters EngineCloud
Every listener with dead letters and how many; ?listener= adds that listener’s dead letters with their errors and traces.
Authentication
cases:read, members
Send dead letters again
POST /v1/maps/{map}/listeners/{listener}/dead-letters/replay EngineCloud
{ events?: [id] }, all of them when left out. Safe to repeat: a listener ignores an event it already handled. Kept in the audit.
Authentication
cases:operate
Drop a dead letter
DELETE /v1/maps/{map}/listeners/{listener}/dead-letters/{event} EngineCloud
{ reason } (in the body or the query), required; kept in the audit and on the delivery.
Authentication
cases:operate

Proposals and comments

List proposals
GET /v1/maps/{map}/proposals EngineCloud
?status=draft|open|merged|closed.
Authentication
cases:read
Open a proposal
POST /v1/maps/{map}/proposals EngineCloud
{ title, reason?, changes: [{ op: add|change|retire, case }], map?, navigation?, reviewers? }. A change replaces only the fields it gives (null removes one); retire keeps the case with status: retired; map and navigation bring a new map.yaml or navigation.yaml; reviewers asks for reviews at once. The changes are validated against the latest version: what they would break answers 422 invalid_map with errors[] (Versions and reviews).
Authentication
cases:write
Get a proposal
GET /v1/proposals/{id} EngineCloud
The proposal, its review state (approvals, required reviewers, what is missing) and its diff.
Authentication
cases:read
Ask for reviews
POST /v1/proposals/{id}/reviewers EngineCloud
{ reviewers: [email], required? } (required by default). Each one is named on the proposal, invited to the workspace as a reviewer when they are not a member, and gets an e-mail. A draft becomes open.
Authentication
cases:write
Approve
POST /v1/proposals/{id}/approve EngineCloud
Owners, approvers and the reviewers named on the proposal. When every required approval is in, one transaction creates the new version and marks the proposal merged.
Authentication
cases:approve
Close
POST /v1/proposals/{id}/close EngineCloud
Closes a proposal without merging it: its author, owners and approvers.
Authentication
cases:write
Comments on a proposal
GET /v1/proposals/{id}/comments EngineCloud
Every comment on the proposal and on its cases.
Authentication
cases:read
Comment
POST /v1/proposals/{id}/comments EngineCloud
{ body, case?, field? }: on the proposal, or on one case of it. Reviewers comment too.
Authentication
cases:read

Checks

Run the check
POST /v1/maps/{map}/checks EngineCloud
Body: the code side (useCases and app from cases map --json, { code }, or the document map --upload sends), or caseIds alone (from commit trailers: the map is checked by itself and an id it does not have is reported as unmapped); optional contract, version. Returns the findings, as cases check --json, and keeps the last result per map and version.
Authentication
cases:read, members
The last check
GET /v1/maps/{map}/checks EngineCloud
The last result: version, findings, summary, who ran it and when.
Authentication
cases:read, members

Project tokens

A project token lets MCP clients and CI work on one map without a person’s session. It acts as an editor of that map with cases:read cases:write (and cases:operate when you give it), and never approves. It is syp_cpt_ followed by 40 characters, shown once, and kept only as a SHA-256 hash and its last 4 characters.

List project tokens
GET /v1/maps/{map}/tokens EngineCloud
Name, scopes, last 4 characters, last use, expiry; never the tokens themselves.
Authentication
cases:write, owners
Create a project token
POST /v1/maps/{map}/tokens EngineCloud
{ name, scopes?, expires_at? }; scopes defaults to cases:read cases:write, and cases:approve is refused. The answer carries the token once.
Authentication
cases:write, owners
Revoke a project token
DELETE /v1/maps/{map}/tokens/{id} EngineCloud
It stops working at once.
Authentication
cases:write, owners

Errors

Errors are JSON: { "error": { "code", "message", "errors"? } }.

StatusCodeWhen
401unauthenticatedno token, it expired, or a key-bound token came without its DPoP proof; WWW-Authenticate names the resource metadata
403not_allowedyour role or the token’s scopes cannot do it (e.g. approve)
404not_foundit does not exist, or you may not see it (so a map’s existence does not leak)
409version_conflictanother approval won the race for the version, or the proposal touches a case that changed since its base; rebase it
409conflictalready merged or closed, a slug already taken, a Data project already linked to another map
409no_app_database, no_runtimedeliveries need the app’s database, or no area service has started on it
422invalid_mapthe files or the proposal do not validate; errors[] says where
422invalid_inputthe request is not valid; the message says which field
429rate_limitedtoo many requests (600 a minute per credential by default); Retry-After says when to try again
503unavailablethe database or another Sypnia product did not answer; nothing was changed, try again

The endpoints of external starts

These live on your app’s address, not on the Cases API: the runtime serves one for every case that starts external (How a case starts).

Start an external case
POST /hooks/{case} EngineCloud
The body is the case’s input. Optional header Idempotency-Key for api starts.
Authentication
the case's signature, or its case key syp_rck_…
StatusWhen
200respond: outcome, and the case ended in an outcome: { ok: true, outcome, data }
202respond: accepted: { run_id }; the case runs from its queue
401the signature or the key does not check
422the input does not match (invalid_input, with the field), or, with respond: outcome, the case ended in a declared failure: { ok: false, outcome, tell, data }
500an error nobody declared; the body carries a reference, the run’s id, to find it in Telemetry

A resend with an idempotency key answers the first response again, with the header idempotent-replayed: true, and runs nothing. A resend that arrives while the first is still running waits for it and gets the same answer.

  1. Authentication
  2. Me and workspaces
  3. Who am I
  4. List workspaces
  5. Create a workspace
  6. Members
  7. Invite someone
  8. Change a role
  9. Remove a member
  10. Maps and versions
  11. List maps
  12. Create a map
  13. Get a map
  14. Change a map
  15. List versions
  16. Diff two versions
  17. Export
  18. Audit
  19. Links
  20. Link a Data project
  21. Link a Telemetry project
  22. Upload a map from code
  23. Cases
  24. Search cases
  25. Get a case
  26. Links of a case
  27. Comments on a case
  28. Comment on a case
  29. Navigation and events
  30. Navigation tree
  31. One place
  32. Where is it?
  33. Event graph
  34. Deliveries and dead letters
  35. Deliveries
  36. Dead letters
  37. Send dead letters again
  38. Drop a dead letter
  39. Proposals and comments
  40. List proposals
  41. Open a proposal
  42. Get a proposal
  43. Ask for reviews
  44. Approve
  45. Close
  46. Comments on a proposal
  47. Comment
  48. Checks
  49. Run the check
  50. The last check
  51. Project tokens
  52. List project tokens
  53. Create a project token
  54. Revoke a project token
  55. Errors
  56. The endpoints of external starts
  57. Start an external case

    Search pages, sections and terms