---
title: "Estimate playtable run cost"
method: POST
path: "/api/playtable-runs/estimate"
tags: ["playtable_runs"]
---

# Estimate playtable run cost

`POST /api/playtable-runs/estimate`

## Request

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

Dry-run pricing for an enrich run - THE money-honesty gate (§4.6): call it BEFORE any paid create_playtable_run(type:"enrich") and surface the range to the user. Resolves the scope row count per field (ES run_condition prefilter - approximate by design, the worker re-checks per cell; done cells are skipped unless force_rerun:true = re-charge consent; cells:not_run | error prices only the cells that have not run or only the error ones) and prices each field's materialized waterfall from the cached gtm-api tool registry.

Returns rows_matched, cost_min (every row succeeds on the cheapest step), cost_max (full waterfall at max prices), cost_expected (registry expected path), priced_at, and a per-field breakdown with per-step price ranges - pass cost_max as max_budget at create (cost_expected is a midpoint, not a cap). No writes, no charges - free to call; free run types (export|import|bulk) have nothing to estimate. Also the answer to "what would it cost to …" - estimate only, no run. A view/filter scope is priced by count (rows_matched = the ES count; rows_to_run per field subtracts the rows already done unless force_rerun, or counts the error rows by id under cells), so any size prices instantly and rows_matched is never a truncated number.

Contract:
- MCP tool `estimate_playtable_run`, registry package `mcp.playtables/playtable_runs`, mount `playtables.columns`.
- Operation `action`, response envelope `action`.
- Flags: read only.

## Request body

- EstimatePlaytableRunRequest: Request body of `estimate_playtable_run`.
  - `playtable_sid` string, required: Parent playtable sid (pt_tb_…).
  - `object_type` 'people' | 'company', required: Which tab the run would target: people | company.
  - `type` 'enrich': The type of the run this prices: enrich, the one paid type, the same word create_playtable_run takes (export, import and bulk have nothing to estimate). Optional; any other word is a 422 here, before the create.
  - `field_sids` string[], required: The fields that would run (pt_fd_…, 1..20; action columns only).
  - `scope` object, required: Same XOR rule as create: object_sids XOR view_sid/filter.
    - `object_sids` string[], nullable: Explicit targets (cr_pp_… / cr_co_… of the run object_type), min 1, max 10 000 (a wider selection is a view/filter, optionally with exclude_object_sids). Exactly one scope form: XOR with view_sid/filter - both or neither → 422.
    - `view_sid` string, nullable: Saved view (pt_vw_…) - its filter AST is snapshotted into the run at create; later view edits do not retarget. Combinable with filter; XOR with object_sids.
    - `exclude_object_sids` string[], nullable: Rows of the view/filter form to leave out (select all minus the unticked rows), at most 10 000; never with object_sids.
    - `filter` union: Ad-hoc filter AST over the tab (§4.18 atoms, depth <= 5); stored resolved. Combinable with view_sid; XOR with object_sids. An empty/match-all filter form is rejected.
      - 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
            - string
            - number
            - boolean
          - `ne` union
            - string
            - number
            - boolean
          - `in` union[]
            - union
              - …
          - `nin` union[]
            - union
              - …
          - `gt` union
            - number
            - string
          - `gte` union
            - number
            - string
          - `lt` union
            - number
            - string
          - `lte` union
            - number
            - string
          - `is_null` boolean
          - `contains` string
          - `not_contains` string
          - `contains_any` string[]
          - `not_contains_any` string[]
          - `starts_with` string
      - unknown
  - `force_rerun` boolean: Default false - count done cells as re-runnable (they would be re-charged).
  - `cells` 'not_run' | 'error': Price only the cells that have not run (not_run) or only the error cells (error); the same selection as params.cells on create.

## Response `200`

`action` success envelope.

- EstimatePlaytableRunResponse
  - `success` true, required
  - `operation` 'action', required
  - `action` string, required: kebab-case verb; matches the route segment.
  - `item` unknown, required
  - `result` object, required
    - `rows_matched` number, required: Scope size (ES count; approximate by design - the worker re-checks per cell).
    - `cost_min` number, required: Credits if every row succeeds on the cheapest step.
    - `cost_max` number, required: Credits if every row walks the full waterfall at max prices.
    - `cost_expected` number, required: Registry expected-price path × rows_to_run.
    - `currency` 'credits', required
    - `priced_at` string, required: ISO 8601 UTC - registry price snapshot time.
    - `fields` object[], required: Per-field, per-step breakdown.
      - `playtable_field_sid` string, required
      - `rows_to_run` number, required: Rows the run would actually enqueue (run_condition prefilter; skips done unless force_rerun, narrowed by cells).
      - `cost_min` number, required
      - `cost_max` number, required
      - `cost_expected` number, required
      - `steps` object[], required: Materialized waterfall with the registry price range per step.
        - `tool_sid` string, required: gtm-api tool at this waterfall step (external sid).
        - `price_min` number, required: Registry min price per row, credits.
        - `price_max` number, required: Registry max price per row, credits.
  - `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)
