# updateBudget

```graphql
mutation UpdateBudget($budgetId: ID!, $input: UpdateBudgetInput!) {
  updateBudget(budgetId: $budgetId, input: $input) {
    id
    scope {
      kind
      projectId
      userId
      apiKeyId
    }
    monthlyLimitCredits
    monthlyLimitUsd
    status {
      used
      remaining
      resetsAt
    }
    createdAt
    updatedAt
  }
}
```

Change the monthly limit of a budget, keeping its scope and this month’s usage.

## Arguments

| Name                        | Type               | Required | Description                                                                                                                                                    |
| --------------------------- | ------------------ | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `budgetId`                  | ID!                | Yes      | Budget ID. A budget you cannot manage is masked as missing and fails with resource-not-found (404).                                                            |
| `input`                     | UpdateBudgetInput! | Yes      |                                                                                                                                                                |
| `input.monthlyLimitCredits` | Float!             | Yes      | New monthly AI spending limit in credits. Usage already recorded this month is retained; if the new limit is below it, the next call in the scope is rejected. |

## Variables

```json
{
  "budgetId": "string",
  "input": {
    "monthlyLimitCredits": 500
  }
}
```

## Responses

| Status | Description                       |
| ------ | --------------------------------- |
| 200    | The Budget! in data.updateBudget. |

## Call it

```bash
curl -X POST "https://api.veryfront.com/graphql" \
  -H "Authorization: Bearer $VERYFRONT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "query": "mutation UpdateBudget($budgetId: ID!, $input: UpdateBudgetInput!) {\n  updateBudget(budgetId: $budgetId, input: $input) {\n    id\n    scope {\n      kind\n      projectId\n      userId\n      apiKeyId\n    }\n    monthlyLimitCredits\n    monthlyLimitUsd\n    status {\n      used\n      remaining\n      resetsAt\n    }\n    createdAt\n    updatedAt\n  }\n}",
  "variables": {
    "budgetId": "string",
    "input": {
      "monthlyLimitCredits": 500
    }
  }
}'
```

## Example response

```json
{
  "data": {
    "updateBudget": {
      "id": "string",
      "scope": {
        "kind": "string",
        "projectId": "string",
        "userId": "string",
        "apiKeyId": "string"
      },
      "monthlyLimitCredits": 0,
      "monthlyLimitUsd": 0,
      "status": {
        "used": 0,
        "remaining": 0,
        "resetsAt": "string"
      },
      "createdAt": "string",
      "updatedAt": "string"
    }
  }
}
```
