# Add a restricted-goods rule (POST /v1/restrictions/rules)

> POST /v1/restrictions/rules: Add a restricted-goods rule. border.bot API reference (Compliance).

Source: https://border.bot/docs/api/add-restriction-rule

> Documentation index: https://border.bot/llms.txt. Every page is Markdown at its URL + `.md`.

`POST https://api.border.bot/v1/restrictions/rules`

Requires an API key (`Authorization: Bearer bb_live_…`).

A rule matched by HS code (and everything under it), by words in the item, or by origin, for one country or `*`. Free.

API key scope: `settings`.

## Request body (JSON)

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `country` | "*" \| string | no |  |
| `direction` | "import" \| "export" | no |  |
| `ruleType` | "prohibition" \| "restriction" \| "observation" | yes |  |
| `code` | string | no |  |
| `keywords` | string[] | no |  |
| `origins` | string[] | no |  |
| `title` | string | yes |  |
| `summary` | string | no |  |

## Responses

- `200`: The rule. (`RestrictionRuleResponse`)
- `400`: Invalid input (`invalid_input`). (`Error`)
- `401`: Missing, invalid, revoked or expired API key (`unauthorized`). (`Error`)
- `403`: The API key doesn’t have the `settings` scope (`forbidden`, `details.reason: "missing_scope"`). (`Error`)
- `429`: Rate limited (`rate_limited`). Retry after `Retry-After` seconds; `RateLimit` says which limit was hit (`r=0`, `t` seconds until its window ends) and `RateLimit-Policy` its quota. (`Error`)
- `500`: Unexpected error (`internal`). (`Error`)

## Example

```bash
curl -X POST 'https://api.border.bot/v1/restrictions/rules' \
  -H 'Authorization: Bearer bb_live_...' \
  -H 'Content-Type: application/json' \
  -d '{"country":"US","ruleType":"prohibition","code":"9304","keywords":["airsoft"],"title":"No airsoft or air guns (company policy)"}'
```
