Domains
Create domain
POST
/domains Add a domain to send from.
Parameters
namestringrequiredThe domain, e.g.
mail.lumen.dev.regionstringus-east-1, eu-west-1 or ap-northeast-1.custom_return_pathstringBounce subdomain label.
{
"name": "string",
"region": "string",
"custom_return_path": "string"
}Code samples
TypeScript
const res = await fetch('https://api.postwick.dev/domains', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({"name":"string","region":"string","custom_return_path":"string"}),
});
const data = await res.json();PHP
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://api.postwick.dev/domains');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"name":"string","region":"string","custom_return_path":"string"}');
$response = curl_exec($ch);
curl_close($ch);
echo $response;Python
import requests
res = requests.request(
"POST",
"https://api.postwick.dev/domains",
headers={
"Content-Type": "application/json",
},
json={"name": "string", "region": "string", "custom_return_path": "string"},
)
data = res.json()Ruby
require 'net/http'
require 'uri'
uri = URI('https://api.postwick.dev/domains')
req = Net::HTTP::Post.new(uri)
req['Content-Type'] = 'application/json'
req.body = '{"name":"string","region":"string","custom_return_path":"string"}'
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http|
http.request(req)
end
puts res.bodyGo
package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
req, _ := http.NewRequest("POST", "https://api.postwick.dev/domains", strings.NewReader(`{"name":"string","region":"string","custom_return_path":"string"}`))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}cURL
curl -X POST "https://api.postwick.dev/domains" \
-H "Content-Type: application/json" \
-d '{"name":"string","region":"string","custom_return_path":"string"}'Responses
200 OK
{
"id": "d91cd9bd",
"name": "mail.lumen.dev",
"status": "pending",
"records": [
{
"type": "TXT",
"name": "pw._domainkey.mail"
}
]
}Was this page helpful?