# Dashboard routes: ask, schedule

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

> The Dashboard Verbs ask, schedule as api.sb routes, with inputs, result, refusals and an example.

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

### Dashboard.ask
Ask answers a plain-language question with a query over the Startup’s records and shows the query beside the result. [Verb page](/business/nouns/dashboard/ask?interface=api).

```text
POST /{namespace}/dashboards/ask
```

Body, as JSON: the inputs. Emits [`Dashboard.asked`](/business/events/Dashboard.asked).

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `question` | `text` | Yes | The question, in plain language. |
| `dashboard` | [Dashboard](/business/nouns/dashboard) | No | The Dashboard to add the answer to as a tile. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `query` | `text` | Yes | The query it ran, to read and reuse. |
| `rows` | `json` | Yes | The result, as a table or chart. |
| `dashboard` | [Dashboard](/business/nouns/dashboard) | Yes | The Dashboard the question was asked on. |

**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/dashboards/ask \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"question":"Example question"}'
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "query": "Example query",
  "rows": {},
  "dashboard": {
    "$id": "https://api.sb/leaseline.app/dashboards/dashboard_QL9I0ALqO4",
    "$type": "Dashboard",
    "scope": "Startup"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Dashboard.ask",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```

### Dashboard.schedule
Schedule sends a Dashboard on a cadence to a Mailbox, a Channel or an Agent’s context, rendered for each. [Verb page](/business/nouns/dashboard/schedule?interface=api).

```text
POST /{namespace}/dashboards/{dashboard}/schedule
```

Path: `dashboard`. Body, as JSON: the other inputs. Emits [`Dashboard.scheduled`](/business/events/Dashboard.scheduled).

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `dashboard` | [Dashboard](/business/nouns/dashboard) | Yes | The Dashboard to send. |
| `cadence` | `string` | Yes | How often it goes out. |
| `to` | `string` | Yes | The Mailbox, Channel or Agent that receives it. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `dashboard` | [Dashboard](/business/nouns/dashboard) | Yes | The Dashboard, with its schedule. |

**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/dashboards/dashboard_QL9I0ALqO4/schedule \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"cadence":"daily","to":"Example to"}'
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "dashboard": {
    "$id": "https://api.sb/leaseline.app/dashboards/dashboard_QL9I0ALqO4",
    "$type": "Dashboard",
    "scope": "Startup"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Dashboard.schedule",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```