Guest Machines
API referencePipelines

Cancel a pipeline run

POST/api/v1/pipelines/runs/{run_id}/cancel

Cancel a pending or running pipeline execution.

Cancellation is requested, not applied inline: the response can still report running for a moment, and the run settles to cancelled with its final counters shortly after. Poll the run rather than treating this response as terminal.

Required access

Credentials: service principal, delegated token, user session

Allowed for a service principal in the run's organization, for the delegated token whose user started the run, and for that user or an organization admin or owner in a session.

Authorization

AuthorizationBearer <token>

An organization-owned automation key, prefixed gsmc_sk_. Already bound to one organization, so it needs no X-Org-Id header. It carries no user identity: it never reaches a private resource however it is scoped, and a run it starts has no user for an interactive tool to reach.

In: header

Path Parameters

run_id*Run Id

Header Parameters

X-Org-Id?|

Selects the active organization for a credential that belongs to more than one. Service-principal keys are bound to a single organization and ignore it.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/api/v1/pipelines/runs/0/cancel" \  -H "Authorization: Bearer $GUEST_MACHINES_API_KEY"
{  "run": {    "id": 1,    "pipeline_id": "ec036e81-7903-4e4d-bbfa-ac8516341cf0",    "actor_principal_type": "agent",    "service_principal_id": "0d57b427-9ed2-4a5e-b0bd-32c8ce299b8e",    "oauth_client_id": "727760ca-b97d-449c-90e5-7773c8142d5d",    "status": "cancelled",    "current_step": 0,    "current_iteration": 1,    "input_data": {},    "output_data": {},    "error": "string",    "limit_detail": {      "error": "limit_exceeded",      "limit_type": "concurrency.global",      "scope": "global",      "message": "string",      "scope_id": "string",      "limit": 0,      "actual": 0,      "retry_after_seconds": 0    },    "failed_step": 0,    "started_at": "2019-08-24T14:15:22Z",    "completed_at": "2019-08-24T14:15:22Z",    "duration_seconds": 0,    "total_tokens": 0,    "total_cost_usd": 0,    "total_retries": 0,    "total_tool_calls": 0,    "total_tool_attempts": 0,    "whole_step_replay_safe": true,    "created_at": "2019-08-24T14:15:22Z"  }}
{  "detail": "string",  "error_code": "string",  "request_id": "string"}
{  "detail": "string",  "error_code": "string",  "request_id": "string"}
{  "detail": "string",  "error_code": "string",  "request_id": "string"}
{  "detail": "string",  "error_code": "string",  "request_id": "string"}
{  "detail": "string",  "error_code": "string",  "request_id": "string"}
{  "detail": "string",  "error_code": "string",  "request_id": "string"}