Connect a mailbox
Connect a new mailbox for sending emails. Supports SMTP, Google OAuth, and Outlook OAuth. The connection is tested before the mailbox is saved.
curl -X POST "https://api.supasend.io/v1/mailboxes" \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY"
import requests
import json
url = "https://api.supasend.io/v1/mailboxes"
headers = {
"Content-Type": "application/json",
"X-API-Key": "YOUR_API_KEY"
}
response = requests.post(url, headers=headers)
print(response.json())
const response = await fetch("https://api.supasend.io/v1/mailboxes", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-Key": "YOUR_API_KEY"
}
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
)
func main() {
req, err := http.NewRequest("POST", "https://api.supasend.io/v1/mailboxes", nil)
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("X-API-Key", "YOUR_API_KEY")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
require 'net/http'
require 'json'
uri = URI('https://api.supasend.io/v1/mailboxes')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Content-Type'] = 'application/json'
request['X-API-Key'] = 'YOUR_API_KEY'
response = http.request(request)
puts response.body
{
"id": "example_string",
"type": "smtp",
"email": "user@example.com",
"display_name": "John Doe",
"status": "active",
"max_daily_sends": 500,
"imap_host": "example_string",
"imap_port": 42,
"imap_username": "John Doe",
"inbox_sync_enabled": true,
"inbox_sync_from": "2024-12-25T10:00:00Z",
"inbox_last_sync_at": "2024-12-25T10:00:00Z",
"inbox_last_error": "example_string",
"created_at": "2024-12-25T10:00:00Z",
"updated_at": "2024-12-25T10:00:00Z"
}
{
"error": "Bad Request",
"message": "The request contains invalid parameters or malformed data",
"code": 400,
"details": [
{
"field": "email",
"message": "Invalid email format"
}
]
}
{
"error": "Unauthorized",
"message": "Authentication required. Please provide a valid API token",
"code": 401
}
{
"error": "Conflict",
"message": "The request conflicts with the current state of the resource",
"code": 409,
"details": "Resource already exists"
}
{
"error": "Internal Server Error",
"message": "An unexpected error occurred on the server",
"code": 500,
"requestId": "req_1234567890"
}
POST
/v1/mailboxes
POST
Base URLstring
Target server for requests. Edit to use your own host.
API Key (header: X-API-Key)
X-API-Keystring
RequiredAPI key in the format sk_live_<64 hex characters>
API key in the format
sk_live_<64 hex characters>Content-Typestring
RequiredThe media type of the request body
Options: application/json
No request body parameters defined
Request Preview
Response
Response will appear here after sending the request
Authentication
header
X-API-Keystring
RequiredAPI Key for authentication. API key in the format sk_live_\<64 hex characters\>
Body
application/json
datastring
RequiredRaw application/json data
Responses
Was this page helpful?