/domains/{name}/mail/accounts/{local}/bot-keys
0.2.10Unchanged since publicationCreate a bot key for a mailbox
mailallCreates 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 serverParameters
namepath ·DomainNameRequiredlocalpath ·LocalPartRequirednamestring, up to 64 charactersRequiredblockedarray of string, up to 254 characterscalls_per_minuteinteger, 1 to 6000copy_tostring, up to 320 characters or nullexpires_daysinteger, 0 to 3650folders_outarray of string, one of drafts, sent, junk, trashfrom_addressesarray of string, up to 64 charactersfrom_namestring, up to 64 charactersmayarray of string, one of read, search, flag, draft, send, replyplatformstring, up to 32 charactersrecipientsarray of string, up to 254 charactersrecipients_per_messageinteger, 1 to 50send_modestring, one of self, drafts, knownsends_per_dayinteger, 1 to 100000sends_per_hourinteger, 1 to 1000used_by_personbooleanExample
See the API overview for how to set $API and $TOKEN.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
}'201 Created{
"key": {}
}Errors
20 errors, each a status and a sentence400--address is required400<k> holds a character a rule may not400A bot connector needs a label400Domain name required400Domain name too long400Invalid IPv4 address400Invalid IPv6 address400Invalid boolean400Invalid domain name400Invalid mail address: local part over 64 characters400Invalid mail address: no local part400Invalid mail address: the local part may hold letters, digits, dots, _ + and -400Invalid port400Invalid setting key401Authentication required403The package <p.name> does not include <SWITCH_WHAT>{<switch>}404No such mail account: <address>404Setting '<key>' not found409BotMail is not on for <m.domain>: turn it on for the domain first409The mailbox <m.address> has <allowed> bot connectors already, the most a mailbox may haveurbestack.com/docs/api/post-domains-name-mail-accounts-local-bot-keys/