# Limit routes: update, delete

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

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

Reference for [Limit](/business/nouns/limit), one group of [Limit routes](/code/api/limit).

### Limit.update
Changes the given properties of a Limit. [Verb page](/business/nouns/limit/update?interface=api).

```text
PATCH /{namespace}/limits/{id}
```

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

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes | The id of the Limit. |
| `amount` | `money` | No | The most money it allows. |
| `count` | `integer` | No | The most calls or units it allows. |
| `period` | `string` | No | The window a rate resets over, such as a month. |
| `percent` | `number` | No | The largest share off a reference amount it allows, such as 15 percent off list Price. |
| `resets` | `string` | No | One of `calendar`, `rolling`: a calendar Limit resets at the start of each period, a rolling one counts the last period from now. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `limit` | [Limit](/business/nouns/limit) | Yes | The Limit. |

**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/limits/limit_UWHXYVKsJB \
  -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",
  "limit": {
    "$id": "https://api.sb/leaseline.app/limits/limit_UWHXYVKsJB",
    "$type": "Limit",
    "amount": {
      "amount": 29,
      "currency": "USD"
    },
    "count": 1
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Limit.update",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```

### Limit.delete
Deletes a Limit: a soft delete that keeps its history, undone by `Thing.restore`. [Verb page](/business/nouns/limit/delete?interface=api).

```text
DELETE /{namespace}/limits/{id}
```

Path: `id`. Emits `Limit.deleted`.

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes | The id of the Limit. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `limit` | [Limit](/business/nouns/limit) | Yes | The Limit. |

**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 DELETE https://api.sb/leaseline.app/limits/limit_UWHXYVKsJB \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "limit": {
    "$id": "https://api.sb/leaseline.app/limits/limit_UWHXYVKsJB",
    "$type": "Limit",
    "amount": {
      "amount": 29,
      "currency": "USD"
    },
    "count": 1
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Limit.delete",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```