Complete REST API documentation for managing mailboxes and messages
The DevInbox API provides REST endpoints for creating temporary and persistent mailboxes, retrieving messages, and sending email from persistent inboxes. All API requests use HTTPS and return JSON responses. Perfect for integration testing and automated workflows.
Include your API key in the X-Api-Key header of all requests:
curl -H "X-Api-Key: your_api_key_here" \ https://api.devinbox.io/mailboxes
https://api.devinbox.io
/status
Returns OK if the API service is running and available. This endpoint does not require authentication.
200 OK
curl https://api.devinbox.io/status
/mailboxes
Creates a new mailbox (temporary or persistent). Returns a unique mailbox key and password for SMTP authentication. Note: Persistent mailboxes can only be created via the web portal - API only supports temporary mailboxes.
{
"name": null,
"projectName": "my-project",
"isTemporary": true
}
name - Optional name for persistent mailboxes (API creates temporary only)projectName - Project to associate mailbox with (uses default if not specified)isTemporary - Must be true for API requests (default: true){
"key": "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6",
"password": "xyz789abcdef123456..."
}
{key}@devinbox.io
curl -X POST https://api.devinbox.io/mailboxes \ -H "X-Api-Key: your_api_key_here" \ -H "Content-Type: application/json" \ -d '{"projectName": "test-project", "isTemporary": true}'
400 - Project not found or persistent mailbox creation attempted401 - Invalid or missing API key429 - Rate limit exceeded/messages/{key}/count
Returns the total number of messages in the specified mailbox.
{
"key": "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6",
"count": 3
}
curl -H "X-Api-Key: your_api_key_here" \ https://api.devinbox.io/messages/a1b2c3d4e5f6/count
/messages/{key}?skip=0&take=10
Retrieves messages from a mailbox with pagination support.
skip - Number of messages to skip (default: 0)take - Number of messages to return (default: 10, max: 25){
"key": "a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6",
"count": 1,
"messages": [
{
"uniqueId": "12345678-1234-1234-1234-123456789abc",
"from": [ "noreply@example.com" ],
"to": [ "a1b2c3d4@devinbox.io" ],
"cc": null,
"bcc": null,
"subject": "Welcome to Our Service!",
"body": "<h1>Welcome!</h1><p>Thank you for signing up...</p>",
"isHtml": true,
"received": "2024-01-15T10:35:00Z"
}
]
}
curl -H "X-Api-Key: your_api_key_here" \ "https://api.devinbox.io/messages/a1b2c3d4e5f6?skip=0&take=5"
/messages/{key}/single
Returns the message when the mailbox contains exactly one message. Returns error if mailbox contains 0 or more than 1 message.
{
"uniqueId": "12345678-1234-1234-1234-123456789abc",
"from": [ "noreply@example.com" ],
"to": [ "a1b2c3d4@devinbox.io" ],
"cc": null,
"bcc": null,
"subject": "Welcome!",
"body": "Thank you for registering...",
"isHtml": false,
"received": "2024-01-15T10:35:00Z"
}
curl -H "X-Api-Key: your_api_key_here" \ https://api.devinbox.io/messages/a1b2c3d4e5f6/single
/messages/{key}/last
Returns the most recent message from the mailbox. Returns error if mailbox is empty.
curl -H "X-Api-Key: your_api_key_here" \ https://api.devinbox.io/messages/a1b2c3d4e5f6/last
/messages/{key}/get?id={guid}
Retrieves a specific message from the specified mailbox using its unique ID.
id - The unique GUID of the messagecurl -H "X-Api-Key: your_api_key_here" \ "https://api.devinbox.io/messages/a1b2c3d4e5f6/get?id=12345678-1234-1234-1234-123456789abc"
{key}@devinbox.io address, over SPF/DKIM-authenticated
infrastructure so receiving servers can verify the mail genuinely came from your inbox. Sending is available on persistent inboxes only.
/messages/{key}/send
Sends an email from the persistent inbox identified by {key}.
The API key must hold the send scope. The From address is always the
inbox's own address, {key}@devinbox.io.
{
"to": [ "customer@example.com" ],
"cc": null,
"bcc": null,
"subject": "Re: Your order #1024",
"text": "Thanks - your order is confirmed.",
"html": "<p>Thanks - your order is confirmed.</p>",
"inReplyTo": "12345678-1234-1234-1234-123456789abc"
}
to - Array of recipient addresses (required)cc - Optional array of CC addressesbcc - Optional array of BCC addresses. to, cc and bcc combined may not exceed 50 recipientssubject - Message subjecttext / html - Message body; provide text, html, or bothinReplyTo - Optional. The uniqueId of a message previously received in this inbox. Sets real In-Reply-To / References headers so your reply lands in the recipient's existing threadcurl -X POST https://api.devinbox.io/messages/a1b2c3d4e5f6/send \ -H "X-Api-Key: your_api_key_here" \ -H "Content-Type: application/json" \ -d '{"to": ["customer@example.com"], "subject": "Re: Your order #1024", "text": "Thanks - your order is confirmed.", "inReplyTo": "12345678-1234-1234-1234-123456789abc"}'
inReplyTo - agents can hold a conversation but
can't cold-email strangers. It keeps free-tier sending clean and protects deliverability for everyone. Cold outbound
(sending without inReplyTo) unlocks on the Developer plan and above.
400 - Invalid recipients, more than 50 combined, or a required field is missing401 - Invalid or missing API key403 - API key lacks the send scope, or a free-plan send omitted inReplyTo429 - Monthly send limit reached/messages/{key}/{template}/single
Returns the single message and parses it using the specified template. The mailbox must contain exactly one message. The response includes the original message data plus parsed template parameters.
{
"uniqueId": "12345678-1234-1234-1234-123456789abc",
"from": [ "noreply@example.com" ],
"to": [ "user123@devinbox.io" ],
"cc": null,
"bcc": null,
"subject": "Welcome to DevInbox, John Smith!",
"body": "<h1>Welcome John!</h1><p>Your verification code is ABC123</p>",
"isHtml": true,
"received": "2024-01-15T10:35:00Z",
"templateData": {
"subjectParams": {
"UserName": "John Smith",
"ProductName": "DevInbox"
},
"bodyParams": {
"FirstName": "John",
"VerificationCode": "ABC123",
"CompanyName": "Acme Corp"
},
"templateName": "welcome-email",
"matchSuccess": true
}
}
templateData object contains the extracted parameters from both subject and body,
plus metadata about the template matching process.
{
"uniqueId": "12345678-1234-1234-1234-123456789abc",
"from": [ "noreply@example.com" ],
"to": [ "user123@devinbox.io" ],
"subject": "Unexpected email format",
"body": "This email doesn't match the template",
"isHtml": false,
"received": "2024-01-15T10:35:00Z",
"templateData": {
"subjectParams": null,
"bodyParams": null,
"templateName": "welcome-email",
"matchSuccess": false,
"matchFailureReason": "Subject pattern did not match template"
}
}
curl -H "X-Api-Key: your_api_key_here" \ https://api.devinbox.io/messages/a1b2c3d4e5f6/welcome-email/single
/messages/{key}/{template}/last
Returns the most recent message and parses it using the specified template. Response format is identical to the single message endpoint above.
# Get password reset email and extract reset token curl -H "X-Api-Key: your_key" \ https://api.devinbox.io/messages/a1b2c3d4e5f6/password-reset/last # Verify welcome email contains correct user data curl -H "X-Api-Key: your_key" \ https://api.devinbox.io/messages/a1b2c3d4e5f6/user-registration/single # Extract order details from confirmation email curl -H "X-Api-Key: your_key" \ https://api.devinbox.io/messages/a1b2c3d4e5f6/order-confirmation/last
Templates use named capture groups to extract parameters:
Welcome to (?<ProductName>.*), (?<UserName>.*)!Hello (?<FirstName>.*?).*code is (?<VerificationCode>\w+)templateData200 OK - Request succeeded400 Bad Request - Invalid request parameters, template not found, or mailbox constraints not met401 Unauthorized - Invalid or missing API key403 Forbidden - Access denied to resource or tenant mismatch404 Not Found - Mailbox or message not found429 Too Many Requests - Rate limit exceeded{
"error": "Rate limit exceeded",
"message": "Monthly mailbox creation limit reached",
"retryAfter": "60"
}
Template 'template-name' not found or you don't have access to itMailbox 'key' contains X messages (for /single endpoint)Mailbox 'key' doesn't contain messages (for /last endpoint)Project 'project-name' not foundCreation of persistent mailboxes via API is not supportedTemplate verification failed: message does not match template patternInvalid template format: missing required capture groupsThe API includes rate limit information in response headers:
X-RateLimit-Remaining - Operations remainingX-RateLimit-Limit-Type - Type of limit (Monthly, Daily)| Plan | Mailboxes/Month | Verifications/Month |
|---|---|---|
| Developer (Free) | 500 | 1,000 |
| Team | 5,000 | 10,000 |
| Business | 25,000 | 50,000 |
| Enterprise | 100,000 | 200,000 |
import requests import time API_KEY = "your_api_key" BASE_URL = "https://api.devinbox.io" headers = {"X-Api-Key": API_KEY} # Create temporary mailbox response = requests.post( f"{BASE_URL}/mailboxes", headers=headers, json={"isTemporary": True}) mailbox = response.json() email_address = f"{mailbox['key']}@devinbox.io" # Wait for email and get single message time.sleep(5) # Wait for email delivery response = requests.get( f"{BASE_URL}/messages/{mailbox['key']}/single", headers=headers) message = response.json() print(f"Subject: {message['subject']}") # Get message with template verification template_response = requests.get( f"{BASE_URL}/messages/{mailbox['key']}/welcome-email/single", headers=headers) template_message = template_response.json() # Extract and validate template parameters if template_message['templateData']['matchSuccess']: user_name = template_message['templateData']['subjectParams']['UserName'] verification_code = template_message['templateData']['bodyParams']['VerificationCode'] print(f"Template matched! User: {user_name}, Code: {verification_code}") else: print(f"Template match failed: {template_message['templateData']['matchFailureReason']}")
Explore our open-source SDKs and contribute to the DevInbox ecosystem on GitHub.
Browse all DevInbox repositories and SDKs on GitHub.
C# client library for the DevInbox API.
Complete Python client generated from OpenAPI specification.
TypeScript/JavaScript SDK for managing test mailboxes.
Java client library for DevInbox API integration.