# Estimate Pipeline Run

`POST /v1/runs/estimate`

The most a run of a template billed per run may cost: what submit
would reserve, by the same computation, with its quote. It starts and
reserves nothing; dataset fields are prepared as submit prepares them.

- Base URL: `https://junction-api.qualiastudios.dev`
- Authentication: an API key in the `X-API-Key` header, or `Authorization: Bearer …`

## Request body

Required: `application/json` `RunEstimateRequest`

## Responses

- `200` Successful Response: `application/json` `RunEstimateResponse`
- `401` Invalid or missing API key: `application/json` `ErrorResponse`
- `403` Missing capability on the workspace: `application/json` `ErrorResponse`
- `422` Not billed per run, or the run cannot be bounded

## Schemas

```yaml
RunEstimateRequest:
  properties:
    pipeline_template_id:
      type: string
      format: uuid
    project_id:
      type: string
      format: uuid
    values:
      additionalProperties: true
      type: object
    name:
      maxLength: 255
      type:
        - string
        - "null"
    max_cost:
      minimum: 1
      type:
        - integer
        - "null"
    sample_cap:
      minimum: 1
      type:
        - integer
        - "null"
  additionalProperties: false
  type: object
  required:
    - pipeline_template_id
    - project_id
  title: RunEstimateRequest
RunEstimateResponse:
  properties:
    credits:
      type: integer
    max_cost:
      type:
        - integer
        - "null"
    sample_cap:
      type:
        - integer
        - "null"
    fits:
      type: boolean
    pricing_revision:
      type: string
    quote_digest:
      type: string
    nodes:
      additionalProperties:
        type: integer
      type: object
  type: object
  required:
    - credits
    - fits
    - pricing_revision
    - quote_digest
  title: RunEstimateResponse
  description: |-
    The most a run may cost, reserved in full at submit; usage is charged
    and the rest refunded when it ends. Never the final charge.
ErrorResponse:
  properties:
    detail:
      type: string
      description: Error message describing what went wrong
  type: object
  required:
    - detail
  title: ErrorResponse
  description: Standard error response.
```
