# Startup routes: advance, build, graduate

URL: /code/api/startup/lifecycle · Id: `page:code/api/startup/lifecycle`

> The Startup Verbs advance, build, graduate as api.sb routes, with inputs, result, refusals and an example.

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

### Startup.advance
Advance moves a Startup to its next Lifecycle state once every entry check of that state passes. [Verb page](/business/nouns/startup/advance?interface=api).

```text
POST /{namespace}/startups/{startup}/advance
```

Path: `startup`. Body, as JSON: the other inputs. Emits [`Startup.advanced`](/business/events/Startup.advanced).

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `startup` | [Startup](/business/nouns/startup) | Yes | The Startup to advance. |
| `to` | `string` | No | The target state. Defaults to the next state. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `startup` | [Startup](/business/nouns/startup) | Yes | The Startup in its new state. |

**Refuses when**

| Check | Error | Fix | Then call |
| --- | --- | --- | --- |
| Any entry check of the target [Lifecycle](/business/nouns/lifecycle) state | [`refused`](/code/api/errors/refused) | Pass each check the error names, then call it again. | None. |
| 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/startups/startup_l3hr1EnUGY/advance \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "startup": {
    "$id": "https://api.sb/leaseline.app/startups/startup_l3hr1EnUGY",
    "$type": "Startup",
    "name": "Leaseline"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Startup.advance",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```

### Startup.build
Build provisions the Systems, Sites and Interfaces a Startup’s definition declares, and moves the Startup to Building. [Verb page](/business/nouns/startup/build?interface=api).

```text
POST /{namespace}/startups/{startup}/build
```

Path: `startup`. Emits [`Startup.built`](/business/events/Startup.built).

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `startup` | [Startup](/business/nouns/startup) | Yes | The Startup to build. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `startup` | [Startup](/business/nouns/startup) | Yes | The Startup, now Building. |

**Refuses when**

| Check | Error | Fix | Then call |
| --- | --- | --- | --- |
| Template chosen (`building-template`) | [`refused`](/code/api/errors/refused) | Name a Startup Template in the definition. | [Startup.update](/business/nouns/startup/update) |
| Problem stated (`building-problem`) | [`refused`](/code/api/errors/refused) | Write the problem slot with its workarounds and why now. | [Hypothesis.create](/business/nouns/hypothesis/create) |
| Brand named (`building-brand`) | [`refused`](/code/api/errors/refused) | Give the Brand a name, a voice, a logo, and a theme. | [Brand.update](/business/nouns/brand/update) |
| Products declared (`building-products`) | [`refused`](/code/api/errors/refused) | Set the kind of every Product. | [Product.update](/business/nouns/product/update) |
| Three slots at Commitment (`building-slots`) | [`refused`](/code/api/errors/refused) | Run the cheapest test on each slot below Commitment, such as a reserve deposit. | [Experiment.start](/business/nouns/experiment/start) |
| 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/startups/startup_l3hr1EnUGY/build \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "startup": {
    "$id": "https://api.sb/leaseline.app/startups/startup_l3hr1EnUGY",
    "$type": "Startup",
    "name": "Leaseline"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Startup.build",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```

### Startup.graduate
Graduate moves a Startup to a Company of its own, with its Customers, Domains and records intact. [Verb page](/business/nouns/startup/graduate?interface=api).

```text
POST /{namespace}/startups/{startup}/graduate
```

Path: `startup`. Body, as JSON: the other inputs. Emits [`Startup.graduated`](/business/events/Startup.graduated).

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `startup` | [Startup](/business/nouns/startup) | Yes | The Startup to graduate. |
| `company` | [Company](/business/nouns/company) | Yes | The Company that holds it next. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `startup` | [Startup](/business/nouns/startup) | Yes | The Startup, held by its new Company. |

**Refuses when**

| Check | Error | Fix | Then call |
| --- | --- | --- | --- |
| Company of its own (`graduate-company`) | [`refused`](/code/api/errors/refused) | A company of its own holds the Startup, with its Brand, Customers, and records moved intact. | None. |
| 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/startups/startup_l3hr1EnUGY/graduate \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"company":"company_28zYNZEno0"}'
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "startup": {
    "$id": "https://api.sb/leaseline.app/startups/startup_l3hr1EnUGY",
    "$type": "Startup",
    "name": "Leaseline"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Startup.graduate",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```