# Lifecycle

URL: /business/nouns/lifecycle · Id: `noun:lifecycle`

> A Lifecycle is the states a Thing of one Noun moves through and the Verbs that move it between them.

A Lifecycle is the states a [Thing](/business/nouns/thing) of one [Noun](/business/nouns/noun) moves through and the [Verbs](/business/nouns/verb) that move it between them.

## Properties
| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `states` | `string[]` | Yes | The states, in order. |
| `initial` | `string` | Yes | The state a new Thing starts in. |

## Object
```json
{
  "$id": "https://api.sb/quietcopy.com/lifecycles/lifecycle_1",
  "$type": "Lifecycle",
  "states": [
    "Example states"
  ],
  "initial": "Example initial"
}
```

## Relationships
- <a id="rel-governs"></a>A Lifecycle **governs** one [Noun](/business/nouns/noun): a [Noun](/business/nouns/noun)’s Lifecycle lists the states its [Things](/business/nouns/thing) move through and the [Verbs](/business/nouns/verb) that move them. `governs`, inverse [`movesThrough`](/business/nouns/noun#rel-moves-through).

## Verbs
| Verb | Description | Subject | Event | Class |
| --- | --- | --- | --- | --- |
| <a id="get"></a>[Lifecycle.get](/business/nouns/lifecycle/get) | Returns one Lifecycle by id. Inherited from [Noun](/business/nouns/noun). | None. | None. | Read: `try`, `do` |
| <a id="list"></a>[Lifecycle.list](/business/nouns/lifecycle/list) | Returns Lifecycles, newest first, one page at a time. Inherited from [Noun](/business/nouns/noun). | None. | None. | Read: `try`, `do` |
| <a id="update"></a>[Lifecycle.update](/business/nouns/lifecycle/update) | Changes the given properties of a Lifecycle. Inherited from [Noun](/business/nouns/noun). | None. | `Lifecycle.updated` | Two-way: `try`, `send`, `do` |

## Permissions
Which Access level may call each Verb. One-way Verbs wait their delay window.

| Operation | `owner` | `admin` | `member` | `viewer` |
| --- | --- | --- | --- | --- |
| `Lifecycle.get` | Yes | Yes | Yes | Yes |
| `Lifecycle.list` | Yes | Yes | Yes | Yes |
| `Lifecycle.update` | Yes | Yes | Yes | No |

## Call it

**Ask**

```text
Show me the latest lifecycle.
```

**API**

```bash
curl https://api.sb/petpantry.shop/lifecycles/lifecycle_1 \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"
```

```json
{
  "api": "https://api.sb/petpantry.shop",
  "$type": "Lifecycle",
  "$id": "https://api.sb/petpantry.shop/lifecycles/lifecycle_1",
  "lifecycle": {
    "$id": "https://api.sb/petpantry.shop/lifecycles/lifecycle_1",
    "$type": "Lifecycle",
    "states": [
      "Example states"
    ],
    "initial": "Example initial"
  },
  "links": {
    "self": "https://api.sb/petpantry.shop/lifecycles/lifecycle_1",
    "up": "https://api.sb/petpantry.shop/lifecycles"
  }
}
```

**SDK**

```ts
import { $ } from 'startup-builder'

const lifecycle = await $.Lifecycle.get({ id: 'lifecycle_1' })
```

**CLI**

```bash
npx startup-builder do Lifecycle.get --json '{"id":"lifecycle_1"}'
```

**MCP**

```json
{
  "name": "do",
  "arguments": {
    "code": "return await $.Lifecycle.get({ id: 'lifecycle_1' })"
  }
}
```

## Example
The [Order](/business/nouns/order) Lifecycle runs placed, paid, fulfilled, closed. The Verb `pay` moves an Order from placed to paid.