> For the complete documentation index, see [llms.txt](https://docs.360dialog.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.360dialog.com/docs/mba/api-ref/budget/replace-the-agent-budgets.md).

# Replace the agent budgets

Replace the full set of budgets for the agent. The request describes the complete desired state, so any budget left out is removed, and an empty budgets array clears every budget and returns the agent to unlimited usage. To change an existing budget, pass back the budget\_id that was returned for it; the budget is updated in place and keeps its id. Omit budget\_id to add a new budget and have an id assigned.

```json
{"openapi":"3.1.0","info":{"title":"Business Agent API","version":"1.50.0"},"tags":[{"name":"Budget","description":"Endpoints for managing the agent's usage budgets"}],"servers":[{"description":"Production server","url":"https://waba-v2.360dialog.io"}],"security":[{"D360-API-KEY":[]}],"components":{"securitySchemes":{"D360-API-KEY":{"description":"API Key for Messaging API authentication. Send your API key in the D360-API-KEY header.","in":"header","name":"D360-API-KEY","type":"apiKey"}},"schemas":{"budget.AgentBudgetRequest":{"description":"Replace the full set of budgets for the agent","properties":{"budgets":{"description":"The complete set of budgets for the agent. This replaces any budgets already configured, so any left out are removed, and an empty array clears them all and returns the agent to unlimited usage. A given unit type and time window pair may only appear once","items":{"$ref":"#/components/schemas/budget.AgentBudgetRequestItem"},"type":"array","uniqueItems":false}},"required":["budgets"],"type":"object"},"budget.AgentBudgetRequestItem":{"description":"A single budget to configure for the agent","properties":{"budget_id":{"description":"Stable identifier of the budget. For an existing budget, pass the id the server returned when it was created to edit or preserve it. For a new budget, leave it empty; the server assigns one","type":"string"},"max_budget":{"description":"The maximum allowed usage, in the given unit, within the time window. Must be a positive whole number","minimum":1,"type":"integer"},"time_window":{"description":"The rolling period usage is totalled over, measured in the timezone of the WhatsApp Business Account","enum":["one_day","seven_days","fourteen_days","thirty_days"],"type":"string"},"unit_type":{"description":"What the budget measures: token usage or AI agent turns","enum":["token","ai_turn"],"type":"string"}},"required":["max_budget","time_window","unit_type"],"type":"object"},"budget.AgentBudgetResponse":{"description":"The budgets configured for the agent","properties":{"budgets":{"description":"The budgets configured for the agent. When more than one is set, whichever is reached first takes effect. An empty array means no cap is set and usage is unlimited","items":{"$ref":"#/components/schemas/budget.AgentBudgetResponseItem"},"type":"array","uniqueItems":false}},"required":["budgets"],"type":"object"},"budget.AgentBudgetResponseItem":{"description":"A single budget configured for the agent","properties":{"budget_id":{"description":"Stable identifier for this budget. Pass it back on a subsequent set request to edit or preserve this budget","type":"string"},"max_budget":{"description":"The maximum allowed usage, in the given unit, within the time window","type":"integer"},"time_window":{"description":"The rolling period usage is totalled over, measured in the timezone of the WhatsApp Business Account","enum":["one_day","seven_days","fourteen_days","thirty_days"],"type":"string"},"unit_type":{"description":"What the budget measures: token usage or AI agent turns","enum":["token","ai_turn"],"type":"string"}},"required":["budget_id","max_budget","time_window","unit_type"],"type":"object"},"budget.StandardError":{"description":"Standard error response for Meta Business Agent endpoints","properties":{"detail":{"description":"Human-readable explanation of the error","type":"string"},"status":{"description":"HTTP status code","type":"integer"},"title":{"description":"Short, human-readable summary of the problem","type":"string"},"type":{"description":"A URI reference identifying the problem type","type":"string"}},"type":"object"}}},"paths":{"/agent_budget/{entity_id}":{"post":{"description":"Replace the full set of budgets for the agent. The request describes the complete desired state, so any budget left out is removed, and an empty budgets array clears every budget and returns the agent to unlimited usage. To change an existing budget, pass back the budget_id that was returned for it; the budget is updated in place and keeps its id. Omit budget_id to add a new budget and have an id assigned.","operationId":"post-agent-budget","parameters":[{"description":"Meta Business Agent API version","in":"header","name":"X-API-Version","schema":{"enum":["2.0.0"],"type":"string"}},{"description":"The ID of the entity that owns the agent - the Business Manager ID","in":"path","name":"entity_id","required":true,"schema":{"type":"integer"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/budget.AgentBudgetRequest","summary":"requestBody","description":"The complete set of budgets for the agent"}}},"description":"The complete set of budgets for the agent","required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/budget.AgentBudgetResponse"}}},"description":"The budgets configured for the agent after the update"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/budget.StandardError"}}},"description":"Bad request"},"401":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/budget.StandardError"}}},"description":"Unauthorized"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/budget.StandardError"}}},"description":"Forbidden"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/budget.StandardError"}}},"description":"Not found"},"429":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/budget.StandardError"}}},"description":"Too many requests"},"500":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/budget.StandardError"}}},"description":"Server error"}},"summary":"Replace the agent budgets","tags":["Budget"]}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.360dialog.com/docs/mba/api-ref/budget/replace-the-agent-budgets.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
