# `bird amb routing-rules create`

## Usage

```bash
bird amb routing-rules create [flags]
```

## Description

Create an Apple Messages for Business routing rule

Creates a routing rule for one of your Apple Messages for Business brands. Set `is_default` to make it the rule that catches a conversation matching nothing else. A business can have only one default rule, and creating a second while one exists returns a `409`.

Build the request from flags, a JSON AMBRoutingRuleCreate body via --body-file ("-" reads
stdin), or both — a flag overrides the matching body field. Run --example to
print a ready-to-edit body, or --dry-run to print the resolved request without
sending it.

## Examples

```bash
# print the body shape (no credentials needed)
bird amb routing-rules create --example

# the body it prints:
```

```json
{
  "business_id": "abz_01krdgeqcxet5s7t44vh8rt9mg",
  "is_default": false,
  "match_intent_id": "order_status",
  "match_kind": "intent",
  "precedence": 10,
  "queue": "billing"
}
```

## Options

#### Request

| Name                | Description                                                  |
| ------------------- | ------------------------------------------------------------ |
| `--body-file`       | Read the JSON request body from this file; "-" reads stdin   |
| `--example`         | Print a complete example request body, then exit             |
| `--dry-run`         | Print the resolved request without sending it, then exit     |
| `--idempotency-key` | Deduplication key; a retry with the same key won't act twice |

#### Options

| Name                | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--business-id`     | The Apple Messages for Business brand this rule belongs to. (required; or in --body-file)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `--match-kind`      | What a routing rule matches against the entry point that started the conversation. - intent matches on the entry point's intent alone: match\_intent\_id is set and match\_group\_id is null. - group matches on the entry point's group alone: match\_group\_id is set and match\_intent\_id is null. - both matches only when the entry point carries the given intent and the given group together, so match\_intent\_id and match\_group\_id are both set. There are two match fields rather than one because both needs to carry an intent and a group at once. Possible values: intent, group, both. (required; or in --body-file) |
| `--match-intent-id` | The entry point intent to match, as sent in Apple's intentID. Required when match\_kind is intent or both, and rejected when it is group.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `--match-group-id`  | The entry point group to match, as sent in Apple's groupID. Required when match\_kind is group or both, and rejected when it is intent.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `--queue`           | The queue a matching conversation is filed into. Your console lists whichever values your rules use. (required; or in --body-file)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `--precedence <n>`  | Evaluation order among this business's rules. The highest-precedence rule a conversation matches wins. Omit it to default to 0.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `--is-default`      | Set to make this the rule that catches a conversation matching nothing else. A business can have only one; creating a second while one exists returns a 409.                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `--response-schema` | Print the fields this command returns, then exit                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |

## Related

| Name                                                                            | Description                                        |
| ------------------------------------------------------------------------------- | -------------------------------------------------- |
| [`bird amb routing-rules delete`](/docs/cli/reference/amb-routing-rules-delete) | Delete an Apple Messages for Business routing rule |
| [`bird amb routing-rules get`](/docs/cli/reference/amb-routing-rules-get)       | Get an Apple Messages for Business routing rule    |
| [`bird amb routing-rules list`](/docs/cli/reference/amb-routing-rules-list)     | List Apple Messages for Business routing rules     |
| [`bird amb routing-rules update`](/docs/cli/reference/amb-routing-rules-update) | Update an Apple Messages for Business routing rule |

## Related resources

- [Should I use a Bird SDK or call the API directly?](/explained/platform/should-i-use-an-sdk-or-call-the-api-directly) (answer)
- [Build your first integration](/learn/paths/integration) (course)
- [Send your first email](/docs/get-started/send-your-first-email) (docs)

[Get an implementation brief](/learn/workspace?topic=api-basics)
