Documentation menu
API reference
Sending
Put a message into an inbox over HTTP, without SMTP.
Put a message into an inbox over HTTP
POST/v1/inboxes/{id}/send
Builds a MIME message and stores it as if it had arrived over SMTP. It counts toward your monthly quota. Nothing is delivered to the recipients.
Path parameters
- idstringrequiredInbox ID.
Request body
- fromobjectrequired
Child attributes
- namestring
- emailstring (email)required
- toarray of objectsrequired
Child attributes
- namestring
- emailstring (email)required
- ccarray of objects
Child attributes
- namestring
- emailstring (email)required
- bccarray of objects
Child attributes
- namestring
- emailstring (email)required
- reply_toarray of objects
Child attributes
- namestring
- emailstring (email)required
- subjectstringrequired
- textstring
- htmlstring
- headersobject
- tagsarray of strings
- attachmentsarray of objects
Child attributes
- filenamestringrequired
- content_typestring
- contentstring (byte)Base64.
Returns
- idstringrequired
Errors
400The request was malformed or a value was invalid.
401Missing or invalid API key.
402The workspace has used its monthly email allowance (`quota_reached`). Sending over SMTP answers `552` in
the same situation.
403The key is read-only, or the action needs a dashboard session.
404No such object in this workspace.
429Too many requests. Wait `Retry-After` seconds.
curl -X POST "https://app.mailbench.dev/v1/inboxes/box_g3bekcev4z7i4psq/send" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"from": {"name": "Sam", "email": "sam@example.org"}, "to": [ {"name": "Sam", "email": "sam@example.org"} ], "cc": [ {"name": "Sam", "email": "sam@example.org"} ], "bcc": [ {"name": "Sam", "email": "sam@example.org"} ], "reply_to": [ {"name": "Sam", "email": "sam@example.org"} ], "subject": "Welcome aboard", "text": "Hello from the API.", "html": "<p>Hello from the API.</p>", "headers": {}, "tags": [ "billing" ], "attachments": [ {"filename": "string", "content_type": "application/octet-stream", "content": "SGVsbG8="} ]}'const res = await fetch("https://app.mailbench.dev/v1/inboxes/box_g3bekcev4z7i4psq/send", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
"from": {
"name": "Sam",
"email": "sam@example.org"
},
"to": [
{
"name": "Sam",
"email": "sam@example.org"
}
],
"cc": [
{
"name": "Sam",
"email": "sam@example.org"
}
],
"bcc": [
{
"name": "Sam",
"email": "sam@example.org"
}
],
"reply_to": [
{
"name": "Sam",
"email": "sam@example.org"
}
],
"subject": "Welcome aboard",
"text": "Hello from the API.",
"html": "<p>Hello from the API.</p>",
"headers": {},
"tags": [
"billing"
],
"attachments": [
{
"filename": "string",
"content_type": "application/octet-stream",
"content": "SGVsbG8="
}
]
}),
});
const { data } = await res.json();import os, requests
res = requests.post(
"https://app.mailbench.dev/v1/inboxes/box_g3bekcev4z7i4psq/send",
headers={"Authorization": f"Bearer {os.environ['API_KEY']}"},
json={
"from": {
"name": "Sam",
"email": "sam@example.org",
},
"to": [
{
"name": "Sam",
"email": "sam@example.org",
},
],
"cc": [
{
"name": "Sam",
"email": "sam@example.org",
},
],
"bcc": [
{
"name": "Sam",
"email": "sam@example.org",
},
],
"reply_to": [
{
"name": "Sam",
"email": "sam@example.org",
},
],
"subject": "Welcome aboard",
"text": "Hello from the API.",
"html": "<p>Hello from the API.</p>",
"headers": {
},
"tags": [
"billing",
],
"attachments": [
{
"filename": "string",
"content_type": "application/octet-stream",
"content": "SGVsbG8=",
},
],
},
)
data = res.json()["data"]{
"success": true,
"data": {
"id": "msg_c4p2f3a9wq"
}
}