# Message routes: broadcast, schedule

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

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

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

### Message.broadcast
Broadcast sends one Message to an Audience, now or at a set time, split by Variant when an Experiment runs. [Verb page](/business/nouns/message/broadcast?interface=api).

```text
POST /{namespace}/messages/{message}/broadcast
```

Path: `message`. Body, as JSON: the other inputs. Emits [`Message.broadcasted`](/business/events/Message.broadcasted).

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `message` | [Message](/business/nouns/message) | Yes | The Message to send. |
| `audience` | [Audience](/business/nouns/audience) | Yes | Who receives it. |
| `at` | `datetime` | No | When it goes out; omitted, now. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `messages` | list of [Message](/business/nouns/message) | Yes | One sent Message per Contact. |
| `message` | [Message](/business/nouns/message) | Yes | The Message broadcast. |

**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/messages/message_3Dg8ysSOyQ/broadcast \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"audience":"audience_vmVkEYrXCN"}'
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "messages": [
    {
      "$id": "https://api.sb/leaseline.app/messages/message_3Dg8ysSOyQ",
      "$type": "Message",
      "medium": "email",
      "direction": "inbound",
      "body": "Example body"
    }
  ],
  "message": {
    "$id": "https://api.sb/leaseline.app/messages/message_3Dg8ysSOyQ",
    "$type": "Message",
    "medium": "email",
    "direction": "inbound",
    "body": "Example body"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Message.broadcast",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```

### Message.schedule
Schedule holds a Message until a set time and sends it then, unless it is canceled first. [Verb page](/business/nouns/message/schedule?interface=api).

```text
POST /{namespace}/messages/{message}/schedule
```

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

**Inputs**

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `message` | [Message](/business/nouns/message) | Yes | The Message to hold. |
| `at` | `datetime` | Yes | When it goes out. |

**Returns**

| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `message` | [Message](/business/nouns/message) | Yes | The scheduled Message. |

**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/messages/message_3Dg8ysSOyQ/schedule \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"at":"2026-10-22T12:00:00Z"}'
```

```json
{
  "api": "https://api.sb/leaseline.app",
  "message": {
    "$id": "https://api.sb/leaseline.app/messages/message_3Dg8ysSOyQ",
    "$type": "Message",
    "medium": "email",
    "direction": "inbound",
    "body": "Example body"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Message.schedule",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}
```