# Contact routes: update, delete

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

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

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

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

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

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

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes | The id of the Contact. |
| `email` | `email` | No | The primary email address. |
| `phone` | `string` | No | The primary phone number. |
| `name` | `string` | No | The name the Contact goes by. |

**Returns**

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

**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/contacts/contact_WsrosCQi6J \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"email":"dana@leaseline.app"}'
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "contact": {
    "$id": "https://api.sb/leaseline.app/contacts/contact_WsrosCQi6J",
    "$type": "Contact",
    "email": "dana@leaseline.app",
    "phone": "Example phone"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Contact.update",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```

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

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

Path: `id`. Emits `Contact.deleted`.

**Inputs**

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

**Returns**

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

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

```json
{
  "api": "https://api.sb/leaseline.app",
  "contact": {
    "$id": "https://api.sb/leaseline.app/contacts/contact_WsrosCQi6J",
    "$type": "Contact",
    "email": "marcus@riversideproperty.com",
    "phone": "Example phone"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Contact.delete",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```