# PATCH /botmail/keys/{id}

First published 18 Oct 2026 (release 0.2.10) · Unchanged since publication

UrbeStack release 0.2.35 API operation in the mail group.

Update a bot key's rules or pause or resume the key

- Who may call it: administrator, reseller, customer
- Token scope, any of: mail, all
- Answers: 200 OK

Supply at least one field to update. Set paused to true to pause the key or false to resume it. Only an administrator can resume a key paused by an administrator. The 200 response includes the updated key.

The may field sets the operations the key can perform. The send_mode field accepts self, drafts, or known. Use recipients and blocked to set allowed and blocked recipients. The from_addresses field accepts up to 32 IP addresses or CIDR networks that the bot can call from. The name field accepts up to 64 characters. The sends_per_hour field accepts 1 to 1000, and recipients_per_message accepts 1 to 50. The sends_per_day and calls_per_minute fields each accept values from 1 up to the corresponding server ceiling.

Set from_name to an empty string to send using only the sender's email address. Set copy_to to an empty string to stop sending copies. The expires_days field sets the key's validity period in days. Use 0 to remove expiration.

The API returns 400 if you supply no changes or if a rule value contains ASCII control characters or exceeds 4096 characters, including commas between list entries. It returns 404 if the key is missing or the caller lacks access to it.

## As a command

- [urbestack-botmail-key-set](https://urbestack.com/docs/commands/urbestack-botmail-key-set.md): Changes selected rules for a bot key, pauses it, or resumes it.

## Parameters

- `id` (path, integer, 1 or more, required)

## Request body

JSON, the type [BotKeyPatch](https://urbestack.com/docs/api/types/BotKeyPatch.md).

- `blocked` (array of string, up to 254 characters): Recipient email addresses and domains the key can never send to.
- `calls_per_minute` (integer, 1 to 6000): Maximum calls per minute, subject to the server's ceiling.
- `copy_to` (string, up to 320 characters or null): Email address that receives a copy of every message sent with this key. Set to null or an empty string to remove it.
- `expires_days` (integer, 0 to 3650): Number of days until the key expires, or 0 for no expiration.
- `folders_out` (array of string, one of drafts, sent, junk, trash): Special mail folders the key cannot access.
- `from_addresses` (array of string, up to 64 characters): Source IP addresses or CIDR blocks from which the bot can make calls. An empty list allows any source IP address.
- `from_name` (string, up to 64 characters): Sender display name on messages sent with this key. An empty string displays only the sender's email address.
- `may` (array of string, one of read, search, flag, draft, send, reply): Operations the key can perform. If reply is the only permission, the key can only send replies to messages it was given.
- `name` (string, up to 64 characters): Name the owner gives the key.
- `paused` (boolean)
- `platform` (string, up to 32 characters): Name of the platform or program that runs the bot, such as ChatGPT, Claude, or my program.
- `recipients` (array of string, up to 254 characters): Recipient email addresses and domains the key can send to. An empty list allows any recipient.
- `recipients_per_message` (integer, 1 to 50)
- `send_mode` (string, one of self, drafts, known): With self, messages are sent automatically. With drafts, all messages wait in Drafts for the owner, and with known, messages to known contacts are sent automatically while messages to other recipients wait in Drafts.
- `sends_per_day` (integer, 1 to 100000): Daily sending limit, subject to the server's ceiling.
- `sends_per_hour` (integer, 1 to 1000)

## Example

Set $API to the base URL and $TOKEN to the token, as the [API overview](https://urbestack.com/docs/api.md) shows.

```
curl -sS -X PATCH "$API/botmail/keys/1" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "blocked": [
      "text"
    ],
    "calls_per_minute": 1,
    "copy_to": "text",
    "expires_days": 1,
    "folders_out": [
      "drafts"
    ],
    "from_addresses": [
      "text"
    ],
    "from_name": "text",
    "may": [
      "read"
    ],
    "name": "alice",
    "paused": true,
    "platform": "text",
    "recipients": [
      "text"
    ],
    "recipients_per_message": 1,
    "send_mode": "self",
    "sends_per_day": 1,
    "sends_per_hour": 1
  }'
```

Response, 200 OK:

```
{
  "key": {
    "address": "info@example.com",
    "address_made_at": "text",
    "blocked": [
      "text"
    ],
    "calls_per_minute": 1,
    "ceilings": {},
    "copy_to": "text",
    "created_at": "2026-09-09T10:15:00Z",
    "dead_why": "text",
    "expires_at": "2026-09-16T10:15:00Z",
    "folders_out": [
      "drafts"
    ],
    "from_addresses": [
      "text"
    ],
    "from_name": "text",
    "host": "text",
    "id": 1,
    "key_hint": "text",
    "keyword": "text",
    "live": true,
    "login": "text",
    "mailbox": {},
    "may": [
      "read"
    ],
    "mcp_address": "text",
    "name": "alice",
    "old_key_hint": "text",
    "package_botmail": true,
    "paused": true,
    "paused_at": "text",
    "paused_by": "owner",
    "paused_by_name": "text",
    "platform": "text",
    "recipients": [
      "text"
    ],
    "recipients_per_message": 1,
    "send_mode": "self",
    "sends_per_day": 1,
    "sends_per_hour": 1,
    "updated_at": "text",
    "usage": {},
    "used_by_person": true,
    "user": "alice"
  }
}
```

## Errors

- 400: --id is required
- 400: <k> holds a character a rule may not
- 400: Domain name required
- 400: Domain name too long
- 400: Invalid IPv4 address
- 400: Invalid IPv6 address
- 400: Invalid boolean
- 400: Invalid domain name
- 400: Invalid id
- 400: Invalid port
- 400: Invalid setting key
- 400: Invalid username: 2 to 32 lowercase letters, digits or underscores, starting with a letter
- 400: Nothing to change
- 400: Username '<value>' is reserved
- 401: Authentication required
- 403: This bot connector was paused by an administrator; an administrator resumes it
- 404: No such bot connector: <c.params>{id}
- 404: No such bot connector: <id>
- 404: No such domain: <domain>
- 404: Setting '<key>' not found
