---
title: "Update an SMS keyword rule"
method: PATCH
path: "/v1/sms/keyword-rules/{id}"
tags: ["sms-keyword-rules"]
---

# Update an SMS keyword rule

`PATCH /v1/sms/keyword-rules/{id}`

## Request

- Base URL: `https://us1.platform.bird.com`
- URL: `https://us1.platform.bird.com/v1/sms/keyword-rules/{id}`
- Auth: one of:
  - HTTP bearer
  - API key in cookie `bird_session`

Changes the reply or the added keywords of a rule you created. Bird's defaults cannot be
changed. To replace one, create a rule with the same operation and country and yours
takes precedence.

What the rule applies to is fixed once created, so this changes the reply and the keywords
only.

## Headers

- `Idempotency-Key` string
- `X-Workspace-Id` string
- `X-Organization-Id` string

## Request body

- SMSKeywordRuleUpdate: Changes the reply and the added keywords. What a rule applies to (its operation, country, language and number) is fixed once created: those decide which inbound messages reach it, so changing one would make it a different rule. Delete it and create the one you want.
  - `keywords` string[]: Replaces the extra keywords this rule matches, on top of the ones Bird ships. Send an empty array to keep Bird's keywords only. Omit to leave the current ones unchanged.
  - `reply` string, nullable: Replaces the message sent back when a keyword matches, except on a `confirm` rule, which never sends one whatever this is set to. Set it to null together with `confirmed_self_managed` to switch the auto-reply off. Omit to leave it unchanged.
  - `confirmed_self_managed` boolean: Set this with `reply: null` to confirm you send this reply from your own system. Required to switch the auto-reply off, and rejected when a reply is given.

## Response `200`

The updated rule.

- SMSKeywordRule
  - `id` string, required: 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.
  - `scope` 'system' | 'workspace', required: 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.
  - `operation` string, required: What Bird does when an inbound message matches the rule. - `stop` unsubscribes the sender from further messages. - `start` resubscribes them. - `help` replies with your support information. - `info` replies with your program information. It behaves exactly as `help` does and is separate so a country whose INFO answer must differ from its HELP answer can carry both. Where Bird ships no `info` rule for a country, INFO is one of that country's `help` keywords and answers with the `help` reply. - `confirm` marks a double opt-in reply. It sends nothing today, so answer it from your own handler. - `custom` replies with the text you configured and has no other effect. Bird's built-in rules fix the operation for `stop`, `start` and `help`; you can change their reply but not what they do. The same holds for `info` in any country where Bird ships an `info` rule. This is an open enum. Accept unrecognized values.
  - `country` string, nullable: 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. Rules for the country a message arrives in always outrank rules for the country its sender is in; within each, your rule wins over Bird's keywords for that country. `number` confines a rule to one number. Null means the rule applies worldwide, which is allowed for `custom` operations only.
  - `language` string, nullable: 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.
  - `number` string, nullable: 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.
  - `keywords` string[], required: 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.
  - `effective_keywords` string[], required: 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.
  - `reply` string, nullable: The message sent back when one of the keywords matches, except on a `confirm` rule, which never sends one. Null when the auto-reply is switched off, which `reply_disabled_at` distinguishes from a rule that has not been given one.
  - `reply_suffix` string, nullable: 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.
  - `reply_disabled_at` string, date-time, nullable: 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.
  - `mandatory` boolean, required: Whether what this operation does is fixed. When true you can change the reply but not the behavior. An opt-out keyword always unsubscribes the sender, whichever rule matched it, because carriers and regulators require it.
  - `created_at` string, date-time, required: When the rule was created.
  - `updated_at` string, date-time, required: 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.

## Other responses

- `400`: Bad request
- `401`: Authentication required
- `403`: Insufficient permissions
- `404`: Resource not found
- `409`: Resource conflict
- `422`: The request has invalid field values, violates a business rule, or carries a query parameter the endpoint does not declare. Field validation errors use `type: validation_error` and include the affected fields in `details`. Business-rule errors identify the failed rule in `type`.
- `429`: Rate limit exceeded
- `500`: Internal server error
- `503`: The service is temporarily unavailable. If `Retry-After` is present, wait for that delay before retrying; otherwise, retry with exponential backoff. Reuse the same idempotency key and request when retrying a mutation.

---

[API](https://skmtc.dev/messagebird/apis/bird-api.md) · [All operations](https://skmtc.dev/messagebird/apis/bird-api/llms.txt) · [OpenAPI document](https://skmtc.dev/messagebird/apis/bird-api/revisions/3e2a50466454?raw)
