Could you send the final logo files by Friday? SVG and PNG, please.
An address for every user.
Your backend makes an inbox for each user at sign-up, and every email reaches your server with the id of the user it belongs to.
// Ana signed up to Wrenly: her assistant's addressPOST /v1/inboxes{ "username": "wrenly-ana", "client_id": "user_4821", "display_name": "Ana Silva's assistant" }201 { "address": "wrenly-ana@blueping.dev" }// An email for her: the event names her id{ "type": "email.received", "inbox": { "client_id": "user_4821" } }
wrenly-ana
Ana Silva's assistant, on Wrenly
Hi Lucía, Ana has them ready. She will send the SVG and PNG files on Thursday.
Ana's assistant · wrenly-ana
{ "type": "email.received", "data": { "inbox": { "address": "wrenly-ana@blueping.dev " }, "message": { "id": "em_5Tr9Qx2M", "from": { "address": "lucia@marin-studio.example" }, "subject": "Logo files for the launch", "auth": { "verdict": "pass" } } }}
Lucía writes to wrenly-ana@blueping.dev, the event names Ana's id at Wrenly, and her assistant answers from the address Wrenly made for her at sign-up.
How do I give every user of my app an agent with its own email address?
Create an inbox per user with POST /v1/inboxes and your user's id as client_id, at sign-up, or 50 at a time with POST /v1/inboxes/batch for the users you already have. Every webhook event names its inbox with that client_id, so your server knows whose mail it is, and GET /v1/usage counts each inbox's sends and receipts.
Why one shared mailbox breaks a product with many users
Wrenly is an assistant app for freelance designers. Each of its 340 users has an assistant that clients write to about quotes, files and deadlines, and that the designer copies on threads. In the first version every assistant shared one mailbox, and each email was matched to its designer by a tag in the address.
Clients who typed the address from memory dropped the tag, so mail reached nobody or the wrong designer. Any assistant could read every other designer's clients. One busy week of sending put the whole shared mailbox at risk with its provider. And when a designer left, their tag kept receiving password resets for accounts nobody owned anymore.
Now each designer's assistant has an inbox of its own, such as wrenly-ana@blueping.dev, made by Wrenly's backend the moment the designer signs up. Mail reaches the right assistant by its address alone, each event says which user it belongs to, and a designer who leaves takes the address with them: it is retired and never given to anyone again.
From a new user to an address that works
Five steps, each made from your backend with the agent's key, at moments your product already has: a sign-up, a new email, the end of the month and a user who leaves.
Create the inbox at sign-up
Wrenly's sign-up handler asks for an inbox with the designer's id as
client_id, ausernamebuilt from their handle and adisplay_nameclients will read. A retry finds the same inbox byclient_id, so a sign-up that failed halfway never leaves a second address behind.Call: POST
/v1/inboxeswithusername,display_nameandclient_idAnswer:
201withidandaddress, or200with the inbox thisclient_idalready madeChecked: The plan's inboxes and the day's creates, 20 a day on Free, 100 on Developer, 500 on Startup and 500 on Scale; a name already in use answers
409 username_takenBring existing users over in batches
The designers who signed up before move over in calls of up to 50. Each item answers on its own, by its index, so one taken username doesn't stop the rest: the program retries those without a username, for a generated address.
Call: POST
/v1/inboxes/batchwith up to 50 itemsAnswer:
200withdata: each item'sindex,status, and itsinboxor itserrorChecked: Every item meets the rules of a single create; with a
client_idon each, the same batch sent twice makes nothing twiceRoute each email to its user
One webhook endpoint hears every inbox of the agent. Each event carries
data.inboxwith theclient_idWrenly gave it, so the handler finds the designer with no table of addresses to keep.Call: POST
/v1/webhookswithurlandeventsAnswer:
201with the endpoint and its signingsecret, shown onceChecked: Each delivery is signed, and tried 7 times over about 31 hours while your server is down
Count what each user uses
At the end of the month, Wrenly reads every inbox's numbers, bills the designers on its paid tier and warns those near the sends its free tier allows.
Call: GET
/v1/usage, 100 inboxes a pageAnswer:
totalsfor the agent, and ininboxes.dataa line for each inbox that had mail, with itssent,received,deliveredandbouncedChecked: A key made for one inbox, or
inbox_id, reads that inbox's numbers aloneRetire the address when a user leaves
A designer who closes their account has their inbox deleted, mail included. The address is retired for good, so no later user can receive the resets of accounts the old assistant opened.
Call: DELETE
/v1/inboxes/{id}, or POST/v1/inboxes/batch-deletefor up to 100Answer:
200withdeleted: trueChecked: A retired address is refused to every later create, this agent's own included
An email.received event as Wrenly's endpoint gets it, cut to the fields it routes by:
{
"id": "evt_3Pw8Lc1Vx6Qk9Hd2",
"type": "email.received",
"data": {
"channel": "email",
"inbox": { "id": "inb_8Nw4Kd2Lq7Xc5Vb1", "address": "wrenly-ana@blueping.dev", "client_id": "user_4821" },
"message": {
"id": "em_5Tr9Qx2Mb8Wk3Lp6",
"from": { "address": "lucia@marin-studio.example", "name": "Lucía Marín" },
"subject": "Logo files for the launch",
"auth": { "verdict": "pass" }
}
}
}Provisioning in Python and Node.js
The program does what Wrenly's backend does at three moments: it creates the inboxes of new users in one batch, prints the month's numbers of each inbox that had mail, and deletes the inbox of a user who left. USERS stands for your users table.
# provision_users.py: an inbox per user, each inbox's month, and the address of a user who left retired.
# pip install requests
import os
import requests
API = "https://blueping.dev/v1"
USERS = [("user_4821", "ana", "Ana Silva"), ("user_4822", "kofi", "Kofi Asante"), ("user_4823", "iris", "Iris Novak")]
LEFT = {"user_4823"} # closed their Wrenly account
session = requests.Session()
session.headers["Authorization"] = f"Bearer {os.environ['BLUEPING_API_KEY']}"
items = [{"client_id": user_id, "username": f"wrenly-{handle}", "display_name": f"{name}'s assistant"} for user_id, handle, name in USERS]
answer = session.post(f"{API}/inboxes/batch", json={"inboxes": items}).json()
inboxes = {}
for result in answer["data"]:
item = items[result["index"]]
inbox = result.get("inbox")
if result.get("error", {}).get("code") == "username_taken":
# Someone else holds this name: the inbox gets a generated address instead.
inbox = session.post(f"{API}/inboxes", json={key: value for key, value in item.items() if key != "username"}).json()
if not inbox or "error" in inbox:
print("not created", item["client_id"], (inbox or result)["error"]["next_action"])
continue
inboxes[item["client_id"]] = inbox
print(item["client_id"], inbox["address"])
usage = session.get(f"{API}/usage").json()
for line in usage["inboxes"]["data"]:
print("this month", line["address"], "sent", line["sent"], "received", line["received"])
for user_id in LEFT & inboxes.keys():
gone = session.delete(f"{API}/inboxes/{inboxes[user_id]['id']}").json()
print("retired", inboxes[user_id]["address"], gone["deleted"])// provision-users.mjs: an inbox per user, each inbox's month, and the address of a user who left retired.
// Node.js 18 or later, nothing to install.
const API = "https://blueping.dev/v1";
const USERS = [["user_4821", "ana", "Ana Silva"], ["user_4822", "kofi", "Kofi Asante"], ["user_4823", "iris", "Iris Novak"]];
const LEFT = new Set(["user_4823"]); // closed their Wrenly account
const headers = { Authorization: `Bearer ${process.env.BLUEPING_API_KEY}`, "Content-Type": "application/json" };
const call = async (method, path, body) => (await fetch(API + path, { method, headers, body: body && JSON.stringify(body) })).json();
const items = USERS.map(([id, handle, name]) => ({ client_id: id, username: `wrenly-${handle}`, display_name: `${name}'s assistant` }));
const answer = await call("POST", "/inboxes/batch", { inboxes: items });
const inboxes = {};
for (const result of answer.data) {
const item = items[result.index];
let inbox = result.inbox;
if (result.error?.code === "username_taken") {
// Someone else holds this name: the inbox gets a generated address instead.
const { username, ...rest } = item;
inbox = await call("POST", "/inboxes", rest);
}
if (!inbox || inbox.error) {
console.log("not created", item.client_id, (inbox ?? result).error.next_action);
continue;
}
inboxes[item.client_id] = inbox;
console.log(item.client_id, inbox.address);
}
const usage = await call("GET", "/usage");
for (const line of usage.inboxes.data) console.log("this month", line.address, "sent", line.sent, "received", line.received);
for (const id of Object.keys(inboxes).filter((id) => LEFT.has(id))) {
const gone = await call("DELETE", `/inboxes/${inboxes[id].id}`);
console.log("retired", inboxes[id].address, gone.deleted);
}A batch answers 200 even when some items fail, so read each item's status and error. Past the day's creates, the items left answer 429 rate_limited each, and the same batch sent the next day, with the same client_ids, creates only what is missing.
GET /v1/usage pages through inboxes 100 at a time with cursor. With inbox_id, it answers for that inbox alone, which is what a page of your product that shows one user their own numbers needs.
Look after the inboxes from an MCP client
The MCP server acts for one agent, so it suits the people who look after Wrenly's inboxes day to day rather than the sign-up path. Connected to Claude or Cursor, it answers questions about any user's inbox.
List the Blueping inboxes whose address starts with wrenly-. For wrenly-ana, show the five newest emails with their senders, and tell me how much it sent and received this month. Then tell me how many more emails the agent can send today.| Tool | What it does here |
|---|---|
list_inboxes | Finds inboxes by part of their address, a page at a time. |
list_messages | Reads one user's newest mail. |
get_usage | Gives the month's totals and the busiest inboxes, or one inbox's numbers with inbox_id. |
get_limits | Shows the sends left today and this month, and the inboxes left on the plan. |
rename_inbox | Moves a user's inbox to a new address when they change their handle. |
No MCP tool makes keys or creates agents, so a teammate connected this way can read and fix users' inboxes but never hand out credentials.
Hand each email to the right user's agent
Subscribe one endpoint to email.received for the whole agent with POST /v1/webhooks. Check each delivery's signature as Webhooks shows, then pass the event to the handler below, which finds the user by the inbox's client_id and hands the email to that user's agent.
# route_hook.py: the part of your webhook server that hands each email to the user it belongs to.
# Check the Blueping-Signature header before calling handle(): /docs/webhooks#verify has the code.
USERS = {"user_4821": "Ana Silva", "user_4822": "Kofi Asante"} # your users table
def run_assistant(user_id, message):
# Your agent's turn for this user: their prompt, their memory and their tools, never another user's.
print("for", USERS[user_id] + ":", message["subject"], "from", message["from"]["address"])
def handle(event):
if event["type"] != "email.received":
return
inbox = event["data"]["inbox"]
message = event["data"]["message"]
if inbox["client_id"] not in USERS:
print("no user for", inbox["address"], "any more: delete the inbox")
return
if message["auto_reply"] or message["bulk"]:
return # out-of-office answers and newsletters wait for the user's daily summary
run_assistant(inbox["client_id"], message)The handler needs no Blueping call: the event holds the user's id, the sender with its checks and the first 2,000 characters of the text. GET /v1/messages/{id} reads the whole email when the agent needs it.
Keeping each user's mail apart
In a product with many users, the mistake to rule out is one user's agent reading another user's mail.
An address per user, not a tag
Mail reaches an inbox by its address, so a client who forgets a tag can't land in a stranger's inbox. Each inbox keeps its own threads, labels, drafts and rules.
Every call names one inbox
Listing, sending and drafting take an inbox id, and GET /v1/search takes inbox_id. Run each user's agent with that user's inbox id alone, and its tools reach that inbox and nothing else.
A key for one inbox where it matters
A worker that serves one large customer can hold a key made for that customer's inbox: any other inbox answers 403 inbox_out_of_scope, and the key's permissions can stop at email:read and email:send.
A client's email can't steer another user's agent
Mail that tells an assistant to forward another designer's files is checked like any message: text aimed at a model holds it as suspicious, and it arrives as email.held, never as email.received.
No address is given twice
A deleted address is retired, and a renamed one too after its 30 days. A designer's old address can't become a new user's, so nobody inherits the clients, invoices and resets that went to it.
What 340 users' assistants need
Each assistant sends about 60 emails a month, most of them replies to clients who wrote first, so 340 users come to about 20,000 sends a month and 1,200 on a busy day. With files, a year of their mail fills about 20 GB.
Startup fits this setup: 500 inboxes, 75,000 sends a month and 7,500 a day, and 100 GB of storage, for $79 a month, or $780 a year.
Receiving is never counted, and each recipient of a send counts once. Every limit is on Limits, and every price on Pricing.
The API referenceWebhooksThe MCP serverBlueping vs AgentMailAll use cases
Last checked against the API on .
Questions about inboxes per user
What builders ask before they set it up. The docs answer the rest.
What address does each user get?
The username you pass, such as wrenly-ana, when it is free and doesn't pass for another company or for the platform. Leave it out and the inbox gets a generated address. A user who changes their handle keeps their inbox: PATCH /v1/inboxes/{id} with a new username moves it, the old address keeps receiving for 30 days, and an agent renames 3 inboxes a day at most.
Can each user have a key of their own?
For a few, yes: a key made for one inbox reaches it alone, and an agent holds 10 active keys. For a key per customer at any scale, give each customer an agent of their own with an organization's admin key: POST /v1/org/agents makes the agent, its inbox and a key for that inbox in one call, on a plan of its own. Keys and permissions has the details.
Do the users share the plan's sends?
Yes. Sends and storage count for the agent across its inboxes, and GET /v1/usage splits them by inbox, so you can cap or bill each user in your own product.
How many users can one agent serve?
As many as its plan holds inboxes, with creates paced by the day: 20 a day on Free, 100 on Developer, 500 on Startup and 500 on Scale. Pricing lists each plan's inboxes, and past the largest plan we size it with you.
Can one user's agent write to another's?
Yes, by address, like any email. Mail between Blueping inboxes is delivered inside Blueping at once and never counts toward the ramp of new recipients.
What happens to a user's mail when they leave?
Deleting the inbox removes its mail within the hour and retires the address. To keep a copy for your records, save what you need with GET /v1/messages/{id}/raw before you delete.
More agents at work
- Runs Sam's errands by email,sams-openclaw
@blueping.dev. What one user's agent does with its address: errands, answers and receipts. - Answers the planner's tasks,research-worker
@blueping.dev. Agents that write to each other, inside one product or across several. - Answers Orlenwood's customers,orlenwood-support
@blueping.dev. The same inbox for one team: customers write, the agent answers in the thread.
Give every user an address
One call at sign-up, one webhook for all of them, usage per inbox.