---
search:
  tags:
    - agent-sessions
    - PUT
seo:
  description: >-
    Update agent spend cap. Reference for the PUT
    /workspaces/{organizationId}/agent/spend-caps/{agentId} endpoint in the Pile
    API.
sidebar:
  label: Update agent spend cap
  badge: PUT
title: Update agent spend cap
type: openapi-operation
---
`PUT /workspaces/{organizationId}/agent/spend-caps/{agentId}`

**Request body** (`application/json`)

- `maxRunsPerDay` (integer | null)
- `maxRunsPerMonth` (integer | null)
- `maxTokensPerDay` (integer | null)
- `maxTokensPerMonth` (integer | null)
- `maxCostMicrosPerDay` (integer | null)
- `maxCostMicrosPerMonth` (integer | null)
- `maxTokensPerRun` (integer | null)
- `maxCostMicrosPerRun` (integer | null)

Request body example:

```json
{
  "maxRunsPerDay": 1,
  "maxRunsPerMonth": 1,
  "maxTokensPerDay": 0,
  "maxTokensPerMonth": 0,
  "maxCostMicrosPerDay": 0,
  "maxCostMicrosPerMonth": 0,
  "maxTokensPerRun": 0,
  "maxCostMicrosPerRun": 0
}
```

**Responses**

- `200` — Spend caps upserted for the agent type — null fields clear a limit; omitted fields keep their value

Response example, 200:

```json
{
  "id": "string",
  "organizationId": "string",
  "agentId": "string",
  "maxRunsPerDay": 0,
  "maxRunsPerMonth": 0,
  "maxTokensPerDay": 0,
  "maxTokensPerMonth": 0,
  "maxCostMicrosPerDay": 0,
  "maxCostMicrosPerMonth": 0,
  "maxTokensPerRun": 0,
  "maxCostMicrosPerRun": 0,
  "lastCapAlertAt": "string",
  "createdBy": "string",
  "createdAt": "string",
  "updatedAt": "string"
}
```
