# Watch routes: update, delete

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

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

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

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

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

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

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes | The id of the Watch. |
| `selector` | `string` | No | The Event selector, such as `Order.placed`. |
| `url` | `url` | No | Where deliveries go. |
| `payload` | `string` | No | One of `full`, or `thin`: the record as the Action left it, or only its versioned address. The default is full. |

**Returns**

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

**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/watches/watch_9o4vCuR17L \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://leaseline.app"}'
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "watch": {
    "$id": "https://api.sb/leaseline.app/watches/watch_9o4vCuR17L",
    "$type": "Watch",
    "selector": "Example selector",
    "url": "https://leaseline.app"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Watch.update",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```

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

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

Path: `id`. Emits `Watch.deleted`.

**Inputs**

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

**Returns**

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

**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/watches/watch_9o4vCuR17L \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "watch": {
    "$id": "https://api.sb/leaseline.app/watches/watch_9o4vCuR17L",
    "$type": "Watch",
    "selector": "Example selector",
    "url": "https://leaseline.app"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Watch.delete",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```