# Supplier routes: update, delete

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

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

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

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

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

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

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes | The id of the Supplier. |
| `name` | `string` | No | The legal or personal name. |
| `payoutAccount` | `string` | No | Where payouts land, held through Stripe. |

**Returns**

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

**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/tutorloop.com/suppliers/supplier_QTsIMiLqO4 \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"payoutAccount":"Example payout account"}'
```

```json
{
  "api": "https://api.sb/tutorloop.com",
  "supplier": {
    "$id": "https://api.sb/tutorloop.com/suppliers/supplier_QTsIMiLqO4",
    "$type": "Supplier",
    "name": "TutorLoop",
    "status": "recruited",
    "payoutAccount": "Example payout account"
  },
  "action": {
    "$id": "https://api.sb/tutorloop.com/actions/act_DEVhiF6mF5",
    "operation": "Supplier.update",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/tutorloop.com/actions/act_DEVhiF6mF5"
  }
}
```

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

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

Path: `id`. Emits `Supplier.deleted`.

**Inputs**

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

**Returns**

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

**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/tutorloop.com/suppliers/supplier_QTsIMiLqO4 \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"
```

```json
{
  "api": "https://api.sb/tutorloop.com",
  "supplier": {
    "$id": "https://api.sb/tutorloop.com/suppliers/supplier_QTsIMiLqO4",
    "$type": "Supplier",
    "name": "TutorLoop",
    "status": "recruited"
  },
  "action": {
    "$id": "https://api.sb/tutorloop.com/actions/act_DEVhiF6mF5",
    "operation": "Supplier.delete",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/tutorloop.com/actions/act_DEVhiF6mF5"
  }
}
```