Get your free beta license ↗
API operation · mail group
POST

/domains/{name}/mail/accounts/{local}/bot-keys

First published 18 Oct 20260.2.10Unchanged since publication

Create a bot key for a mailbox

Who may call it
AdministratorResellerCustomer
Token scope, any of
mailall
Answers201 Created

Creates a named key and returns it in key. The 201 response reveals the secret only once, both on its own and as part of the MCP URL to give the bot. The caller must have access to the domain, BotMail must be ready for that domain, and the customer's package must allow BotMail. A missing mailbox returns 404.

When creating the mailbox's first key, set used_by_person to true if a person also uses the mailbox in a mail client or to false if only bots use it. The default is true. This mailbox setting supplies defaults for new keys. For a shared mailbox, send_mode defaults to drafts, outgoing mail stays in Drafts, and the key cannot access Drafts or Trash by default. For a bots-only mailbox, send_mode defaults to self, which allows direct sending. By default, the key cannot access Trash, and copies of outgoing mail go to the customer's email address if one is set.

The platform field records the bot's platform. The from_name field sets the sender display name. An empty from_name uses only the sender's email address. The may field accepts read,search,flag,draft,send,reply and defaults to read,search. The send_mode field accepts self, drafts, or known. The folders_out field lists folders the key cannot access and accepts drafts,sent,junk,trash. The recipients and blocked fields accept email addresses or domain names, such as a@b,example.com. The copy_to field gives the email address that receives copies of outgoing mail. The from_addresses field restricts access to the listed IP addresses or CIDR networks. List values can be arrays or comma-separated strings. A rule value returns 400 if it contains control characters or exceeds 4096 characters in its text form, after joining any list entries with commas. The expires_days field sets the key's lifetime in days and defaults to 0 for no expiration.

The sends_per_hour field defaults to 20 and accepts 1 to 1000. The recipients_per_message field defaults to 5 and accepts 1 to 50. The sends_per_day and calls_per_minute fields default to 100 and 30, respectively, and both have a minimum of 1. Their maximums are set by mail.botmail_sends_per_day and mail.botmail_calls_per_minute, which default to 200 and 60, respectively. The mail.botmail_keys_per_mailbox setting defaults to 5. A package can set a lower key limit per mailbox. An unset or zero package limit uses the server ceiling.

As a command

Run as root on the server

Parameters

namepath ·DomainNameRequired
localpath ·LocalPartRequired

Request body

JSON ·BotKeyCreate· 16 fields
namestring, up to 64 charactersRequired
Name the mailbox owner gives the key.
blockedarray of string, up to 254 characters
Email addresses and domains the key can never send to.
calls_per_minuteinteger, 1 to 6000
Maximum number of calls per minute, subject to the server's ceiling.
copy_tostring, up to 320 characters or null
Email address that receives a copy of every message sent with the key. An empty string or null removes the email address.
expires_daysinteger, 0 to 3650
Number of days until the key expires. A value of 0 means it never expires.
folders_outarray of string, one of drafts, sent, junk, trash
Special folders the key cannot access, chosen from drafts, sent, junk, and trash.
from_addressesarray of string, up to 64 characters
Allowed source IP addresses or CIDR ranges for calls made with the key. An empty list allows calls from any IP address.
from_namestring, up to 64 characters
Sender display name on messages sent with this key. An empty value uses the email address alone.
mayarray of string, one of read, search, flag, draft, send, reply
Actions the key permits, chosen from read, search, flag, draft, send, and reply. With reply alone, the bot can only answer messages it was given and cannot write to other recipients.
platformstring, up to 32 characters
Label for where the bot runs, such as ChatGPT, Claude, or my program.
recipientsarray of string, up to 254 characters
Email addresses and domains the key can send to. An empty list imposes no recipient restriction.
recipients_per_messageinteger, 1 to 50
send_modestring, one of self, drafts, known
Delivery mode for outgoing messages. Use self to send automatically, drafts to hold messages in the Drafts folder for the owner, or known to send to known contacts and hold the remaining messages in Drafts.
sends_per_dayinteger, 1 to 100000
Maximum number of sends per day, subject to the server's ceiling.
sends_per_hourinteger, 1 to 1000
used_by_personboolean
Whether a person also uses this mailbox in their own mail program. UrbeStack saves this value as a mailbox setting.

Example

See the API overview for how to set $API and $TOKEN.
Request
curl -sS -X POST "$API/domains/example.com/mail/accounts/info/bot-keys" \
  -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",
    "platform": "text",
    "recipients": [
      "text"
    ],
    "recipients_per_message": 1,
    "send_mode": "self",
    "sends_per_day": 1,
    "sends_per_hour": 1,
    "used_by_person": true
  }'
Response · 201 Created
{
  "key": {}
}

Errors

20 errors, each a status and a sentence
400--address is required
400<k> holds a character a rule may not
400A bot connector needs a label
400Domain name required
400Domain name too long
400Invalid IPv4 address
400Invalid IPv6 address
400Invalid boolean
400Invalid domain name
400Invalid mail address: local part over 64 characters
400Invalid mail address: no local part
400Invalid mail address: the local part may hold letters, digits, dots, _ + and -
400Invalid port
400Invalid setting key
401Authentication required
403The package <p.name> does not include <SWITCH_WHAT>{<switch>}
404No such mail account: <address>
404Setting '<key>' not found
409BotMail is not on for <m.domain>: turn it on for the domain first
409The mailbox <m.address> has <allowed> bot connectors already, the most a mailbox may have
Generated from release 0.2.35 (current) · the API’s own descriptionThis entry has been unchanged since it was first published in release 0.2.10 on 18 Oct 2026.
urbestack.com/docs/api/post-domains-name-mail-accounts-local-bot-keys/