Skip to main content
POST
/
v1
/
templates
/
builds
/
{build_id}
/
cancel
Cancel a queued or running template build
import requests

url = "https://api.13-215-85-171.sslip.io/v1/templates/builds/{build_id}/cancel"

payload = { "reason": "<string>" }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
{
  "build": {
    "build_id": "<string>",
    "template_id": "<string>",
    "name": "<string>",
    "tags": [
      "<string>"
    ],
    "canonical_ref": "<string>",
    "namespace_slug": "<string>",
    "created_at": "2023-11-07T05:31:56Z",
    "updated_at": "2023-11-07T05:31:56Z",
    "source_digest": "<string>",
    "context_digest": "<string>",
    "dockerfile_digest": "<string>",
    "build_config": {
      "vcpus": 123,
      "memory_mib": 123,
      "internet_access": true,
      "disk_mb": 513
    },
    "triggered_by": "<string>",
    "queued_at": "2023-11-07T05:31:56Z",
    "started_at": "2023-11-07T05:31:56Z",
    "finished_at": "2023-11-07T05:31:56Z",
    "duration_ms": 123,
    "failure_phase": "<string>",
    "cache_summary": {
      "final_artifact_hits": 123,
      "final_artifact_misses": 123,
      "final_artifact_bypasses": 123,
      "final_artifact_stores": 123,
      "layer_hits": 123,
      "layer_misses": 123,
      "layer_bypasses": 123,
      "layer_stores": 123,
      "file_blob_hits": 123,
      "file_blob_misses": 123,
      "file_blob_bypasses": 123,
      "file_blob_stores": 123
    },
    "artifact_availability": {
      "reason": "<string>"
    },
    "promotability": {
      "promotable": true,
      "reason": "<string>"
    },
    "retention_expires_at": "2023-11-07T05:31:56Z",
    "runtime_defaults": {
      "default_env_keys": [
        "<string>"
      ],
      "start_cmd": "<string>",
      "default_user": "<string>",
      "default_workdir": "<string>",
      "readiness": {
        "kind": "tcp",
        "port": 3000,
        "timeout_secs": 30,
        "interval_ms": 500,
        "startup_grace_secs": 2
      }
    },
    "oci_metadata": {
      "labels": {},
      "exposed_ports": [
        "<string>"
      ],
      "volumes": [
        "<string>"
      ],
      "healthcheck": {
        "test": [
          "<string>"
        ],
        "interval_ns": 123,
        "timeout_ns": 123,
        "start_period_ns": 123,
        "retries": 123,
        "mapped_readiness": {
          "kind": "tcp",
          "port": 3000,
          "timeout_secs": 30,
          "interval_ms": 500,
          "startup_grace_secs": 2
        }
      }
    },
    "artifact_ids": [
      "<string>"
    ],
    "retry_of_build_id": "<string>",
    "original_build_id": "<string>",
    "cancel_requested_at": "2023-11-07T05:31:56Z",
    "cancel_requested_by": "<string>",
    "cancellation_reason": "<string>",
    "error": "<string>",
    "error_detail": {
      "message": "<string>",
      "retryable": true,
      "suggested_action": "<string>",
      "step_index": 123,
      "attempt": 123,
      "max_attempts": 123,
      "cache_subject": "<string>",
      "build_id": "<string>",
      "request_id": "<string>",
      "details": {}
    }
  },
  "entries": [
    {
      "build_id": "<string>",
      "template_id": "<string>",
      "offset": 123,
      "timestamp": "2023-11-07T05:31:56Z",
      "message": "<string>",
      "error_detail": {
        "message": "<string>",
        "retryable": true,
        "suggested_action": "<string>",
        "step_index": 123,
        "attempt": 123,
        "max_attempts": 123,
        "cache_subject": "<string>",
        "build_id": "<string>",
        "request_id": "<string>",
        "details": {}
      },
      "result": {
        "id": "<string>",
        "name": "<string>",
        "description": "<string>",
        "builtin": true,
        "canonical_ref": "<string>",
        "namespace_slug": "<string>",
        "tags": [
          "<string>"
        ],
        "default_tag": "<string>",
        "runtime_defaults": {
          "default_env_keys": [
            "<string>"
          ],
          "start_cmd": "<string>",
          "default_user": "<string>",
          "default_workdir": "<string>",
          "readiness": {
            "kind": "tcp",
            "port": 3000,
            "timeout_secs": 30,
            "interval_ms": 500,
            "startup_grace_secs": 2
          }
        }
      },
      "result_metadata": {
        "runtime_defaults": {
          "default_env_keys": [
            "<string>"
          ],
          "start_cmd": "<string>",
          "default_user": "<string>",
          "default_workdir": "<string>",
          "readiness": {
            "kind": "tcp",
            "port": 3000,
            "timeout_secs": 30,
            "interval_ms": 500,
            "startup_grace_secs": 2
          }
        },
        "oci_metadata": {
          "labels": {},
          "exposed_ports": [
            "<string>"
          ],
          "volumes": [
            "<string>"
          ],
          "healthcheck": {
            "test": [
              "<string>"
            ],
            "interval_ns": 123,
            "timeout_ns": 123,
            "start_period_ns": 123,
            "retries": 123,
            "mapped_readiness": {
              "kind": "tcp",
              "port": 3000,
              "timeout_secs": 30,
              "interval_ms": 500,
              "startup_grace_secs": 2
            }
          }
        }
      },
      "phase": "<string>",
      "step_index": 123,
      "total_steps": 123,
      "attempt": 123,
      "max_attempts": 123,
      "cache_subject": "<string>"
    }
  ],
  "next_offset": 123
}

Authorizations

Authorization
string
header
required

API key passed as Bearer token

Path Parameters

build_id
string
required

Body

application/json
reason
string

Optional human-readable cancellation reason recorded on the build.

Response

Current build state after cancellation handling

build
object
required
entries
object[]
required
next_offset
integer<uint64>
required