---
title: "Estimate a task's cost before creating it"
url: https://hexelstudio.com/docs/api/harness/estimates/tasks-estimate
---

# Estimate a task's cost before creating it

**POST** `/harness/tasks:estimate`

200 also when billing would refuse it (`admitted: false`, `refusal`). `503 estimate_unavailable`.

## Headers

- `Authorization: string`

  `Bearer <token>`. A Hexel Studio access token for your organization.

- `X-Workspace-Id: string`

  The workspace the request acts in (`ws_...`). It never grants access by itself.

- `X-Environment-Id: string`

  The environment the request acts in (`env_...`). It never grants access by itself.

## Body parameters

- `agent: string`

- `budget: optional Budget`

  What a task may spend; it narrows the agent's own budgets. `max_estimate_usd` is accepted on create only.

  - `max_usd: optional number`

  - `max_steps: optional integer`

  - `max_tokens: optional integer`

  - `max_wall_clock_s: optional number`

  - `max_estimate_usd: optional number`

## Returns

`200` The estimate. (`Estimate`)

- `admitted: boolean`

- `decision_id: optional string`

- `floor_usd: optional number`

- `max_estimate_usd: optional number`

- `members: integer`

- `meter: string`

- `parts: optional array of EstimatePart`

  - `agent: string`

  - `members: integer`

  - `per_member_usd: number`

  - `source: string`

  - `usd: number`

- `per_member_usd: number`

- `quantity: integer`

- `reasons: optional array of string`

- `refusal: optional string`

- `source: string`

- `usd: number`

- `within_budget: boolean`

## Errors

- `default` 

## Example

```bash
curl --request POST \
  --url 'https://api.hexelstudio.com/v1/harness/tasks:estimate' \
  --header "Authorization: Bearer $ACCESS_TOKEN" \
  --header 'X-Workspace-Id: X_WORKSPACE_ID' \
  --header 'X-Environment-Id: X_ENVIRONMENT_ID' \
  --header 'Content-Type: application/json' \
  --data '{
  "agent": "string",
  "budget": {
    "max_usd": 0,
    "max_steps": 0,
    "max_tokens": 0,
    "max_wall_clock_s": 0,
    "max_estimate_usd": 0
  }
}'
```

### Response (200)

```json
{
  "admitted": true,
  "decision_id": "string",
  "floor_usd": 0,
  "max_estimate_usd": 0,
  "members": 0,
  "meter": "string",
  "parts": [
    {
      "agent": "string",
      "members": 0,
      "per_member_usd": 0,
      "source": "string",
      "usd": 0
    }
  ],
  "per_member_usd": 0,
  "quantity": 0,
  "reasons": [
    "string"
  ],
  "refusal": "string",
  "source": "string",
  "usd": 0,
  "within_budget": true
}
```
