API
Everything the web and the CLI do goes through one HTTP/JSON API. You can call it directly from a script or an integration. This page describes the general conventions, not each endpoint. The full contract of each endpoint is the OpenAPI 3.0 specification of the release. Today the server does not serve it over HTTP: the file is openapi3.json in the backend's api/ folder, in the source code at that release. The official way to publish it has not been decided.
Address and identifiers
- The root is
https://<your team's API name>/v1. Most endpoints are under/v1/workspaces/{workspace_id}/..., and project endpoints under/v1/workspaces/{workspace_id}/projects/{project_id}/.... workspace_idandproject_idare UUIDs. Specs, change requests and implementation specs can be addressed by UUID or by ref, for examplePAY-R-12,PAY-CR-45,PAY-WS-14orPAY-WS-14@ready-1(a Ready milestone).- Field names in JSON use
snake_case. GET /v1/metais public, needs no sign-in, and gives the versions and the sign-in address (see CLI and server compatibility).GET /healthzis public too.
Authentication
Every other call needs Authorization: Bearer <access token>. The token is an OIDC token issued by your team's sign-in service. There are three ways to get a token:
- A person's sign-in, through the web or
tmspec auth login. - An API key (
tms_...), created on the web. Exchange the key for a 15-minute token withclient_credentialsat the sign-in service's/tokenendpoint, sending the key in the form'sclient_secretfield. The token holds only the key's permissions. - A token issued by another system, if your team has one.
The real permission is the person's role intersected with the token's scopes (Roles and permissions). Each resource has allowed_actions listing exactly what you can do, so a client does not have to work it out.
Conditional writes
A write to an existing resource needs an If-Match header carrying the ETag you read:
| Situation | Returns |
|---|---|
If-Match missing | 428 |
| The resource changed since you read it | 412, with the current ETag |
This step protects you from overwriting someone else's change; after a 412, read again and redo.
A POST that creates takes an Idempotency-Key header (1 to 255 printable characters): sending the same key with the same content again returns the first result without doing it twice, while the same key with different content is 409 idempotency_key_reused. That lets you retry safely after a network error. Some POSTs require a key.
Reading
GETreturns anETag; sendIf-None-Matchback to receive304when nothing changed.- Cursor pagination. A long list returns one page with
next_cursor; sendcursor=<that value>to get the next page, andlimitto change the page size. There is no offset. A wrong cursor is422 invalid_cursor. - Sets with a hard limit (the Area tree, the diff of a change request) are returned at once, without pagination.
Errors
Errors are application/problem+json:
{
"status": 422,
"code": "validation_failed",
"detail": "…",
"errors": [{"location": "body.title", "value": ""}]
}
code is for machines and is stable across releases; detail is for people and may change. errors is present when the error is in the data sent, with a location such as body.<field> or query.<parameter>.
| Status | Usual meaning |
|---|---|
| 401 | Not signed in, or the token expired |
| 403 | Role not enough (forbidden) or the key lacks a scope (scope_missing, the scope name is in errors) |
| 404 | Not found, or you are not allowed to see it; the two cases are identical |
| 405 | The method does not exist on this path |
| 409 | Conflict with the current state: base_moved, invalid_step, idempotency_key_reused... |
| 412 / 428 | If-Match wrong or missing |
| 422 | The data was rejected |
| 429 | Too many calls; wait according to the Retry-After header |
| 5xx | A server-side error; retry for GET or for a POST with an Idempotency-Key |
API compatibility
The API version (api_version) follows SemVer. Adding a field, an endpoint, an optional parameter or an enum value does not break compatibility; a client should tolerate fields and values it does not know yet. Removing or renaming a field, changing a type, or adding a required parameter is a breaking change and comes only with a new major version. A client generated from the OpenAPI specification tolerates additive changes.
Calling it with the CLI
If you are signed in, tmspec api calls an endpoint that has no command of its own, with the same credential:
tmspec api GET /v1/workspaces --field limit=5
tmspec api PATCH /v1/workspaces/<id>/projects/<id>/implementation-specs/PAY-WS-14 --input draft.json --header 'If-Match: "3"'
cat body.json | tmspec api POST /v1/workspaces/<id>/projects/<id>/areas --input - --idempotency-key 7f3a
- The path starts with
/v1/and is relative to the host in use. A full URL is accepted only when it is that very host. --field key=valuebecomes a query parameter with GET, or a JSON object used as the body with other methods.--input file(or-for stdin) sends the file as the body unchanged.- The token is sent only to the host in use; a redirect to another host is not followed.
- A result of 400 or above exits with the matching exit code, the error goes to stderr and stdout stays empty.