---
title: "Cancel playtable run"
method: POST
path: "/api/playtable-runs/{sid}/cancel"
tags: ["playtable_runs"]
---

# Cancel playtable run

`POST /api/playtable-runs/{sid}/cancel`

## Request

- Base URL: `https://beta.getsales.io/playtables/v1`
- URL: `https://beta.getsales.io/playtables/v1/api/playtable-runs/{sid}/cancel`
- Auth: HTTP bearer and API key in header `Team-SID`

Stop an active run: cancels the Laravel batch (in-flight steps finish their current step, remaining jobs no-op), reverts still-queued cells, stamps finished_at, emits playtable-runs.cancelled (reason=user). Spent credits are NOT refunded - receipts stand; result carries spent_credits so far (may still grow from in-flight steps) and reverted_cells_count. Idempotent on an already-cancelled run (already_cancelled:true); a normally finished run → 409 conflict.

Contract:
- MCP tool `cancel_playtable_run`, registry package `mcp.playtables/playtable_runs`, mount `playtables.columns`.
- Operation `action`, response envelope `action`.
- Flags: dangerous: the MCP layer gates it behind a preview/commit token, and the effect cannot be undone through this API.

## Path parameters

- `sid` string, required: Playtable run sid (pt_rn_…).

## Response `200`

`action` success envelope.

- CancelPlaytableRunResponse
  - `success` true, required
  - `operation` 'action', required
  - `action` string, required: kebab-case verb; matches the route segment.
  - `item` object, nullable, required
    - `sid` string, required
    - `team_sid` string, required
    - `playtable_sid` string, required
    - `object_type` 'people' | 'company', required
    - `type` 'enrich' | 'export' | 'import' | 'bulk', required
    - `field_sids` string[], nullable, required
    - `scope` object, nullable, required
      - `object_sids` string[], nullable, required
      - `view_sid` string, nullable, required
      - `filter` union, required: Filter AST: and/or/not/any nodes (depth <= 5, root counts) over {field, op} leaves; op = >=1 of the §4.18 atoms; atoms AND.
        - object
          - `and` object[], required
        - object
          - `or` object[], required
        - object
          - `not` object, required: Recursive node: the same object shape repeats here. A static OpenAPI document cannot express the cycle, so this level is documented as an open object.
        - object
          - `any` object, required
            - `path` string, required: Array-valued path - the only way to reach inside an array.
            - `where` object, required: Recursive node: the same object shape repeats here. A static OpenAPI document cannot express the cycle, so this level is documented as an open object.
        - object
          - `field` string, required: Namespaced path: record.<slug> or a built-in object attribute; element-relative inside any.where.
          - `op` object, required
            - `eq` union
              - …
            - `ne` union
              - …
            - `in` union[]
              - …
            - `nin` union[]
              - …
            - `gt` union
              - …
            - `gte` union
              - …
            - `lt` union
              - …
            - `lte` union
              - …
            - `is_null` boolean
            - `contains` string
            - `not_contains` string
            - `contains_any` string[]
            - `not_contains_any` string[]
            - `starts_with` string
        - unknown
    - `params_snapshot` object, nullable, required
    - `max_budget` number, nullable, required
    - `estimated_cost` number, nullable, required
    - `file_url` string, nullable, required
    - `created_by` object, required
      - `actor_type` 'user' | 'support' | 'api_key' | 'system' | 'agent', required
      - `actor_sid` string, nullable, required
      - `team_sid` string, required
      - `actor_name` string, nullable: The OAuth client that acted ("Claude", "n8n"); null for a user, an API key or a system job.
      - `oauth_client_sid` string, nullable: The acting OAuth client (id_oc_*); null off the OAuth path.
      - `reason` string, nullable: Why a system actor wrote the row (snapshot_capture_job, ...); null otherwise.
      - `permissions` object, required: Internal audit context: the grant set the actor held at write time. Not a contract.
      - `cluster_id` integer, nullable: Internal audit context: the cluster that served the write.
      - `trace_id` string, nullable: Internal audit context: the trace id of the request that wrote the row.
    - `created_at` string, required
    - `finished_at` string, nullable, required
  - `result` object, required
    - `already_cancelled` boolean, required: true = idempotent no-op (the run was already cancelled).
    - `reverted_cells_count` integer, required: Still-queued cells flipped back (no prior value → empty, prior value retained → done). Bulk counters per §4.12a - rows not embedded.
    - `spent_credits` number, required: Σ ledger by run_sid at cancel time; the final figure may still grow from in-flight steps.
  - `meta` object, required
    - `trace_id` string, required: UUID v7; same 128-bit value as the X-Trace-Id header.
    - `span_id` string, required: 16 hex chars, root span of this request.
    - `timestamp` string, required: ISO 8601 UTC (Y-m-dTH:i:sZ), response time.
    - `duration_ms` integer, required: Server-side wall clock.
    - `team_sid` string, nullable: The team this call ran in (the token team, or the team_sid override). Null when unauthenticated; absent from pre-2026-08-20 backends.
    - `actor_type` string, nullable: user | agent | api_key | system. Null when unauthenticated; absent from pre-2026-08-20 backends.

## Other responses

- `4XX`: MCP error envelope. `error.code` is one of validation_failed, nothing_to_update, not_found, relation_not_found, invalid_transition, limit_exceeded, payment_required, duplicate_rejected, conflict, delete_blocked, unauthorized, forbidden, rate_limited, not_implemented.
- `5XX`: MCP error envelope with `error.code` internal_error or service_unavailable.

---

[API](https://skmtc.dev/getsales/apis/getsales-public-contract-gs-service-playtables.md) - [All operations](https://skmtc.dev/getsales/apis/getsales-public-contract-gs-service-playtables/llms.txt) - [OpenAPI document](https://skmtc.dev/getsales/apis/getsales-public-contract-gs-service-playtables/revisions/aa394506515d?raw)
