Manage a mailbox
Update a mailbox's name, endpoints, sending identity, and metadata, then pause, resume, or delete it with the consequences clear.
Use this guide to change an existing mailbox's configuration or stop its activity. You need an
admin grant and authentication allowed to manage mailboxes. A mailbox-scoped key cannot configure
a mailbox, even when its owner is an admin. See
Agents and keys for the access model.
Mailbox names, endpoint display names, and label display names follow the name limits.
Sending readiness
Email endpoints report sendingStatus: pending, ready, or failed. A new Samva-hosted address
can receive mail while sending setup is pending. Read the mailbox again with mailboxes.get;
it becomes ready when setup completes, without sending a message first. If setup fails, contact
support. ready describes the address's setup only: while the organization's email onboarding
review is undecided, a send from a ready address is admitted and waits. See
A send that stays queued. Phone endpoints do not carry this field. Mailbox list summaries report the primary
address's sending status, or null for a phone number.
Pass idempotencyKey to mailboxes.create, or the Idempotency-Key header to
POST /v1/mailboxes, to retry a create safely. The same key and body return the original mailbox
with its current status; a different body with that key returns 409. The key belongs to the
caller in the organization and remains bound for the mailbox's lifetime.
Read the current configuration
Use the mailbox ID from creation or from mailboxes.list. Lists contain summaries; get returns
metadata and the mailbox's endpoints. Both include kind and owner: a personal mailbox names
its owner's user ID; a shared mailbox has owner: null. See
Personal mailboxes for their access rules.
import { createClient } from "samva";
const samva = createClient({ apiKey: process.env.SAMVA_API_KEY! });
const id = "mbx_...";
const mailbox = await samva.mailboxes.get({ id });
console.log(mailbox.name, mailbox.status, mailbox.endpoints);Understand endpoints
A mailbox owns endpoints: the places it receives and sends. Each endpoint belongs to a channel; an email endpoint is an email address. Each carries:
id, thembxep_identifier you pass to update or remove it.channel, which isemail.address, the email address, lowercased.displayName, the sender name its mail carries, ornull.default, whether new mail starts from this endpoint. One endpoint per channel is the default.sourceanddomainId, which say whether the address is hosted by Samva or sits on a verified domain of yours.
Add or remove an endpoint
A mailbox receives mail at every endpoint it holds. Add an email address under your hosted domain or
on a verified domain with receiving enabled, the same way you chose the first one. An address that
another mailbox holds is refused with 409.
import { createClient } from "samva";
const samva = createClient({ apiKey: process.env.SAMVA_API_KEY! });
const id = "mbx_7q2xk9mvt4znw8rh";
const withBilling = await samva.mailboxes.createEndpoint({
id,
channel: "email",
address: "billing@acme.samva.email",
displayName: "Acme Billing",
});
console.log(withBilling.endpoints);Adding an endpoint does not change which one the mailbox sends new mail from. Remove one by its
endpoint id, from the mailbox's endpoints:
import { createClient } from "samva";
const samva = createClient({ apiKey: process.env.SAMVA_API_KEY! });
const id = "mbx_7q2xk9mvt4znw8rh";
await samva.mailboxes.removeEndpoint({ id, endpointId: "mbxep_..." });Mail sent to a removed address stops reaching the mailbox; its existing threads and messages stay.
A mailbox keeps at least one endpoint, so removing the last one is refused with 422. Removing the
default endpoint moves the default to the oldest remaining endpoint on its channel. See
add an endpoint and
remove an endpoint for the contracts.
Add a WhatsApp number
A mailbox can also own a WhatsApp number your organization has connected. Post channel: "whatsapp"
and the number as address, in E.164 form or as a national number in your organization's default
region. The endpoint carries businessAccountId in place of source and domainId.
curl -X POST https://api.samva.dev/v1/mailboxes/mbx_.../endpoints \
-H "X-API-Key: samva_sk_live_your_api_key" \
-H "Content-Type: application/json" \
-d '{ "channel": "whatsapp", "address": "+16175550123", "displayName": "Acme Support" }'A number that is not connected, or that another mailbox holds, is refused. See Answer WhatsApp in a mailbox.
Receive unknown addresses
Enable catch-all receiving on your verified, active domain before creating a mailbox on it. No webhook endpoint or forwarding rule is required. Mail to a mailbox's own address reaches that mailbox as usual.
In the domain's receiving settings, choose Drop mail to unknown addresses (the default), or Deliver to an active mailbox with an email address on that domain. The mailbox belongs to the same organization. With no catch-all webhook endpoint, addresses that match neither an active mailbox nor a forwarding rule reach the chosen mailbox. The original recipient stays visible on the message. A catch-all webhook endpoint continues to receive every address; the unknown-address setting does not change it. Pausing or deleting the chosen mailbox, or removing its last email address on the domain, resets the setting to drop. Dropped unknown addresses never generate a bounce or delivery-status notification.
To remove a catch-all webhook while keeping receiving enabled, choose Remove webhook in the
domain's receiving settings, or send endpointId: null to
update catch-all configuration. Existing mailbox
and forwarding-rule delivery continues. Unknown addresses then follow the saved mailbox setting,
or are dropped when no mailbox is selected. Omitting endpointId keeps the webhook unchanged.
import { createClient } from "samva";
const samva = createClient({ apiKey: process.env.SAMVA_API_KEY! });
// Remove the webhook and route unknown addresses to this mailbox in one update.
await samva.email.updateCatchAllConfig({
domainId: "dom_abc123",
endpointId: null,
unknownRecipientMailboxId: "mbx_7q2xk9mvt4znw8rh",
});
// Return to dropping unknown addresses.
await samva.email.updateCatchAllConfig({
domainId: "dom_abc123",
unknownRecipientMailboxId: null,
});See update catch-all configuration and get catch-all configuration.
Choose the sending identity
Each endpoint sets its own sender name, and one endpoint is the default new mail leaves from. The
mailbox name and the sender name are separate fields: mail goes out from
Acme Support <support@...> when the endpoint has a displayName, and from the mailbox's name
when it does not.
import { createClient } from "samva";
const samva = createClient({ apiKey: process.env.SAMVA_API_KEY! });
const id = "mbx_7q2xk9mvt4znw8rh";
await samva.mailboxes.updateEndpoint({
id,
endpointId: "mbxep_...",
displayName: "Acme Support",
default: true,
});default: true makes this endpoint the one new mail starts from, and the previous default stops
being the default. There is no default: false; choose another endpoint instead. Set
displayName: null to remove the sender name, so sends use the mailbox's name; renaming the
mailbox renames what later sends show. A reply leaves from the endpoint its thread belongs to, not
from the default. An update changes only fields you name. Rename the mailbox with
mailboxes.update; the slug and endpoint list are not fields on that request. See
update an endpoint and
update a mailbox for the contracts.
import { createClient } from "samva";
const samva = createClient({ apiKey: process.env.SAMVA_API_KEY! });
const id = "mbx_7q2xk9mvt4znw8rh";
await samva.mailboxes.update({ id, name: "Customer support" });Keep application metadata
Metadata holds string values your app associates with the mailbox. Updates merge by key, and a
null value removes a key without replacing the rest.
import { createClient } from "samva";
const samva = createClient({ apiKey: process.env.SAMVA_API_KEY! });
const id = "mbx_7q2xk9mvt4znw8rh";
await samva.mailboxes.update({
id,
metadata: {
team: "support",
costCenter: "customer-operations",
oldRoutingTag: null,
},
});Read back with mailboxes.get to check the resulting configuration.
Mailbox allowance
Personal and shared mailboxes use the same allowance. Free includes 1 mailbox and refuses new mailboxes or invitations once that allowance is full. Pending personal invitations reserve capacity, so concurrent invitations cannot exceed the allowance. If mailbox setup fails after acceptance, the slot stays reserved until an owner or admin completes the address assignment.
Starter, Growth, and Scale allow additional mailboxes for $1 per extra mailbox per month. Mailbox storage has its own allowance and is checked separately; paying for another mailbox does not add storage. Check the organization's billing settings for its included mailboxes, storage, and current usage.
Understand storage usage
Mailbox storage measures retained received and sent messages:
- Received mail counts the bytes of its retained raw MIME message, including encoded attachments.
- Sent mail retained as structured content counts the UTF-8 bytes of its serialized message content, including inline base64 attachments, plus the bytes of each distinct separately retained attachment. These bytes are measured directly, without creating a raw MIME copy. Sent mail retained as raw MIME counts that raw message instead.
Each message counts once across the organization's mailboxes and recipients. A separately retained attachment counts once within a message; different messages that reuse it each count their own attachment bytes.
Threads and retained Spam count toward storage. Archiving, moving a thread to Trash, or pausing a mailbox keeps its messages. Permanently deleting the last mailbox copy of a message reduces usage. Permanently deleting Spam reduces usage when no mailbox still retains it. See Spam for organizing screened email and discarding held malware.
Check Mailbox storage in the organization's dashboard billing settings for its current usage and allowance. Storage measures retained mail rather than mail sent or received during a billing month.
Permanently delete mail
Moving a thread to Trash makes it recoverable for 30 days. Restoring it stops the countdown. Moving it to Trash again starts a new 30-day window. Samva permanently deletes threads after that window.
To delete a thread sooner, move it to Trash and call Delete a thread. To request permanent deletion of the threads currently in Trash, call Empty Trash. Both operations require the same mailbox permission as moving a thread to Trash. A copy in another mailbox stays there.
Pause and resume
Pausing stops new sends and stops new inbound mail reaching the mailbox. A shared mailbox's
existing conversations remain readable. A paused personal mailbox also refuses content reads by
its owner and agents until it is resumed. Mail that arrives while paused is not added when you
resume. Mail sent to a paused personal mailbox is not delivered. Authenticated senders receive a
mailbox-disabled bounce (5.2.1); unsafe, suppressed, bulk, and automated mail is dropped without
a bounce to prevent backscatter. This also applies after a personal mailbox owner leaves the
organization, while the address still resolves to that mailbox.
import { createClient } from "samva";
const samva = createClient({ apiKey: process.env.SAMVA_API_KEY! });
const id = "mbx_7q2xk9mvt4znw8rh";
const paused = await samva.mailboxes.pause({ id });
console.log(paused.status);
// Run when the mailbox should accept new mail again.
const resumed = await samva.mailboxes.resume({ id });
console.log(resumed.status);Resuming allows sending and receiving again from that point. It does not backfill inbound mail. New sends from a paused mailbox are refused; retrying a send that already ran can still replay its receipt. See pause and resume.
Delete a mailbox
Deletion removes the mailbox's endpoints, threads, drafts, and history. Messages the organization received are not added to a recreated mailbox: recreating the address does not restore its thread history or add earlier messages. Personal messages remain excluded from organization-level content views after deletion.
import { createClient } from "samva";
const samva = createClient({ apiKey: process.env.SAMVA_API_KEY! });
const id = "mbx_7q2xk9mvt4znw8rh";
await samva.mailboxes.remove({ id });The mailbox is removed from API key scopes and webhook endpoint mailbox filters. A key or endpoint left with no mailbox is disabled. Review those integrations before deleting; use pause when you need a reversible stop. See delete a mailbox for the response and errors.