# Product Template routes: update, delete

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

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

Reference for [Product Template](/business/nouns/product-template), one group of [Product Template routes](/code/api/product-template).

### ProductTemplate.update
Changes the given properties of a Product Template. [Verb page](/business/nouns/product-template/update?interface=api).

```text
PATCH /{namespace}/product-templates/{id}
```

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

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes | The id of the Product Template. |
| `slug` | `string` | No | The page path under `/start/templates/products`. |
| `kind` | `string` | No | The abstract Product: `data`, `software`, `agent`, or `service`. |
| `supply` | `string` | No | Who supplies the work: `digital`, which is unlimited, or `human`, which is recruited and credentialed. |
| `worker` | `string` | No | Who does the work: `agents`, `humans`, or `agents-and-humans`. |
| `buyer` | `string` | No | Who buys: `human`, `agent`, or `human-or-agent`. |
| `earningModel` | `string` | No | How it earns: `subscription`, `usage`, `commerce`, `marketplace`, or `directory`. |
| `assurance` | `text` | No | What the buyer can rely on, in one sentence. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `productTemplate` | [Product Template](/business/nouns/product-template) | Yes | The Product Template. |

**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/product-templates/ptpl_mLTPhHFQYD \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"slug":"leaseline"}'
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "productTemplate": {
    "$id": "https://api.sb/leaseline.app/product-templates/ptpl_mLTPhHFQYD",
    "$type": "ProductTemplate",
    "slug": "leaseline",
    "kind": "data",
    "supply": "Example supply",
    "worker": "agents"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "ProductTemplate.update",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```

### ProductTemplate.delete
Deletes a Product Template: a soft delete that keeps its history, undone by `Thing.restore`. [Verb page](/business/nouns/product-template/delete?interface=api).

```text
DELETE /{namespace}/product-templates/{id}
```

Path: `id`. Emits `ProductTemplate.deleted`.

**Inputs**

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

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `productTemplate` | [Product Template](/business/nouns/product-template) | Yes | The Product Template. |

**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/product-templates/ptpl_mLTPhHFQYD \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "productTemplate": {
    "$id": "https://api.sb/leaseline.app/product-templates/ptpl_mLTPhHFQYD",
    "$type": "ProductTemplate",
    "slug": "leaseline",
    "kind": "data",
    "supply": "Example supply",
    "worker": "agents"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "ProductTemplate.delete",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```