Postmark API
api.postmarkapp.com · Communication
High-deliverability transactional email API — fast delivery, detailed open/click tracking, bounce handling, templates, and inbound email parsing. 98.7% inbox rate. Free: 100 emails/month.
Authentication
API Key
Server token from postmarkapp.com. Pass as X-Postmark-Server-Token header.
Sample Requests
POST
Send email
Send a transactional email via Postmark.
https://api.postmarkapp.com/email
Hover any highlighted part to learn what it does
Headers — extra info sent with the request
| Accept | application/json |
| Content-Type | application/json |
| X-Postmark-Server-Token | YOUR_TOKEN |
Request Body — data you're sending
{
"To": "[email protected]",
"From": "[email protected]",
"Subject": "Hello from Postmark",
"TextBody": "Testing Postmark API!",
"MessageStream": "outbound"
}
curl -X POST "https://api.postmarkapp.com/email" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-Postmark-Server-Token: YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"To":"[email protected]","From":"[email protected]","Subject":"Hello from Postmark","TextBody":"Testing Postmark API!","MessageStream":"outbound"}'import requests
headers = {
"Accept": "application/json",
"Content-Type": "application/json",
"X-Postmark-Server-Token": "YOUR_TOKEN"
}
data = {
"To": "[email protected]",
"From": "[email protected]",
"Subject": "Hello from Postmark",
"TextBody": "Testing Postmark API!",
"MessageStream": "outbound"
}
response = requests.post(
"https://api.postmarkapp.com/email",
headers=headers,
json=data,
)
print(response.json())const url = 'https://api.postmarkapp.com/email';
const response = await fetch(url, {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'X-Postmark-Server-Token': 'YOUR_TOKEN'
},
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
"To": "[email protected]",
"From": "[email protected]",
"Subject": "Hello from Postmark",
"TextBody": "Testing Postmark API!",
"MessageStream": "outbound"
}),
});
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"bytes"
"encoding/json"
)
func main() {
targetURL := "https://api.postmarkapp.com/email"
jsonData, _ := json.Marshal({"To":"[email protected]","From":"[email protected]","Subject":"Hello from Postmark","TextBody":"Testing Postmark API!","MessageStream":"outbound"})
req, _ := http.NewRequest("POST", targetURL, bytes.NewBuffer(jsonData))
req.Header.Set("Accept", "application/json")
req.Header.Set("Content-Type", "application/json")
req.Header.Set("X-Postmark-Server-Token", "YOUR_TOKEN")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://api.postmarkapp.com/email")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Post.new(uri)
req["Accept"] = "application/json"
req["Content-Type"] = "application/json"
req["X-Postmark-Server-Token"] = "YOUR_TOKEN"
req["Content-Type"] = "application/json"
req.body = "{\"To\":\"[email protected]\",\"From\":\"[email protected]\",\"Subject\":\"Hello from Postmark\",\"TextBody\":\"Testing Postmark API!\",\"MessageStream\":\"outbound\"}"
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://api.postmarkapp.com/email";
$opts = ["http" => [
"method" => "POST",
"header" => implode("\r\n", [
"Accept: application/json",
"Content-Type: application/json",
"X-Postmark-Server-Token: YOUR_TOKEN",
"Content-Type: application/json"
]),
"content" => json_encode({"To":"[email protected]","From":"[email protected]","Subject":"Hello from Postmark","TextBody":"Testing Postmark API!","MessageStream":"outbound"}),
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));Postman Setup Guide
- Sign up at postmarkapp.com — 100 free emails/month forever
- Get server token from your Postmark account
- Set X-Postmark-Server-Token: YOUR_TOKEN header
- Use POSTMARK_API_TEST as token for testing without sending real emails
- MessageStream: outbound (transactional) or broadcasts (bulk)