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.
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.
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 quarantine mail count toward storage. Archiving, moving a thread to trash, or pausing a mailbox keeps its messages. Deleting a message or removing its last mailbox copy reduces usage; discarding quarantine mail reduces usage when no mailbox still retains it. See Quarantine for releasing and discarding held mail.
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.
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.