# Play routes: apply

URL: /code/api/play/verbs · Id: `page:code/api/play/verbs`

> The Play Verbs apply as api.sb routes, with inputs, result, refusals and an example.

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

### Play.apply
Apply runs a Play across a Portfolio cohort, one wave at a time, measured as an Experiment. [Verb page](/business/nouns/play/apply?interface=api).

```text
POST /{namespace}/plays/{play}/apply
```

Path: `play`. Body, as JSON: the other inputs. Emits [`Play.applied`](/business/events/Play.applied).

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `play` | [Play](/business/nouns/play) | Yes | The Play to run. |
| `cohort` | `string` | Yes | The Portfolio query that selects the Startups. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `experiment` | [Experiment](/business/nouns/experiment) | Yes | The Experiment that measures the rollout. |
| `play` | [Play](/business/nouns/play) | Yes | The Play applied. |

**Refuses when**

| Check | Error | Fix | Then call |
| --- | --- | --- | --- |
| The input does not match the schema of the operation. | [`invalid-input`](/code/api/errors/invalid-input) | Read the schema of the operation, then send every required field with the right type. | 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/plays/play_hr4WTcrAyZ/apply \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"cohort":"Example cohort"}'
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "experiment": {
    "$id": "https://api.sb/leaseline.app/experiments/experiment_IyIJJPngKt",
    "$type": "Experiment",
    "variants": {}
  },
  "play": {
    "$id": "https://api.sb/leaseline.app/plays/play_hr4WTcrAyZ",
    "$type": "Play",
    "family": "demand"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Play.apply",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```