GET /api/openapi.json
Get the machine-readable OpenAPI 3.1
description of the whole Stride API. It covers every /api route, and the two
device sign-in token endpoints, POST /oauth/token and POST /oauth/revoke:
paths, verbs, query and path parameters, request bodies, response schemas, and
which operations need a Bearer token. Client generators, MCP tooling and API viewers
can read it directly. The markdown pages in this directory are still the
narrative reference.
Authentication
No authentication required. This endpoint is public, the same as
GET /api/agent/onboarding: it is how a new client
finds out how to authenticate. The document contains no tokens, no example
credentials and no internal hostnames. If you send an Authorization header,
it is ignored.
Request
Method: GET
Endpoint: /api/openapi.json
Parameters: None
The endpoint runs through the same accepts ["json"] pipeline as the rest of
the API. Send no Accept header, Accept: application/json, Accept: */*, or
the OpenAPI media type application/vnd.oai.openapi+json. All of them return
the document. Any other value, such as text/html or application/xml, returns
406 Not Acceptable with a JSON error body.
Response
Success (200 OK)
The response body is the OpenAPI document, served byte-for-byte from
priv/openapi/stride-api.json.
| Header | Value |
|---|---|
content-type |
application/json; charset=utf-8 |
cache-control |
public, max-age=3600 |
The document only changes when Stride is deployed, so clients and proxies may cache it for an hour.
{
"openapi": "3.1.0",
"info": { "title": "Stride API", "version": "1.0.0", "description": "..." },
"servers": [{ "url": "/" }],
"security": [{ "bearerAuth": [] }],
"paths": {
"/api/tasks": {
"get": { "operationId": "listTasks", "parameters": [ ... ], "responses": { ... } },
"post": { "operationId": "createTask", ... }
},
"/api/tasks/{id}/complete": {
"parameters": [{ "$ref": "#/components/parameters/TaskId" }],
"patch": { "operationId": "completeTask", ... }
},
"/api/openapi.json": {
"get": { "operationId": "getOpenApiSpec", "security": [], ... }
}
},
"components": {
"securitySchemes": { "bearerAuth": { "type": "http", "scheme": "bearer" } },
"parameters": { ... },
"responses": { ... },
"schemas": { "Task": { ... }, "TaskSummary": { ... }, "PageMeta": { ... }, ... }
}
}
Bad Request (400 Bad Request)
Returned when the query string cannot be parsed, for example ?a=%FF (an
invalid percent-encoding). The body is always JSON, whatever the Accept
header says, with a fixed message that never echoes the request:
{
"error": "Bad Request",
"message": "The request is malformed and could not be processed."
}
Every /api route behaves the same way. See
Errors in the API README.
Not Acceptable (406 Not Acceptable)
Returned when the Accept header (or a _format query parameter) asks for a
format other than JSON, for example Accept: text/html. The body is JSON, with
a fixed message that never echoes the header back:
{
"error": "Not Acceptable",
"message": "This API only serves application/json."
}
Every /api route behaves the same way. See
Errors in the API README.
Server Error (500 Internal Server Error)
This is returned only if the spec file is missing from the release. The server
logs OpenAPI spec unavailable at priv/openapi/stride-api.json: <reason>. A
failed read is never cached, so the endpoint recovers on the next request once
the file is restored.
{
"error": "OpenAPI specification unavailable"
}
What the Document Contains
- Every
/apiroute. That includes thePUTalias ofPATCH /api/tasks/:id, which shares that endpoint's page. Router:idsegments are written in OpenAPI form,{id}. Its type isstringbecause it accepts both a numeric id and an identifier such asW21. - Security.
bearerAuth(an HTTP Bearer scheme) is the document-wide default, so it applies to every operation behind the authenticated:apipipeline. The two public operations,getAgentOnboardingandgetOpenApiSpec, override it withsecurity: [], and so do the device sign-in operations,oauthTokenandoauthRevoke, which take no bearer token at all (POST /oauth/token). The person-API operations under/api/me, which the mobile apps call, override it with exactlysecurity: [{"deviceAuth": []}]: a device access token, never an agent API token (GET /api/me). - All of
GET /api/tasks's query parameters:limit,cursor,status,type,priority,assigned_to_id,parent,updated_since,column_id,labelandresponse_view. See GET /api/tasks. - Shared component schemas. These are
Task(the full render),TaskSummary(theresponse_view=slimrow),TaskAck(the slim/completeand/changed_filesacknowledgement),PageMeta,Hook,HookResult,ErrorandValidationError, plus the per-endpoint envelopes. Where one endpoint can return the full view or the slim view, the response usesanyOf. - A relative server,
"/". Resolve paths against the host you fetched the document from. That ishttps://www.stridelikeaboss.comfor the hosted service, and your own host when you self-host.
Keeping the Spec in Sync
The spec is written by hand. test/kanban_web/controllers/api/open_api_contract_test.exs
makes sure it cannot quietly fall behind the router. The test checks that:
- The router and the spec match in both directions. It lists
KanbanWeb.Router.__routes__/0and keeps every route under/api, plus every/oauthroute piped through:oauth(the browser-scoped/oauth/authorizepage is not part of the API). It rewrites:idas{id}and fails on any route and verb missing from the spec, for example:GET /api/tasks/{id}/foo (router: /api/tasks/:id/foo) is missing from priv/openapi/stride-api.json. It also fails on any operation the spec documents that the router does not serve. - Authentication matches the pipeline. It resolves each route with
Phoenix.Router.route_info/4. Routes piped through:apimust requirebearerAuthand must not acceptdeviceAuth, routes piped through:device_api(/api/me/*) must declare exactlysecurity: [{"deviceAuth": []}], and routes piped through:api_publicor:oauthmust declaresecurity: []. A route in any other pipeline fails until the test is taught how to classify it. - The document is internally sound. Every
$refresolves, everyoperationIdis unique, every operation has a 2xx response, and every{name}in a path has a required path parameter. Every operation also documents a406as a$refto#/components/responses/NotAcceptable, and that component's example must equal whatKanbanWeb.ErrorJSONrenders for a 406. Likewise every operation documents a400as a$refto#/components/responses/BadRequest, whose example must equal whatKanbanWeb.ErrorJSONrenders for an/api400. The/oauthoperations document theirs as#/components/responses/OAuthErrorinstead, the RFC 6749 error shape, whose example must equal whatKanbanWeb.ErrorJSONrenders for an/oauth/token400. - The schemas match what the API returns. The property keys of
Task,TaskSummaryandTaskAckmust equal the keys thatKanbanWeb.API.TaskJSONrenders,Meand its parts the keysKanbanWeb.API.Me.MeJSONrenders, andGoalSummarythe keys ofKanbanWeb.API.TaskController.render_goal_with_children/1.PageMetamust equal themetaof a real paginatedGET /api/tasksresponse. Everystatus,type,priorityandcomplexityenum, on the schemas and on theGET /api/tasksfilter parameters, must equal theEcto.Enumvalues onKanban.Tasks.Task. A realTaskJSON.error/1body for an invalid embeddedkey_filesentry must fit theValidationErrorvalue types. - The document is safe to publish. It contains no token-shaped strings,
no
localhostor internal hostnames, and only the relative server.
A second test, test/kanban_web/controllers/api/mobile_fixtures_test.exs,
keeps the native apps' example responses in
mobile/shared/fixtures/ true to the
spec. Every /api/me and /oauth operation whose success response has a JSON
body needs a fixture named <operationId>.json, and each fixture must fit its
response schema with no undeclared key. A 204 with no body needs none.
Adding a New /api Route
When you add a route under /api in lib/kanban_web/router.ex:
-
Add an operation for it to
priv/openapi/stride-api.json. Give it a uniqueoperationId, asummary, atagsentry and at least one 2xx response. Add 4xx responses as$refs to#/components/responses/*. Every operation needs"406": { "$ref": "#/components/responses/NotAcceptable" }, because every/apiroute rejects a non-JSONAcceptheader, and"400": { "$ref": "#/components/responses/BadRequest" }, because every/apiroute rejects a query string or body that cannot be parsed. The one exception to the 2xx rule is a verb routed only to answer405(todayGETandDELETE /api/mcp). List it in@method_not_allowed_onlyin the contract test and document its405response. -
If the path contains
{id}, put"parameters": [{ "$ref": "#/components/parameters/TaskId" }]on the path item. It is already there if the path item exists. -
Set its security. An authenticated route inherits
bearerAuthand needs nosecuritykey. A route in the:api_publicscope must set"security": [], and a person-API route under/api/memust set"security": [{"deviceAuth": []}]. -
Reuse the existing component schemas. If you add fields to
KanbanWeb.API.TaskJSON, add them to the matching schema as well, or the parity tests will fail. -
Run the contract test:
mix test test/kanban_web/controllers/api/open_api_contract_test.exs -
Add a markdown page for the endpoint in
docs/api/, and add it to the endpoint index and the summary table in README.md. -
If the route is under
/api/meor/oauthand its success response has a JSON body, addmobile/shared/fixtures/<operationId>.jsonwith made-up data, and runmix test test/kanban_web/controllers/api/mobile_fixtures_test.exs.
The file is served exactly as stored, so a change reaches clients on the next deploy, once their cached copy is more than an hour old. The server also keeps the bytes in memory after the first request, so in development restart the Phoenix server to see an edit to the spec served; the contract test always reads the file itself.
Using the Spec
Fetch it
curl -s https://www.stridelikeaboss.com/api/openapi.json -o stride-api.json
Browse it in a viewer
Stride does not host a documentation UI. Import the URL or the downloaded file
into any OpenAPI 3.1 viewer, for example Swagger Editor, Redocly or Scalar. To
call the API from the viewer, enter your token in its bearerAuth
authorization dialog. Never paste a token into the spec file itself.
Generate a client
Any OpenAPI 3.1-capable generator works. Two examples:
# TypeScript types
npx openapi-typescript https://www.stridelikeaboss.com/api/openapi.json -o stride-api.d.ts
# A full client SDK (choose your generator and language)
npx @openapitools/openapi-generator-cli generate \
-i https://www.stridelikeaboss.com/api/openapi.json \
-g python -o ./stride-client
A generated client must still send Authorization: Bearer <your_api_token> on
every authenticated call. Read the token from your own configuration (for
example .stride_auth.md), never from the spec.
Agent and MCP tooling
The operationIds (claimTask, completeTask, listTasks, and so on) and
their request schemas can be turned into tool definitions directly. The
onboarding response links to the spec as api_reference.openapi_url; see
GET /api/agent/onboarding.
Example Usage
Check the spec version and list the operations
curl -s https://www.stridelikeaboss.com/api/openapi.json \
| jq -r '.openapi, (.paths | to_entries[] | .key as $p | .value | to_entries[]
| select(.key != "parameters") | "\(.key | ascii_upcase) \($p) \(.value.operationId)")'
Read the query parameters of an operation
curl -s https://www.stridelikeaboss.com/api/openapi.json \
| jq '.paths["/api/tasks"].get.parameters'
Notes
- The spec describes response shapes, not every error message. Most error
bodies carry an
errorstring, and most 4xx bodies add documentation keys. Changeset failures instead returnValidationError:errorskeyed by field, where an embedded list field such askey_filesholds one object per entry in the resulting list rather than a list of strings, anddocumentationbecomes a list of URLs when several fields fail. PUT /api/tasks/{id}is documented because the router serves it (Phoenixresourcesgenerates it). It behaves exactly likePATCH.response_viewaccepts any string. Onlyslimchanges the response.
See Also
- API README - Endpoint index and workflow overview
- GET /api/agent/onboarding - Onboarding payload (links to this spec)
- GET /api/tasks - Pagination and filter parameters
- PATCH /api/tasks/:id/complete - Completion payload, described in prose