The Inbox reads its settings from the block inbox of the configuration file of the portal. There is no second file. The reference of every key is in the configuration reference. It comes from the table of keys in src/config/keys.rs. It gives the type, the range, the default and the use of each key. This page does not copy it.
Check a file with portal check-config --config FILE. The command prints the value that applies to each key and its source. The annotated example is deploy/config.example.hcl. The file of the Compose stack is deploy/compose/config.hcl.
Where the blocks go
- The block
inboxis optional. Without it, the portal has no Inbox and opens no route for it. With it, the senders, the webhooks and the phones useserver.listen_address, the port of the pages. The Inbox has no listener for them. inbox.devices.public_addressis the public base URL of the portal as the phones reach it. The portal has no base path. A proxy under a prefix removes the prefix.- Inside
inbox, the blocksdevicesandstorageare mandatory. The blocksenrollment,replica,clusterandwatchare optional. - The blocks
itemsandat_restare optional, but they go together. Each one needs the other. The blockitemsholds the blocksleaseanddigest. The blockat_restholds one blockkey "<id>"for each content key. - The block
approvalsis optional. It starts the approval of an action at the PDP. See Approvals. - The block
agentsis optional. It starts the agents of a key. See Agents. - The block
mcpis optional. It starts the MCP endpoint of the agents. See The MCP endpoint. - The blocks
group "<id>"andapi_key "<name>"can occur more than once. The blockinboxneeds one group at least. - The Inbox has no
postgresblock. It uses the blockpostgresof the portal. With nopostgresblock, it uses the SQLite file of the blockstorageof the portal.
Delivery values have no default
These keys have no default: heartbeat_interval, session_timeout, resend_after, max_inflight, unreachable_after and offline_warning_after of inbox.devices, and delivery_ttl, alert_retention and connection_log_retention of inbox.storage. The program stops at start when one is absent. A wrong default could hide an alert, so the operator chooses each value.
The examples use these values: heartbeat_interval = "20s", session_timeout = "60s", resend_after = "15s", max_inflight = 32, unreachable_after = "2m", offline_warning_after = "3m", delivery_ttl = "7d", alert_retention = "30d" and connection_log_retention = "90d".
Rules between keys
Two keys that contradict each other stop the program at start. The message names the key, the range and the value.
inbox.devices.max_per_accountis at mostmax_devices.inbox.devices.session_timeoutis at least two timesheartbeat_interval.inbox.devices.unreachable_afteris at leastsession_timeout.inbox.devices.offline_warning_afteris at least two timesheartbeat_interval.inbox.storage.alert_retentionis at leastdelivery_ttl.inbox.storage.pool_sizeapplies only with the blockpostgres.inbox.replicaneeds SQLite. It must not be present with the blockpostgres. Itsdirmust not be the directory ofstorage.database.inbox.clusterneeds the blockpostgres. Itspeershas 1 to 16 names with a port. Itslistenmust not use the port ofserver.listen_addressor ofpdp.listen_address.inbox.watch.groupmust be the label of a blockgroup. The block must send at least one kind of alert.inbox.itemsneedsinbox.at_rest, andinbox.at_restneedsinbox.items. See Items and Content keys.inbox.approvalsneedsinbox.items,inbox.at_rest, the blockpdpandkeys.mcp = true. Itsconsume_withinis at mostinbox.items.max_lifetime. Itsmax_command_bytesplus 2048 bytes is at mostpdp.max_body_bytes.require_explanationis nottruewithmax_explanation_chars = 0. See Approvals.inbox.agentsneedsinbox.itemsandinbox.at_rest. Itsidle_afteris at most itspurge_after. See Agents.inbox.questionsneedsinbox.itemsandinbox.at_rest. See Questions.inbox.mcpneedsinbox.itemsandkeys.mcp = true. Itsmax_waitis at mostinbox.items.wait_max. Itspathis notmetrics.path. See The MCP endpoint.
Keys of the senders
A block api_key "<name>" is an API key of the file. These rules apply. The error names the key and never shows the secret.
- The switch
keys.apiistrue. This needs the blockkeys. owneris the login of an account of the file (a blockuser). A blockuserneedsaccess.grants_modeto bestaticorhybrid.- The owner holds
keys.own.useonservice:portal/key_kind:apiandalert.sendon each group ofgroups. Withdirect_alerts = true, the owner holdsalert.send_useronservice:portaltoo. secretis an API key of 53 characters with the prefixapi_and a good checksum. Two keys must not have the same text.groupslists one group at least, except whendirect_alertsistrue. Each group is a blockgroup.direct_alertsisfalseby default. Withtrue, the key can send an alert to any account (POST /api/v1/alertswith the fielduser).webhook_send_resolvedisfalseby default. Withtrue, the notifications "resolved" of Alertmanager and Grafana become alerts.
Items
The block inbox.items sets the limits of the items. An item is an approval or a question that an agent sends to a person. The block has no default for a limit that could hide an item or keep it too long. The program stops at start when one of these keys is absent.
max_lifetime,max_open_per_key,max_open_per_ownerandmax_open_total.retention,body_purge_afterandaudit_retention.lease.min,lease.max,lease.graceandlease.revive_window.digest.mode, anddigest.atanddigest.timezonewith the modedaily, ordigest.everywith the modeevery.
The examples use these values: "90d", 5, 20, 1000, "180d", "30d", "365d", "30s", "7d", "2m", "7d" and "daily". The other keys have a default: lease.max_revivals is 3, max_chain is 10, max_turns is 40, stale_after is "24h", max_body_bytes is "16KiB" and wait_max is "25s".
These limits contradict each other, and the program stops at start. The message names the two keys and their values.
lease.minis abovelease.max.lease.maxorlease.revive_windowis abovemax_lifetime.retentionis belowmax_lifetimepluslease.revive_window.audit_retentionis belowretention.body_purge_afteris aboveretention.digest.atordigest.timezoneis present and the mode is notdaily.digest.everyis present and the mode is notevery.
The program checks digest.timezone against the time zone database that is inside the binary. The name needs its exact capital letters: Europe/Paris is valid and europe/paris is not. The program does not read the zone files of the host. No key of this block is editable from the web.
The keys of digest are the defaults of every account. An account can replace them on the page Inbox > Preferences or with the frame set_prefs of the phone. The values of the account live in the database, not in the file. They never go past a limit of the file: the period of an account has the range of digest.every, from 1 hour to 7 days.
Content keys
The block inbox.at_rest holds the keys that seal the contents of the items. The portal never writes a content in clear text. A copy of the database, a backup or a copy of the replica holds no readable content.
active_keyis the id of the key that seals the new contents. It is mandatory. It must be the label of a blockkey.- The block has 1 to 8 blocks
key "<id>". An id has 1 to 16 characters froma-z,0-9,-and_. - A key that is not the
active_keystays readable and seals nothing. Use this for a rotation (see Rotate a content key). - Each block
keyhas exactly one ofsecret_envandsecret_file. Asecretin clear text stops the start. - A secret is the base64 text of 32 random bytes. It has 44 characters. A secret with all bytes equal stops the start.
- Two keys must not have the same bytes. All instances of the portal must hold the same keys.
admin_body_readisfalseby default. Withtrue, the superadmin can read the contents. The portal then writes one audit event for each read, never the content.
Make a key with portal inbox content-key --out FILE. The command writes one line. It never overwrites a file.
Keep the key file outside the data volume and outside the backups of the database. Keep a copy of it in a separate place. A lost key makes the sealed contents unreadable. The metadata stays readable.
At start, the portal compares each key with the check value that the database keeps. A key that changed under the same id stops the start. The message names the id. To change a key, rotate it (see Rotate a content key). A database from a version before 5.1.0 has no table for the check values. The portal stops at start and says so (see Upgrades).
At start, the portal also counts the sealed rows of each key. The start stops when a row names a key id that the file does not hold. The message names the id and the number of rows. It gives two ways out. If you still have the secret, add the block key again and run portal inbox rekey. If the key is lost, run portal inbox content-purge.
A row can name a key that the file holds but that is not the active_key. Then the portal starts. It writes the log event content_key_rows_to_rekey with the key id and the number of rows. These rows wait for rekey.
Rotate a content key
A rotation has three steps. Do them in this order. Each step is safe to stop and to repeat.
- Add the new key and make it active.
- Run
portal inbox content-key --out FILE. Keep the file outside the data volume and outside the backups of the database. - Add a block
keywith a new id. Do not remove the block of the old key. - Set
active_keyto the new id. - Restart each instance. Each instance must hold the same keys. From now, the new contents use the new key. The old contents stay readable with the old key.
- Run
- Run
portal inbox rekey --config FILE.- The command seals again every sealed value that uses a key that is not the active key. Use
--from IDto take one old key only. - It visits four kinds of value. They are the bodies of the items, the turns of the threads, the intents of the agents and the hints of the agents.
- It uses batches of 200 rows. It writes each batch in one transaction. It never logs a content.
- It is idempotent. If you stop it, or if it is killed, run it again. No row is lost, and no row is sealed twice.
- It keeps the associated data of each value (the request id, the field, the sequence number and the effect). Each check of an approval stays valid.
- With PostgreSQL, it runs while the portal serves. It writes a row only when the row still holds the value that the command read. A writer that changed the row first keeps its value, and the command reads the row again.
- With SQLite, it refuses to run while an instance runs on the file. Stop the instance first.
- It reports the number of rows moved for each table, and the number of rows that still use each old key.
- A row that does not open stays as it is. The report names its table and id, never its content. The command then ends with an error. Do not remove the old key.
- The command seals again every sealed value that uses a key that is not the active key. Use
- Remove the old key when the command reports no row on it.
- Run
portal inbox rekey --config FILEagain. It must move 0 rows. It must report no row left on the old key. - When no row uses the old key, the command drops the check value of this key from the database.
- Wait at least
inbox.approvals.evaluation_ttl(5 minutes by default) after the restart of the last instance of step 1. - Remove the block
keyof the old key, and restart each instance.
- Run
The wait of step 3 has a reason. An evaluation_id that the PDP made before step 1 names the old key. The PDP checks it with that key, for evaluation_ttl. If you remove the key sooner, a service that holds such an id gets invalid_evaluation and asks the PDP again. No row stores such an id as a value that needs the key: an approval that the owner already decided stays valid.
If you remove the block of the old key too early, the portal stops at start and names the key and the number of rows. Add the block again, start, and run the command.
Backups and restores need care. A backup of the database holds the rows as they were at the time of the backup. Those rows can use an old key. Keep each old key for as long as you keep a backup that uses it.
After a restore, the file must hold every key that the restored rows name. If it does not, the start stops. Add the key that the file lacks, start, and run portal inbox rekey. Keep the keys apart from the backups of the database.
portal check-config shows for each key its id, whether it is active or read-only, and its source as env:VAR or file:/path. It never shows the secret.
Approvals
The block inbox.approvals sets how the PDP gates an action that a grant marks with confirm. It also sets the limits of the approval API of the services. Only consume_within is mandatory.
consume_withinis the time after the decision of the owner in which the approval can be used. The range is5sto1h. The time that applies is the larger of this value andlease_sof the request.evaluation_ttlis the time in which anevaluation_idis valid. The range is10sto1h. The default is5m.deny_cooldownis the time after an explicit refusal in which the PDP answersapproval_deniedfor the same effect. The range is0sto24h. The default is5m. With0s, the PDP never answersapproval_denied.max_command_bytesis the largest command (opandview, as compact JSON). The range is1KiBto32KiB. The default is16KiB. It must not be abovepdp.max_body_bytes. A larger command gets413 command_too_large.max_explanation_charsis the longest explanation of an agent. The range is0to8000. The default is2000. With0, no explanation is accepted. The portal never cuts a text.require_explanationisfalseby default. Withtrue, a request without an explanation gets422 explanation_required. It must not betruewithmax_explanation_chars = 0.max_comment_charsis the longest text that a person joins to a refusal. The range is1to8000. The default is2000.intent_ttlis the time in which anapproval_refworks. The range is30sto1h. The default is10m.max_requests_per_key_per_houris the most requests that one key creates in one hour. The range is1to10000. The default is20.mute_after_refusalsis the number of explicit refusals in a row after which a key is muted. The range is0to100. The default is3. With0, a key is never muted.mute_foris the length of the mute. The range is1mto7d. The default is1h.web_approvalistrueby default. Withfalse, the web page lists the requests and does not decide them, so an owner with no phone gets409 no_device.
The block pdp_client has no key for the approvals. Each action of each service can ask for an approval, and a service must handle approval_required for all its actions. Without the block inbox.approvals, the PDP gives a plain false for an action with confirm, and the approval API gives 403. A file that still has approvals in a block pdp_client stops at start. See Identity tokens and the PDP for the approval gate and the approval API of a service.
Agents
Several programs, or several conversations of one model, can share one key. The block inbox.agents lets the portal tell them apart. The portal gives each agent a token, and the owner gives it a name. All its keys have a default, so the block can be empty. Without the block, each key is one agent, and the Inbox works as before.
max_per_keyis the most agents of one key that arenew,knownorblocked. The range is1to1000. The default is16.new_per_houris the most agents that the calls of one key can make in one hour. The range is1to1000. The default is6.lock_newisfalseby default. Withfalse, the owner can accept the items of a new agent at once, and gets a notice. Withtrue, the owner cannot accept an item of a new agent until the agent has the stateknown. A refusal and a talk stay open, and the server decides this, not the screen.idle_afteris the time after which an agent with no open item and no call leaves the active views. The range is1hto365d. The default is14d. The agent still works, and a call makes it active again.purge_afteris the time after which the sweeper erases an agent that has no item, no live intent and no call. The range is7dto3650d. The default is365d. The token of an erased agent is unknown.
The limits are per key, never per agent. An agent that drops its token cannot escape them. A call that would pass max_per_key or new_per_hour does not fail. It goes to the bucket Unattributed of the key, it gets no token, and the owner gets one alert each hour. The bucket has no name, and the owner cannot merge it, block it or lock it.
The mode of a key is an attribute of the key and not of the file. The three modes are key, discover and enrolled. The mode key is one agent for the key and has no token. The mode discover makes an agent at the first call that makes an item and has no token. The mode enrolled makes no agent from a call: the owner makes it. Without the block, each mode acts as key.
The portal seals the hints of an agent (what it says about itself, its client and its address range) with the content keys of inbox.at_rest. The command portal inbox content-purge erases these hints too. The metrics are portal_agents_created_total, portal_agent_refused_total and portal_agent_actions_total.
Questions
The block inbox.questions lets an agent ask a question to the owner of its key. The block can be empty. Without the block, the tool ask and the route POST /api/v1/questions do not exist. The owner is the only recipient. The portal seals each question at rest, and a service never sees it.
max_optionsis the most options of achoicequestion, and of each choice question of a form. The range is2to8. The default is8. The protocol of the phones accepts 8 at most. A question with more options gets422 invalid_argument. The portal never cuts a list.
A key asks only when it holds the permission question.ask on the service portal. The permission has the budget questions. A question, a message of the agent in its thread (say) and a replacement (supersede) count one unit each. A repeat of a call with the same idempotency_key, a renewal of a lease and a read count nothing. The permission question.cancel lets a key withdraw its own question. The permission question.read is for an account: it shows the metadata of the questions of all the accounts, and never a content.
The attribute interaction of a key is conversational or one_shot. A one_shot key asks a choice or a confirm with no flag. A call with allow_custom or allow_ask_back gets 422 interaction_not_allowed.
The MCP endpoint
The block inbox.mcp starts the endpoint of the agents. All its keys have a default, so the block can be empty. Agent channel tells how an agent uses the endpoint.
pathis the URL path of the endpoint. The default is/mcp. It must not be/,/healthz,/readyzor/api/version. It must not be under/auth/,/v1/or/api/v1/. It must not be the path of the metrics. Make the proxy send this path to the portal without ForwardAuth.max_waitis the longest wait of one call ofget_answer. The range is0sto60s. The default is25s. It must not be aboveinbox.items.wait_max. A real client stops a call near 60 seconds, so keep the value low.allowed_originslists the values of the headerOriginthat pass. A request with noOriginheader comes from a program and passes. A request with another origin gets403. Without this key, no browser origin passes.allowed_client_cidrslists the networks of the client address. The client address is the address thatserver.trusted_proxiesfinds. A client in no network gets403. Without this key, each address passes.rate_limit_per_minuteis the bucket of one key. The range is1to100000. The default is120. Each request counts, alsotools/listandping.max_unauthenticated_per_minuteis the number of requests with no valid key that one client address can send. The range is1to10000. The default is10. The portal counts a bad key only, never a good one.max_body_bytesis the largest body. The range is1KiBto1MiB. The default is64KiB.
Each instance keeps its limits in memory. With N instances, a key can send N times rate_limit_per_minute. A client address that sends too many requests with no valid key gets 429 before the portal checks the key.
Switches that touch the Inbox
- Without the block
inbox, no grant can name an action of the Inbox. A grant that does so stops the start. keys.api = trueneeds the blockinbox.inbox.watchneeds the Inbox only. It does not needkeys.
Secrets
inbox.server_key and the secret of each api_key accept only _env and _file. A clear text value stops the program.
portal inbox keygen --out FILE makes the key file. It holds one line: the Noise key pair of the server. The command never overwrites a file. The program removes the final line end when it reads the file. A new key makes every phone and every code invalid.
portal inbox token --out FILE makes the text of an API key.
The Inbox reads no environment variable that the file does not name. It never reads the OTEL_* variables.
The secret of each block inbox.at_rest.key accepts only _env and _file, like the other secrets. portal inbox content-key --out FILE makes the key file. portal inbox rekey --config FILE [--from ID] seals the old contents again with the active key.
Default values of the optional keys
The optional keys have documented defaults. Examples: server.name is "Portal", inbox.devices.max_devices is 1000, inbox.enrollment.code_ttl is "10m", and inbox.storage.pool_size is 8. The reference has the full list.
Source of this page: docs/inbox/configuration.md.