Skip to main content

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.

MethodPathSummary
GET/v1/workflow_templates/listList the template catalog
GET/v1/workflow_templates/infoRead one template in full
GET/v1/workflow_templates/installs/listList template installs
GET/v1/workflow_templates/installs/infoRead one install
POST/v1/workflow_templates/installInstall a template
POST/v1/workflow_templates/installs/upgradeUpgrade an install to the current template
POST/v1/workflow_templates/installs/deleteUninstall 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:

StatusDescriptionBody
200Every template in the catalogapplication/json array of TemplateSummary
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The key's role, grants or license do not allow this actionapplication/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:

NameInTypeRequiredDescription
namequerystringYes

Example request:

curl -X GET "http://localhost:4000/v1/workflow_templates/info?name=string" \
-H "Authorization: Bearer $SPANWAY_API_KEY"

Responses:

StatusDescriptionBody
200The template with every agent's instructions and its workflowapplication/json TemplateInfo
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The key's role, grants or license do not allow this actionapplication/json ErrorDetail
404No object with that id is visible to the callerapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError

Response fields (200):

FieldTypeRequiredDescription
templateTemplateYes
digeststringYesDigest
requires_tracingbooleanYesRequires 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:

StatusDescriptionBody
200The installs the caller may seeapplication/json array of InstallView
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The key's role, grants or license do not allow this actionapplication/json ErrorDetail
500The gateway hit an internal error, usually the database is not connectedapplication/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:

NameInTypeRequiredDescription
install_idquerystringYes

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:

StatusDescriptionBody
200The install with its agents and workflowapplication/json InstallView
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The key's role, grants or license do not allow this actionapplication/json ErrorDetail
404No object with that id is visible to the callerapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway hit an internal error, usually the database is not connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
install_idstringYesInstall Id
templatestringYesTemplate
digeststringYesDigest
statusenum: "installing", "ready", "upgrading", "removing"YesStatus
namestringYesName
visibilityenum: "private", "team", "org"YesVisibility
owner_user_idstring or nullYesOwner User Id
owner_team_idstring or nullYesOwner Team Id
owner_organization_idstring or nullYesOwner Organization Id
modelstringYesModel
model_overridesobjectYesModel Overrides
toolset_idstring or nullYesToolset Id
agentsobjectYesAgents
workflow_idstring or nullYesWorkflow Id
workflow_versioninteger or nullYesWorkflow Version
input_contractContractYes
update_availablebooleanYesUpdate Available
created_atstringYesCreated At
updated_atstringYesUpdated 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:

NameInTypeRequiredDescription
Idempotency-Keyheaderstring or nullNo

Request body (application/json, schema InstallRequest):

FieldTypeRequiredDescription
templatestringYesTemplate
modelstringYesModel
model_overridesobjectNoModel Overrides
toolset_idstring or nullNoToolset Id
namestring or nullNoName
visibilityenum: "private", "team", "org"NoVisibility
owner_team_idstring or nullNoOwner 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:

StatusDescriptionBody
200The new install and any optional connectors it could not findapplication/json InstallResult
400model_overrides names writer, which is not an agent of the templateapplication/json ErrorDetail
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The key's role, grants or license do not allow this actionapplication/json ErrorDetail
404No object with that id is visible to the callerapplication/json ErrorDetail
409The install could not be recorded; try againapplication/json ErrorDetail
422Idempotency-Key was already used with a different requestapplication/json ErrorDetail
500The gateway hit an internal error, usually the database is not connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
installInstallViewYes
missing_optional_connectorsarray of MissingConnectorYesMissing 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):

FieldTypeRequiredDescription
install_idstringYesInstall Id
overwrite_editedbooleanNoOverwrite 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:

StatusDescriptionBody
200The upgraded install, missing optional connectors and any write tools it lostapplication/json UpgradeResult
400Template support_triage needs read tools from one of jira, linear in the toolset for its triager agent (read the ticket)application/json ErrorDetail
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The key's role, grants or license do not allow this actionapplication/json ErrorDetail
404No object with that id is visible to the callerapplication/json ErrorDetail
409The object already exists or is in a state that does not allow this changeapplication/json ErrorDetail
422A field failed validation and the detail names itapplication/json ErrorDetail
500The gateway hit an internal error, usually the database is not connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
installInstallViewYes
missing_optional_connectorsarray of MissingConnectorYesMissing Optional Connectors
write_tools_droppedarray of stringYesWrite 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):

FieldTypeRequiredDescription
install_idstringYesInstall 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:

StatusDescriptionBody
200What the uninstall removedapplication/json UninstallResult
401No valid key or Admin UI session was presentedapplication/json ProxyError
403The key's role, grants or license do not allow this actionapplication/json ErrorDetail
404No object with that id is visible to the callerapplication/json ErrorDetail
422Validation Errorapplication/json HTTPValidationError
500The gateway hit an internal error, usually the database is not connectedapplication/json ErrorDetail

Response fields (200):

FieldTypeRequiredDescription
install_idstringYesInstall Id
agents_deletedintegerYesAgents Deleted
workflow_deletedbooleanYesWorkflow Deleted