Workflow templates API
This page documents the 7 gateway endpoints tagged workflow templates in the gateway's OpenAPI document. Every example targets a gateway on http://localhost:4000 and authenticates with the SPANWAY_API_KEY environment variable, which holds the master key or a virtual key that has access to the route. Request and response fields are taken from the schema the running gateway publishes at /openapi.json, and the same document is bundled with this site as openapi.json.
| Method | Path | Summary |
|---|---|---|
| GET | /v1/workflow_templates/list | List the template catalog |
| GET | /v1/workflow_templates/info | Read one template in full |
| GET | /v1/workflow_templates/installs/list | List template installs |
| GET | /v1/workflow_templates/installs/info | Read one install |
| POST | /v1/workflow_templates/install | Install a template |
| POST | /v1/workflow_templates/installs/upgrade | Upgrade an install to the current template |
| POST | /v1/workflow_templates/installs/delete | Uninstall a template |
Endpoints
GET /v1/workflow_templates/list
List the template catalog
The catalog of ready-made agent workflows, such as code review or support triage: what each template installs, the connectors it can use, the inputs it asks for and its digest. Any key with access to agents may call it, and nothing changes.
Example request:
curl -X GET "http://localhost:4000/v1/workflow_templates/list" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | Every template in the catalog | application/json array of TemplateSummary |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key's role, grants or license do not allow this action | application/json ErrorDetail |
GET /v1/workflow_templates/info
Read one template in full
One template in full, including the instructions of every agent it creates and the steps of its workflow, so an admin can review what an install would do. Any key with access to agents may call it, and nothing changes.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
name | query | string | Yes |
Example request:
curl -X GET "http://localhost:4000/v1/workflow_templates/info?name=string" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The template with every agent's instructions and its workflow | application/json TemplateInfo |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key's role, grants or license do not allow this action | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
template | Template | Yes | |
digest | string | Yes | Digest |
requires_tracing | boolean | Yes | Requires Tracing |
GET /v1/workflow_templates/installs/list
List template installs
Templates installed on this gateway that the caller may see, each marked when the catalog holds a newer version of its template. Any key with access to agents may call it, and nothing changes.
Example request:
curl -X GET "http://localhost:4000/v1/workflow_templates/installs/list" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The installs the caller may see | application/json array of InstallView |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key's role, grants or license do not allow this action | application/json ErrorDetail |
| 500 | The gateway hit an internal error, usually the database is not connected | application/json ErrorDetail |
GET /v1/workflow_templates/installs/info
Read one install
One install with the agents and workflow it created. An install the caller may not see answers 404, the same as one that does not exist, and nothing changes.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
install_id | query | string | Yes |
Example request:
curl -X GET "http://localhost:4000/v1/workflow_templates/installs/info?install_id=install_id-123" \
-H "Authorization: Bearer $SPANWAY_API_KEY"
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The install with its agents and workflow | application/json InstallView |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key's role, grants or license do not allow this action | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway hit an internal error, usually the database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
install_id | string | Yes | Install Id |
template | string | Yes | Template |
digest | string | Yes | Digest |
status | enum: "installing", "ready", "upgrading", "removing" | Yes | Status |
name | string | Yes | Name |
visibility | enum: "private", "team", "org" | Yes | Visibility |
owner_user_id | string or null | Yes | Owner User Id |
owner_team_id | string or null | Yes | Owner Team Id |
owner_organization_id | string or null | Yes | Owner Organization Id |
model | string | Yes | Model |
model_overrides | object | Yes | Model Overrides |
toolset_id | string or null | Yes | Toolset Id |
agents | object | Yes | Agents |
workflow_id | string or null | Yes | Workflow Id |
workflow_version | integer or null | Yes | Workflow Version |
input_contract | Contract | Yes | |
update_available | boolean | Yes | Update Available |
created_at | string | Yes | Created At |
updated_at | string | Yes | Updated At |
POST /v1/workflow_templates/install
Install a template
Creates a template's custom agents and its workflow definition with the caller's model and toolset, so a team gets a working workflow in one call. The caller's role must allow changes and needs the same rights as creating the agents and the definition by hand. An Idempotency-Key header makes a retry return the same install.
Parameters:
| Name | In | Type | Required | Description |
|---|---|---|---|---|
Idempotency-Key | header | string or null | No |
Request body (application/json, schema InstallRequest):
| Field | Type | Required | Description |
|---|---|---|---|
template | string | Yes | Template |
model | string | Yes | Model |
model_overrides | object | No | Model Overrides |
toolset_id | string or null | No | Toolset Id |
name | string or null | No | Name |
visibility | enum: "private", "team", "org" | No | Visibility |
owner_team_id | string or null | No | Owner Team Id |
Example request:
curl -X POST "http://localhost:4000/v1/workflow_templates/install" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"template": "code_review",
"model": "my-model",
"model_overrides": {
"consolidator": "my-cheaper-model"
},
"toolset_id": "ts_01J...",
"name": "Payments code review",
"visibility": "team",
"owner_team_id": "team-payments"
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The new install and any optional connectors it could not find | application/json InstallResult |
| 400 | model_overrides names writer, which is not an agent of the template | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key's role, grants or license do not allow this action | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 409 | The install could not be recorded; try again | application/json ErrorDetail |
| 422 | Idempotency-Key was already used with a different request | application/json ErrorDetail |
| 500 | The gateway hit an internal error, usually the database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
install | InstallView | Yes | |
missing_optional_connectors | array of MissingConnector | Yes | Missing Optional Connectors |
POST /v1/workflow_templates/installs/upgrade
Upgrade an install to the current template
Moves an install to the catalog's current version of its template. Agents edited since install are only replaced with overwrite_edited, and keep the installer's model, toolset, name and visibility. The caller's role must allow changes and the caller must be able to see the install.
Request body (application/json, schema UpgradeRequest):
| Field | Type | Required | Description |
|---|---|---|---|
install_id | string | Yes | Install Id |
overwrite_edited | boolean | No | Overwrite Edited |
Example request:
curl -X POST "http://localhost:4000/v1/workflow_templates/installs/upgrade" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"install_id": "wti_01J...",
"overwrite_edited": false
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | The upgraded install, missing optional connectors and any write tools it lost | application/json UpgradeResult |
| 400 | Template support_triage needs read tools from one of jira, linear in the toolset for its triager agent (read the ticket) | application/json ErrorDetail |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key's role, grants or license do not allow this action | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 409 | The object already exists or is in a state that does not allow this change | application/json ErrorDetail |
| 422 | A field failed validation and the detail names it | application/json ErrorDetail |
| 500 | The gateway hit an internal error, usually the database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
install | InstallView | Yes | |
missing_optional_connectors | array of MissingConnector | Yes | Missing Optional Connectors |
write_tools_dropped | array of string | Yes | Write Tools Dropped |
POST /v1/workflow_templates/installs/delete
Uninstall a template
Deletes an install and the custom agents it created. Only a proxy admin's uninstall deletes its workflow definition too. The caller's role must allow changes and the caller must be able to see the install.
Request body (application/json, schema InstallIdRequest):
| Field | Type | Required | Description |
|---|---|---|---|
install_id | string | Yes | Install Id |
Example request:
curl -X POST "http://localhost:4000/v1/workflow_templates/installs/delete" \
-H "Authorization: Bearer $SPANWAY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"install_id": "wti_01J..."
}'
Responses:
| Status | Description | Body |
|---|---|---|
| 200 | What the uninstall removed | application/json UninstallResult |
| 401 | No valid key or Admin UI session was presented | application/json ProxyError |
| 403 | The key's role, grants or license do not allow this action | application/json ErrorDetail |
| 404 | No object with that id is visible to the caller | application/json ErrorDetail |
| 422 | Validation Error | application/json HTTPValidationError |
| 500 | The gateway hit an internal error, usually the database is not connected | application/json ErrorDetail |
Response fields (200):
| Field | Type | Required | Description |
|---|---|---|---|
install_id | string | Yes | Install Id |
agents_deleted | integer | Yes | Agents Deleted |
workflow_deleted | boolean | Yes | Workflow Deleted |