# Demand Budget routes: update

URL: /code/api/demand-budget/records-update · Id: `page:code/api/demand-budget/records-update`

> The Demand Budget Verbs update as api.sb routes, with inputs, result, refusals and an example.

Reference for [Demand Budget](/business/nouns/demand-budget), one group of [Demand Budget routes](/code/api/demand-budget).

### DemandBudget.update
Changes the given properties of a Demand Budget. [Verb page](/business/nouns/demand-budget/update?interface=api).

```text
PATCH /{namespace}/demand-budgets/{id}
```

Path: `id`. Body, as JSON: the other inputs. Emits `DemandBudget.updated`.

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes | The id of the Demand Budget. |
| `amount` | `money` | No | The monthly spend it funds; zero is the default. |
| `tier` | `string` | No | One of `$0`, `$100`, `$1k`, `$10k` or `$100k`: the highest tier at or below the amount, whose Play mix it buys. |
| `target` | `string` | No | The Metric value the spend must reach, such as cost per first Order under $40. |
| `stopRule` | `string` | No | The reading that closes the budget, such as acquisition cost above margin for two weeks. |
| `until` | `date` | No | The last day the budget runs before its Decision is read. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `demandBudget` | [Demand Budget](/business/nouns/demand-budget) | Yes | The Demand Budget. |

**Refuses when**

| Check | Error | Fix | Then call |
| --- | --- | --- | --- |
| The key is valid, but its scopes do not allow this operation. | [`forbidden`](/code/api/errors/forbidden) | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | None. |

**Example**

```bash
curl -X PATCH https://api.sb/leaseline.app/demand-budgets/demand_zQZUG08LwY \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"amount":{"amount":29,"currency":"USD"}}'
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "demandBudget": {
    "$id": "https://api.sb/leaseline.app/demand-budgets/demand_zQZUG08LwY",
    "$type": "DemandBudget",
    "amount": {
      "amount": 29,
      "currency": "USD"
    },
    "tier": "$0",
    "target": "Example target",
    "stopRule": "Example stop rule"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "DemandBudget.update",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```