Every customer gets an inbox.
Your app gives each customer an address on your domain, and an agent to answer it. Verify the domain once. Each new customer is then a call or two.
One shared inbox mixes every customer's mail.
And any key on it reaches all of them. Give each customer a box: their mail, their key and their agent stay apart.
jo@example.com
My invoice is wrongyour app
New customer: one call, one more inbox.c37
c38
c39
c40
c41
c42
c43
c44
c45
c46
c47
c48
c49
c50
c51
c52
c53
c54
mail.yourapp.com, verified oncec42's agent
Its key reaches this inbox. Any other answers 404.your webhook
data.inbox says whose mail it is.jo@example.com
My invoice is wrongc38
c39
c40
c41
c42
c43
c44
c45
c46
c47
c48
c49
c50
c51
c52
mail.yourapp.com, verified oncec42's agent
Its key reaches this inbox. Any other answers 404.your webhook
data.inbox says whose mail it is.One call per customer
Make the address and tag it with your own id. Filter by it later withmetadata[customerId].A key for one box
POST /v1/agentsgives the customer's agent a key that reaches their inbox only. Other inboxes answer 404. Its first mail to a new address waits for someone on your team, unless it's a reply to a verified sender in the same thread on an open desk. A person turns that on, per inbox.One webhook for everyone
Each new-mail event carriesdata.inbox, so one endpoint can serve every customer.
Two ways to lay it out.
Both use the same domain and the same API. Pick by who holds the keys and whether you bill per customer.
| For each customer | Tagged inboxes, one project | A project per customer |
|---|---|---|
| Set up with | POST /v1/inboxes | POST /v1/projects |
| A key that only reaches it | an agent's key with inboxIds | an agent's key in that project |
| Usage to bill it | No | GET /v1/projects/:id/usage |
| A daily send limit | No | limits.sendPerDay |
| Best when | you run every agent yourself | you bill by use or hand out keys |
A new customer, in a call or two.
Verify the domain once. After that, this is all a new customer takes. Your server's key makes these calls, and the agent only gets its own key.
curl -X POST https://api.drin.run/v1/inboxes \
-H "Authorization: Bearer $DRIN_KEY" \
-H 'content-type: application/json' \
-d '{ "address": "c42@mail.yourapp.com", "domainId": "<mail.yourapp.com>",
"displayName": "Customer 42", "metadata": { "customerId": "c_42" } }'
# Later, find it by your own id
GET /v1/inboxes?metadata[customerId]=c_42# An agent and its key, for that customer: this inbox only
curl -X POST https://api.drin.run/v1/agents \
-H "Authorization: Bearer $DRIN_KEY" \
-H 'content-type: application/json' \
-d '{ "name": "Agent, customer 42", "preset": "send_read",
"inboxIds": ["<c42 inbox id>"], "expiresInDays": 90 }'
# → { "agent": { … }, "apiKey": { "key": "drin_…", … } } shown once# Wake the agent you run for customer 42, on its mail only.
# Your server's full-access key does this, as no person is there for each new
# customer. It applies now, and the owners get an email. Any other key waits.
curl -X POST https://api.drin.run/v1/wake-targets \
-H "Authorization: Bearer $DRIN_KEY" \
-H 'content-type: application/json' \
-d '{ "kind": "generic", "url": "https://agents.yourapp.com/c42",
"token": "<a secret per customer>", "inboxIds": ["<c42 inbox id>"] }'# Or a whole project: domain and inboxes, all or nothing
curl -X POST https://api.drin.run/v1/projects \
-H "Authorization: Bearer $ACCOUNT_KEY" \
-H "X-Drin-Product: yourapp" \
-H 'content-type: application/json' -d '{
"name": "Customer 42",
"domains": ["mail.yourapp.com"],
"inboxes": [{ "address": "c42@mail.yourapp.com" }]
}'
# Then its agent, inside that project
curl -X POST https://api.drin.run/v1/agents \
-H "Authorization: Bearer $ACCOUNT_KEY" \
-H "X-Drin-Product: yourapp" \
-H 'content-type: application/json' \
-d '{ "name": "Agent, customer 42", "project": "customer-42", "preset": "send_read" }'Your first customer, today.
Verify your domain, make an inbox and point an agent at it.