# Startup Template routes: extend, promote, upgrade

URL: /code/api/startup-template/verbs · Id: `page:code/api/startup-template/verbs`

> The Startup Template Verbs extend, promote, upgrade as api.sb routes, with inputs, result, refusals and an example.

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

### StartupTemplate.extend
Extend adds a Startup Template to a Startup’s bases, pinned to a Version, so the Startup inherits its definition. [Verb page](/business/nouns/startup-template/extend?interface=api).

```text
POST /{namespace}/startup-templates/{startupTemplate}/extend
```

Path: `startupTemplate`. Body, as JSON: the other inputs. Emits [`StartupTemplate.extended`](/business/events/StartupTemplate.extended).

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `startupTemplate` | [Startup Template](/business/nouns/startup-template) | Yes | The Startup Template to inherit. |
| `startup` | [Startup](/business/nouns/startup) | Yes | The Startup that extends it. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `startup` | [Startup](/business/nouns/startup) | Yes | The Startup, with the Startup Template among its bases. |
| `startupTemplate` | [Startup Template](/business/nouns/startup-template) | Yes | The Startup Template extended. |

**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. |
| A clash between two bases until the Startup settles it | [`refused`](/code/api/errors/refused) | Clear what the check names, then call it again. | None. |

**Example**

```bash
curl -X POST https://api.sb/leaseline.app/startup-templates/stpl_9OivLWR17L/extend \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"startup":"startup_l3hr1EnUGY"}'
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "startup": {
    "$id": "https://api.sb/leaseline.app/startups/startup_l3hr1EnUGY",
    "$type": "Startup",
    "name": "Leaseline"
  },
  "startupTemplate": {
    "$id": "https://api.sb/leaseline.app/startup-templates/stpl_9OivLWR17L",
    "$type": "StartupTemplate",
    "slug": "leaseline",
    "operatingModel": "autonomous",
    "motions": [
      "Example motions"
    ]
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "StartupTemplate.extend",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```

### StartupTemplate.promote
Promote moves one Startup’s refinement into a Startup Template, so every Startup that extends it inherits the refinement. [Verb page](/business/nouns/startup-template/promote?interface=api).

```text
POST /{namespace}/startup-templates/{startupTemplate}/promote
```

Path: `startupTemplate`. Body, as JSON: the other inputs. Emits [`StartupTemplate.promoted`](/business/events/StartupTemplate.promoted).

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `startupTemplate` | [Startup Template](/business/nouns/startup-template) | Yes | The Startup Template that receives the refinement. |
| `startup` | [Startup](/business/nouns/startup) | Yes | The Startup that holds the refinement. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `change` | [Change](/business/nouns/change) | Yes | The Change against the Startup Template. |
| `startupTemplate` | [Startup Template](/business/nouns/startup-template) | Yes | The Startup Template that received the refinement. |

**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 POST https://api.sb/leaseline.app/startup-templates/stpl_9OivLWR17L/promote \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"startup":"startup_l3hr1EnUGY"}'
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "change": {
    "$id": "https://api.sb/leaseline.app/changes/change_3Ex8uVSOyQ",
    "$type": "Change",
    "status": "Open",
    "base": "version_4HTEMs14G4"
  },
  "startupTemplate": {
    "$id": "https://api.sb/leaseline.app/startup-templates/stpl_9OivLWR17L",
    "$type": "StartupTemplate",
    "slug": "leaseline",
    "operatingModel": "autonomous",
    "motions": [
      "Example motions"
    ]
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "StartupTemplate.promote",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```

### StartupTemplate.upgrade
Upgrade moves a Startup to a newer Version of a Startup Template it extends, through a Change it can review. [Verb page](/business/nouns/startup-template/upgrade?interface=api).

```text
POST /{namespace}/startup-templates/{startupTemplate}/upgrade
```

Path: `startupTemplate`. Body, as JSON: the other inputs. Emits [`StartupTemplate.upgraded`](/business/events/StartupTemplate.upgraded).

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `startupTemplate` | [Startup Template](/business/nouns/startup-template) | Yes | The Startup Template to upgrade. |
| `startup` | [Startup](/business/nouns/startup) | Yes | The Startup that extends it. |
| `version` | [Version](/business/nouns/version) | No | The target Version; the latest when absent. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `change` | [Change](/business/nouns/change) | Yes | The Change that moves the pin, with its three-way diff. |
| `startupTemplate` | [Startup Template](/business/nouns/startup-template) | Yes | The Startup Template upgraded to. |

**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 POST https://api.sb/leaseline.app/startup-templates/stpl_9OivLWR17L/upgrade \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"startup":"startup_l3hr1EnUGY"}'
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "change": {
    "$id": "https://api.sb/leaseline.app/changes/change_3Ex8uVSOyQ",
    "$type": "Change",
    "status": "Open",
    "base": "version_4HTEMs14G4"
  },
  "startupTemplate": {
    "$id": "https://api.sb/leaseline.app/startup-templates/stpl_9OivLWR17L",
    "$type": "StartupTemplate",
    "slug": "leaseline",
    "operatingModel": "autonomous",
    "motions": [
      "Example motions"
    ]
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "StartupTemplate.upgrade",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```