<Intro>

<EndpointHeader />

<Description>

Returns what happens when someone replies to your numbers: Bird's default keyword rules and any you have created, ordered most specific first. Where Bird's catalogue covers a country, opt-out, opt-in and help are answered with no setup on your side.

Unfiltered, you get Bird's whole catalogue alongside your own rules. Use `country`, `number`, `operation` and `scope` to narrow that; `scope=system` browses Bird's catalogue alone. Pass `number` to see the rules for one number in the order they are applied, and add `from_country` to see what a sender from another country gets. The set is small and returned in full; this list is not paginated.

Coverage is per country. Filter by `country` to see what applies there: where the catalogue holds no rules, no keyword is recognised, nothing is answered, and no opt-out is recorded, so honouring opt-outs in that country is yours to handle. You can still add your own `custom` keywords for it, while opt-out, opt-in and help rules can only be created for a country the catalogue covers.

</Description>

</Intro>

<Parameters in="query">

<Parameter name="country" type="string">

<Description>

Keep only rules that apply in this country, as an ISO 3166-1 alpha-2 code. Omit for every country Bird's catalogue covers, plus your own rules.

</Description>

</Parameter>

<Parameter name="number" type="string">

<Description>

Keep only the rules that apply to this number of yours, in E.164 format or as a short code, ordered the way they are applied to an inbound message.

</Description>

</Parameter>

<Parameter name="from_country" type="string">

<Description>

The country a sender is messaging from, as an ISO 3166-1 alpha-2 code. Use it with `number` to see what someone in that country gets, which can differ from what a local sender gets. Ignored without `number`.

</Description>

</Parameter>

<Parameter name="operation" type="string">

<Description>

Keep only rules for this operation. Omit for all of them.

</Description>

<Description>

Possible values (may grow over time): `stop`, `start`, `help`, `custom`

</Description>

</Parameter>

<Parameter name="scope" type="string">

<Description>

Keep only Bird's defaults (`system`) or only the rules you created (`workspace`). Omit for both.

</Description>

<Description>

Possible values: `system`, `workspace`

</Description>

</Parameter>

</Parameters>

<Payload kind="response">

<Field name="data" type="array of object" required>

<Description>

The keyword rules that apply to your workspace, Bird's defaults included. Ordered most specific first, so the first rule whose keywords match an inbound message is the one that runs. The set is small and returned in full; this list is not paginated.

</Description>

<FieldChildren kind="response">

<Field name="id" type="string" prefix="data." required>

<Description>

Identifier of a keyword rule. An `sks_` id is one of Bird's defaults, which you can read but not change; an `skw_` id is a rule your workspace created.

</Description>

</Field>

<Field name="scope" type="string" prefix="data." required>

<Description>

Whether the rule is one of Bird's defaults (`system`) or one your workspace created (`workspace`). A `workspace` rule takes precedence over Bird's default for the same country, so it is how you replace a reply without losing the keywords Bird ships.

</Description>

<Description>

Possible values: `system`, `workspace`

</Description>

</Field>

<Field name="operation" type="string" prefix="data." required>

<Description>

What Bird does when an inbound message matches one of the rule's keywords. "stop" unsubscribes the sender, "start" resubscribes them, and "help" replies with your support information. Those three are what carriers and regulators expect a number to honour, so Bird ships keywords for them wherever its catalogue covers the country, and you cannot change what they do. "custom" carries no built-in behaviour: it matches keywords you choose and sends the reply you write, which is how campaign keywords like PIZZA are handled. Open enum: additional operations may be added over time, so treat an unrecognized value as a future operation rather than an error.

</Description>

<Description>

Possible values (may grow over time): `stop`, `start`, `help`, `custom`

</Description>

</Field>

<Field name="country" type="nullable string" prefix="data.">

<Description>

The country the rule applies in, as an ISO 3166-1 alpha-2 code. A rule for `NL` covers messages received on your Dutch numbers, and messages from a subscriber whose own number is Dutch whichever of your numbers they text. A rule for the country a message arrives in wins over a rule for the country its sender is in, and both win over Bird's own keywords; `number` confines a rule to one number. Null means the rule applies worldwide, which is allowed for `custom` operations only.

</Description>

</Field>

<Field name="language" type="nullable string" prefix="data.">

<Description>

The language this rule covers, in countries where Bird ships keywords in more than one. Canada has separate English and French rules, so a Canadian rule names which one it replaces and the other keeps Bird's reply. Null in countries with a single set.

</Description>

</Field>

<Field name="number" type="nullable string" prefix="data.">

<Description>

Narrows the rule to one of your numbers in E.164 format, instead of every number you hold in the country. Null means it applies to all of them.

</Description>

</Field>

<Field name="keywords" type="array of string" prefix="data." required>

<Description>

The keywords this rule adds. For one of Bird's defaults this is the full set Bird ships. For a rule you created it is only what you added on top. It never restates or removes Bird's keywords, so `effective_keywords` is what actually matches.

</Description>

</Field>

<Field name="effective_keywords" type="array of string" prefix="data." required>

<Description>

Every keyword that matches this rule: Bird's keywords for the same operation, country and language, plus the ones you added. This is what an inbound message is compared against. Keywords Bird adds later join it without you changing anything.

</Description>

</Field>

<Field name="reply" type="nullable string" prefix="data.">

<Description>

The message sent back when one of the keywords matches. Null when the auto-reply is switched off, which `reply_disabled_at` distinguishes from a rule that has not been given one.

</Description>

</Field>

<Field name="reply_suffix" type="nullable string" prefix="data.">

<Description>

Text appended to your reply that you cannot change: the rates and opt-out wording carriers require on a help response. Your reply is sent in front of it, and both count against the length a single message allows. Null when the operation carries none.

</Description>

</Field>

<Field name="reply_disabled_at" type="nullable string" prefix="data.">

<Description>

When the auto-reply for this rule was switched off, or null if it is on. Switching it off records that you send this reply from your own system, which is what Bird points to if a carrier asks why no reply went out.

</Description>

</Field>

<Field name="mandatory" type="boolean" prefix="data." required>

<Description>

Whether what this operation does is fixed. When true you can change the reply but not the behaviour. An opt-out keyword always unsubscribes the sender, whichever rule matched it, because carriers and regulators require it.

</Description>

</Field>

<Field name="created_at" type="string" prefix="data." required>

<Description>

When the rule was created.

</Description>

</Field>

<Field name="updated_at" type="string" prefix="data." required>

<Description>

When the rule was last changed. On one of Bird's defaults this is when Bird last changed the keywords or the reply for that country.

</Description>

</Field>

</FieldChildren>

</Field>

</Payload>