Node.js SDK
import Migma from 'migma';
const migma = new Migma('YOUR_API_KEY');
const { data, error } = await migma.domains.createManaged({
prefix: 'yourcompany'
});curl --request POST \
--url https://api.migma.ai/v1/domains/managed \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"prefix": "<string>",
"region": "us-east-1"
}
'import requests
url = "https://api.migma.ai/v1/domains/managed"
payload = {
"prefix": "<string>",
"region": "us-east-1"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.migma.ai/v1/domains/managed",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'prefix' => '<string>',
'region' => 'us-east-1'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.migma.ai/v1/domains/managed"
payload := strings.NewReader("{\n \"prefix\": \"<string>\",\n \"region\": \"us-east-1\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.migma.ai/v1/domains/managed")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"prefix\": \"<string>\",\n \"region\": \"us-east-1\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.migma.ai/v1/domains/managed")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"prefix\": \"<string>\",\n \"region\": \"us-east-1\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"_id": "<string>",
"domain": "<string>",
"regionName": "<string>",
"mailFromDomain": "<string>",
"dnsRecords": [
{
"name": "<string>",
"value": "<string>",
"priority": 123
}
],
"ownershipVerified": true,
"openTracking": true,
"clickTracking": true,
"brandedTracking": true,
"createdAt": "2023-11-07T05:31:56Z",
"verifiedAt": "2023-11-07T05:31:56Z",
"isManagedDomain": true
},
"error": "<string>"
}{
"success": false,
"error": "<string>",
"code": "<string>",
"data": {}
}{
"success": false,
"error": "<string>",
"code": "<string>",
"data": {}
}Create Managed Domain
Create a managed subdomain on migma.email. The domain is instantly verified with no DNS setup required. Requires API key with domain:write.
POST
/
v1
/
domains
/
managed
Node.js SDK
import Migma from 'migma';
const migma = new Migma('YOUR_API_KEY');
const { data, error } = await migma.domains.createManaged({
prefix: 'yourcompany'
});curl --request POST \
--url https://api.migma.ai/v1/domains/managed \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"prefix": "<string>",
"region": "us-east-1"
}
'import requests
url = "https://api.migma.ai/v1/domains/managed"
payload = {
"prefix": "<string>",
"region": "us-east-1"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.migma.ai/v1/domains/managed",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'prefix' => '<string>',
'region' => 'us-east-1'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.migma.ai/v1/domains/managed"
payload := strings.NewReader("{\n \"prefix\": \"<string>\",\n \"region\": \"us-east-1\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.migma.ai/v1/domains/managed")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"prefix\": \"<string>\",\n \"region\": \"us-east-1\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.migma.ai/v1/domains/managed")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"prefix\": \"<string>\",\n \"region\": \"us-east-1\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"_id": "<string>",
"domain": "<string>",
"regionName": "<string>",
"mailFromDomain": "<string>",
"dnsRecords": [
{
"name": "<string>",
"value": "<string>",
"priority": 123
}
],
"ownershipVerified": true,
"openTracking": true,
"clickTracking": true,
"brandedTracking": true,
"createdAt": "2023-11-07T05:31:56Z",
"verifiedAt": "2023-11-07T05:31:56Z",
"isManagedDomain": true
},
"error": "<string>"
}{
"success": false,
"error": "<string>",
"code": "<string>",
"data": {}
}{
"success": false,
"error": "<string>",
"code": "<string>",
"data": {}
}Authorizations
API key authentication. Use 'Authorization: Bearer YOUR_API_KEY' where YOUR_API_KEY is obtained from the Migma dashboard under Settings → Developers → API Keys.
Body
application/json
Subdomain prefix (e.g., 'acme' creates acme.migma.email). Lowercase letters, numbers, and hyphens only.
Required string length:
3 - 63Pattern:
^[a-z0-9][a-z0-9-]*[a-z0-9]$|^[a-z0-9]$AWS SES region for sending
Available options:
us-east-1, eu-west-1 Was this page helpful?
⌘I