Review mailbox actions
Set decision rules for mailbox sends and tool calls, review held actions, and approve message edits before sending.
A mailbox action records what was proposed and a decision: allow, hold, or refuse.
Organization, mailbox, and actor policies decide whether the action runs, waits for a person, or is
refused. The same rules apply to sends, agent replies, and integration tool calls.
A held action appears in Needs you with its decider, reason, and scopes. Approving a send
queues it; approving a tool call lets the exact proposed call run once. A model decision holds
with reason judgeUnavailable when judging is unavailable, so it never silently allows an action.
Act on what needs you
Needs you leads the inbox in Mail, and the dashboard's Inbox page counts it by kind. Each held reply, send, tool call, or hand-off says who held it and why: Auto with its own reason, the agent handing the conversation to your team, or the rule that asks a person. Choose:
- Approve to send the reply, run the tool call once, or accept the hand-off.
- Edit to change a held reply's or send's text, then Approve edit to send your version. The decision records what you changed.
- Always allow to approve it and let the same kind of action from that sender go ahead next
time. Floors still apply, so an action a floor holds keeps waiting. A hand-off always needs a
person. For an agent's or API key's action it needs an organization owner or admin, and for an
agent's integration tool call it lets that tool run without approval for every agent, which only
the organization owner can do. Anyone else sees who can instead of the button; the action's
alwaysAllowsays the same through the API. - Deny with a reason. A denied draft goes back to its author.
The API equivalents are edits and always on
approve an action.
See Configure decision rules to hold all actions from a mailbox or a particular sender.
Read a send receipt
Send, reply, reply to all, forward, and draft send return 202 with a receipt when work is waiting
or queued. The response does not mean the email has been sent. Read state and preserve actionId.
{
"actionId": "mbxact_...",
"draftId": "mdraft_...",
"threadId": "thread_...",
"state": "approvalRequired",
"messageId": null,
"acceptedAt": null,
"waitReason": null,
"reviewExpectedAt": null,
"skippedRecipients": [],
"executeUntil": null,
"retryAt": null,
"problem": null,
"retryEligible": false,
"decision": {
"id": "pdec_...",
"reviewRound": 2,
"requirement": "person",
"decider": "person",
"outcome": "hold",
"reason": "A person reviews outbound mail.",
"scopes": [{ "kind": "mailbox", "id": "mbx_..." }]
},
"createdAt": "2026-10-07T14:05:00.000Z",
"updatedAt": "2026-10-07T14:05:00.000Z"
}| State | Meaning |
|---|---|
approvalRequired | A permitted person must decide. No email has been accepted. |
queued | Sending is authorized and may be waiting or running. No email has been accepted. |
accepted | Samva accepted the email for delivery. Its mailbox sent item may still be catching up. |
completed | The accepted email's sent item and mailbox event are recorded. Recipient delivery is a separate outcome. |
notSent | This action cannot send. Its draft is editable again. |
uncertain | Samva cannot yet establish the outcome safely. Keep the action and contact support; do not send a replacement. |
messageId and acceptedAt stay null until acceptance is established. draftId and threadId
can be null. skippedRecipients lists recipients omitted from the accepted email and why.
waitReason and reviewExpectedAt describe any delivery wait after acceptance; they can be null.
executeUntil is the sending deadline, and retryAt is the next planned attempt, each an ISO 8601
instant or null. problem contains code and message, or is null. When a typed sending
error caused the wait or refusal, problem.error retains its _tag and structured fields.
decision explains why the action was allowed, held, or refused. Its decider is rule, model,
or person; reason explains the result, and scopes identifies the policies considered. Its id
identifies the decision, and its positive reviewRound identifies the review you read.
requirement is the resolved run, model, person, or never rule.
The decision can be null when no decision has been recorded. The action's createdAt and
updatedAt are ISO 8601 instants.
Follow an action
Read GET /v1/mailboxes/{id}/actions/{actionId} or use the SDK:
const action = await samva.mailboxes.getAction({ id: mailboxId, actionId: receipt.actionId });
if (action.type === "sendMessage" || action.type === "reply") {
console.log(action.state, action.send.messageId, action.send.problem);
}Send and reply actions expose their receipt as send and their intent, the frozen recipients, sender, subject,
body, attachments, and reply context being sent. intent can be null when the original content
requires reconciliation. An attachment uses the same public attachment
shape as an email send. Changes to mailbox settings do not change an approved email. Other action
types have their own states; handle type before interpreting a send state. A toolCall names its call in
tool, and a handoff gives the agent's reason for handing the conversation to people in
handoff.reason. Other non-send actions return null for both; send and reply actions have
neither field.
The associated draft is locked with lockedByActionId while approval, sending, or reconciliation
is pending. Editing the draft cannot change the held intent. Use approve with edits to
review replacement text on the held action. Denial, cancellation, or a definite unsent outcome
reopens the draft; acceptance marks it sent.
Subscribe to mailbox.action.pending_approval to learn about held sends, or list actions to find
state approvalRequired. Subscribe to mailbox.action.resolved to learn how each one ended. See
Events.
Approve or deny
Approve with POST /v1/mailboxes/{id}/actions/{actionId}/approve. It returns 202 with the action
while the send is pending and queues the frozen email; approval is not a sent confirmation.
Accepted, completed, and notSent replays return 200. Non-send approvals execute synchronously
and return 200 with their own execution states. Read the send receipt to follow progress.
Repeating the same permitted approval observes the same action rather than sending another email.
Read the action with getAction, or read its decision in getNeedsYou, before deciding. Both
approval and denial require that decision's positive reviewRound. Do not invent a round or
substitute a newer one without reviewing the action again.
REVIEW_ROUND=$(curl --fail-with-body \
https://api.samva.dev/v1/mailboxes/$MAILBOX_ID/actions/$ACTION_ID \
-H "Authorization: Bearer $SAMVA_OAUTH_TOKEN" \
-H "x-org-slug: acme" | jq -er '.decision.reviewRound')
curl -X POST https://api.samva.dev/v1/mailboxes/$MAILBOX_ID/actions/$ACTION_ID/approve \
-H "Authorization: Bearer $SAMVA_OAUTH_TOKEN" \
-H "x-org-slug: acme" \
-H "Content-Type: application/json" \
-d "{ \"reviewRound\": $REVIEW_ROUND }"To deny instead, call POST /v1/mailboxes/{id}/actions/{actionId}/deny with the observed
reviewRound and a reason. It returns 200 with the action. Nothing is sent, and the author's draft becomes editable.
curl -X POST https://api.samva.dev/v1/mailboxes/$MAILBOX_ID/actions/$ACTION_ID/deny \
-H "Authorization: Bearer $SAMVA_OAUTH_TOKEN" \
-H "x-org-slug: acme" \
-H "Content-Type: application/json" \
-d "{ \"reviewRound\": $REVIEW_ROUND, \"reason\": \"Wrong recipient.\" }"Both need a person with an admin grant on the mailbox. Nobody approves or denies their own
proposal. API keys cannot decide. A conflicting or stale review round returns
409. Refresh the action and review its current decision before deciding the new round.
The hosted MCP tools cannot approve or deny.
Approve with edits
Pass edits.text or edits.html in the approval body to replace a held message's body before it
sends. Recipients and reply context stay attached to the action. Tool-call approvals do not accept
message edits.
curl -X POST https://api.samva.dev/v1/mailboxes/$MAILBOX_ID/actions/$ACTION_ID/approve \
-H "Authorization: Bearer $SAMVA_OAUTH_TOKEN" \
-H "x-org-slug: acme" \
-H "Content-Type: application/json" \
-d "{ \"reviewRound\": $REVIEW_ROUND, \"edits\": { \"text\": \"Thanks for checking. Your refund is approved.\" } }"From the CLI, pass the observed round with
samva mailboxes actions approve mbx_... mbxact_... --review-round "$REVIEW_ROUND" --edit-text "Your reviewed reply" --yes.
The round is required for approvals with or without edits.
See how an approval ended
A held action records how its approval ended in resolution:
| Field | Notes |
|---|---|
outcome | approved, denied, or cancelled (withdrawn by a permitted person before a decision). |
actor | Who resolved it: kind, id, optional displayName, and source. |
resolvedAt | ISO 8601. |
reason | The denial reason; null for an approval or a cancellation. |
resolution is null while the action waits for approval and for an action that never needed
one. The same transition publishes one
mailbox.action.resolved event carrying the same
object, so a consumer holding a pending-approval event learns the outcome without polling.
Automatic waits and the sending deadline
Approval holds have no automatic expiry. Allowing or approving an action starts a 15-minute
sending window. executeUntil records its fixed deadline; retries and repeated approvals never
extend it. A send can have a shorter effective window, so follow the reported deadline.
Samva waits automatically for sender readiness, rate limits, a temporary mailbox pause, temporary service dependencies, or genuinely pending account review within that window. A request for more information, a requirement to reapply, rejection, revoked permission, or a payment requirement stops the unsent action. Fixing those conditions does not silently send it later. An ambiguous outcome needs reconciliation; it is not permission to submit again.
The deadline bounds acceptance, not delivery. An accepted email can still wait for delivery review and later delivery events. See Mailbox events.
Cancel or retry
A permitted person who proposed or approved the send can cancel before acceptance with
POST /v1/mailboxes/{id}/actions/{actionId}/cancel. It returns 200 with a notSent receipt. A held send
can also be cancelled. Once accepted, the email cannot be withdrawn: cancellation returns 409.
Retry uses POST /v1/mailboxes/{id}/actions/{actionId}/retry and returns 202 with a receipt.
It continues the original queued action only when retryEligible is true and its original
deadline still permits sending. Cleanup waiting after an ended send attempt does not block Retry.
A send attempt that is still running or whose status cannot be confirmed stays ineligible. Retry
preserves existing retry delays and never extends the deadline. An ordinary wait needs no Retry
request. API keys cannot cancel or Retry; these operations require a permitted
person. Retry cannot resubmit notSent or resolve uncertain.
Recover a lost response
Keep the original Idempotency-Key and body. Repeating them returns the same action's persisted
phase; using the key with a different body returns 409 (MailboxSendConflictError). Once you know actionId, read the action
to learn the outcome. An accepted or completed replay returns 200 with the accepted identity.
A queued, held, or uncertain replay returns 202. Do not invent a new key to recover a timeout or
an uncertain outcome: a new key is a new intentional send and can send another email.
An active action keeps its key binding through resolution. Terminal actions retain it for at least 24 hours after their terminal outcome. After that retention expires, reuse can create a new action. Save the action ID independently of the request key.
Send failures
Before an action is recorded, a request can return a structured API error. Branch on _tag and
follow the Error reference. If an error includes a receipt,
keep its actionId and observe that action before submitting anything again.
After proposal or approval, sending failures appear in the same action's problem and state.
Temporary conditions can leave it queued with retryAt while Samva waits within the fixed
executeUntil deadline. A definite unsent outcome becomes notSent; an ambiguous outcome becomes
uncertain and needs reconciliation. Repeating approval observes the same action. Follow
Cancel or retry rather than creating a replacement send to recover.
Send-time RateLimitedError and SenderNotReadyError leave the action queued; use retryAt
to see when Samva will check again. OnboardingReviewRequiredError waits only for an undecided
automated or manual review whose nextAction is wait_for_review. Other review decisions stop
the action as notSent. Inspect problem.error for the original review code, decision,
stage, nextAction, and identityId when supplied. Deadline expiry retains the last typed
error under problem.error. These conditions do not change an admitted command's 202 into
a synchronous 429, 503, or review 403. Request throttling before admission still returns
429; validation returns 422, and mailbox policy denial returns 403 with its receipt.
Configure decision rules
A policy contains presets, rules, and optional instructions. Use a rule's decide for a
default or atLeast for a floor that narrower scopes cannot loosen. Each rule supplies exactly
one of those fields. The requirements are run (allow), model (Auto: allow what the instructions cover, hold the rest), person (hold),
and never (refuse). A floor uses that order, from least to most restrictive.
Rules can match kind (send, reply, toolCall, or handoff), effect (read, write, or
final), channel, integration app name, tool name, and subject. A subject can be a kind, such as
apiKey, or one exact identity. Within a scope, the most specific matching rule wins: tool,
integration, kind, effect, channel, then subject. A narrower scope replaces a broader default;
every matching floor still applies.
Use PUT /v1/policies/{kind}/{id} to replace an organization, mailbox, or API key policy. Configure
an agent through definition.policy. The
agent scope holds only the rules added with always, and only an organization owner or admin can
read or change it. In the dashboard, a mailbox's Policy
settings and an API key's page offer the same Auto and Custom views as the
agent editor. A mailbox
policy needs mailbox administration access. Policy changes require a signed-in person or OAuth
session; API keys cannot change these rules. The API checks your authority for every scope.
import { createClient } from "samva";
const samva = createClient({
authToken: process.env.SAMVA_OAUTH_TOKEN!,
orgSlug: process.env.SAMVA_ORG_SLUG!,
});
const current = await samva.policies.getPolicy({ kind: "mailbox", id: "mbx_..." });
await samva.policies.setPolicy({
kind: "mailbox",
id: "mbx_...",
ifVersion: current.version,
presets: [],
rules: [{ match: { effect: "write" }, atLeast: "person" }],
});From the CLI, sign in with samva login, read the snapshot, and pin the version you reviewed:
POLICY_VERSION=$(samva policies get mailbox mbx_... --json | jq -er '.data.version')
samva policies set mailbox mbx_... --if-version "$POLICY_VERSION" \
--data '{"presets":[],"rules":[{"match":{"effect":"write"},"atLeast":"person"}]}'
samva policies get mailbox mbx_... --jsonRead and replace a policy
GET /v1/policies/{kind}/{id} returns a flat snapshot: the configuration fields plus version.
An unset policy has version 0; a stored policy has a positive version. Read the snapshot and
review its rules before replacing them. The examples above replace the complete policy; keep any
existing presets, rules, or instructions that you still need.
PUT requires the observed version as ifVersion alongside the replacement configuration.
DELETE /v1/policies/{kind}/{id}?ifVersion=<observed-version> clears the policy and returns an
empty snapshot with the next version. Every replacement and clear increments the version; clearing
does not reset the counter. Changes that append rules also advance it.
A stale ifVersion returns ConflictError (409). Reload the snapshot, review the changes, and
prepare a new replacement. Never automatically retry an old full configuration with a newer
version. A missing or invalid version returns 422; ifVersion must be an integer of at least
zero.
The CLI reads the current version before set or clear when --if-version is omitted. Pass
--if-version explicitly when editing a snapshot you already read. Changing or clearing a policy
does not release held actions. They wait for a person to approve or deny them.