Add DNS Record
curl --request POST \
--url https://api.migma.ai/v1/domains/{domain}/dns-records \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"content": "<string>",
"type": "TXT",
"priority": 32767
}
'import requests
url = "https://api.migma.ai/v1/domains/{domain}/dns-records"
payload = {
"name": "<string>",
"content": "<string>",
"type": "TXT",
"priority": 32767
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', content: '<string>', type: 'TXT', priority: 32767})
};
fetch('https://api.migma.ai/v1/domains/{domain}/dns-records', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.migma.ai/v1/domains/{domain}/dns-records",
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([
'name' => '<string>',
'content' => '<string>',
'type' => 'TXT',
'priority' => 32767
]),
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/{domain}/dns-records"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"content\": \"<string>\",\n \"type\": \"TXT\",\n \"priority\": 32767\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/{domain}/dns-records")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"content\": \"<string>\",\n \"type\": \"TXT\",\n \"priority\": 32767\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.migma.ai/v1/domains/{domain}/dns-records")
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 \"name\": \"<string>\",\n \"content\": \"<string>\",\n \"type\": \"TXT\",\n \"priority\": 32767\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"record": {
"id": "rec_abc123",
"type": "TXT",
"name": "@",
"content": "google-site-verification=abc123",
"createdAt": "2026-08-20T12:00:00.000Z"
}
}
}{
"success": false,
"error": "<string>",
"code": "<string>",
"data": {}
}{
"success": false,
"error": "<string>",
"code": "<string>",
"data": {}
}{
"success": false,
"error": "<string>",
"code": "<string>",
"data": {}
}{
"success": false,
"error": "<string>",
"code": "<string>",
"data": {}
}Add DNS Record
Add a DNS record to a domain bought in Migma, for example Google Workspace MX records, a site-verification TXT, or an A record pointing a subdomain at a server. Migma’s email sending records are protected and managed automatically, duplicate SPF or DMARC records are refused, the root and www names are reserved for domain forwarding, and each domain is capped at 50 records. Returns 404 if the domain’s DNS zone is not hosted by Migma. Requires API key with domain:write permission.
POST
/
v1
/
domains
/
{domain}
/
dns-records
Add DNS Record
curl --request POST \
--url https://api.migma.ai/v1/domains/{domain}/dns-records \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"content": "<string>",
"type": "TXT",
"priority": 32767
}
'import requests
url = "https://api.migma.ai/v1/domains/{domain}/dns-records"
payload = {
"name": "<string>",
"content": "<string>",
"type": "TXT",
"priority": 32767
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', content: '<string>', type: 'TXT', priority: 32767})
};
fetch('https://api.migma.ai/v1/domains/{domain}/dns-records', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.migma.ai/v1/domains/{domain}/dns-records",
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([
'name' => '<string>',
'content' => '<string>',
'type' => 'TXT',
'priority' => 32767
]),
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/{domain}/dns-records"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"content\": \"<string>\",\n \"type\": \"TXT\",\n \"priority\": 32767\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/{domain}/dns-records")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"content\": \"<string>\",\n \"type\": \"TXT\",\n \"priority\": 32767\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.migma.ai/v1/domains/{domain}/dns-records")
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 \"name\": \"<string>\",\n \"content\": \"<string>\",\n \"type\": \"TXT\",\n \"priority\": 32767\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"record": {
"id": "rec_abc123",
"type": "TXT",
"name": "@",
"content": "google-site-verification=abc123",
"createdAt": "2026-08-20T12:00:00.000Z"
}
}
}{
"success": false,
"error": "<string>",
"code": "<string>",
"data": {}
}{
"success": false,
"error": "<string>",
"code": "<string>",
"data": {}
}{
"success": false,
"error": "<string>",
"code": "<string>",
"data": {}
}{
"success": false,
"error": "<string>",
"code": "<string>",
"data": {}
}Authorizations
Body
application/json
Was this page helpful?