Register email domain
Saves the from e-mail of the tenant, the sender of its dunning e-mails, and registers the domain of its address as the email domain of the tenant with the e-mail provider of Aira, with open tracking on and click tracking off. Returns the DNS records that the tenant adds to the DNS of the domain, so that the provider verifies it. The dunning e-mails go out from the default sender of Aira until the provider verifies the email domain for the first time, and from the from e-mail after that. After the first verification, the dunning e-mails wait while the email domain is not verified.
Requires the role dunning:write.
curl --request POST \
--url https://api.useaira.com/v1/email-domains/ \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"fromEmail": "Acme <financeiro@acme.com>"
}
'import requests
url = "https://api.useaira.com/v1/email-domains/"
payload = { "fromEmail": "Acme <financeiro@acme.com>" }
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({fromEmail: 'Acme <financeiro@acme.com>'})
};
fetch('https://api.useaira.com/v1/email-domains/', 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.useaira.com/v1/email-domains/",
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([
'fromEmail' => 'Acme <financeiro@acme.com>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$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.useaira.com/v1/email-domains/"
payload := strings.NewReader("{\n \"fromEmail\": \"Acme <financeiro@acme.com>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<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.useaira.com/v1/email-domains/")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"fromEmail\": \"Acme <financeiro@acme.com>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.useaira.com/v1/email-domains/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"fromEmail\": \"Acme <financeiro@acme.com>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"domain": "acme.com",
"status": "not_started",
"dnsRecords": [
{
"record": "DKIM",
"type": "TXT",
"name": "mail._domainkey",
"value": "p=dkim-public-key",
"ttl": "Auto",
"priority": 123,
"status": "not_started"
}
],
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}Body
The from e-mail of the tenant.
The sender of the dunning e-mails of the tenant, as Name <address> or a bare address. The domain of the address becomes the email domain of the tenant, because the e-mail provider of Aira sends only from the exact domain that it verified.
1"Acme <financeiro@acme.com>"
Response
An email domain: a domain of the tenant, registered with the e-mail provider of Aira, that the invoice deliveries of the tenant go out from while the provider reports it verified or partially verified. A tenant has zero or one.
The verification status that the e-mail provider of Aira last reported. The invoice deliveries go out from the from e-mail of the tenant only while the email domain is verified or partially_verified.
not_started, pending, verified, failed, temporary_failure, partially_verified, partially_failed, unrecognized curl --request POST \
--url https://api.useaira.com/v1/email-domains/ \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"fromEmail": "Acme <financeiro@acme.com>"
}
'import requests
url = "https://api.useaira.com/v1/email-domains/"
payload = { "fromEmail": "Acme <financeiro@acme.com>" }
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({fromEmail: 'Acme <financeiro@acme.com>'})
};
fetch('https://api.useaira.com/v1/email-domains/', 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.useaira.com/v1/email-domains/",
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([
'fromEmail' => 'Acme <financeiro@acme.com>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>"
],
]);
$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.useaira.com/v1/email-domains/"
payload := strings.NewReader("{\n \"fromEmail\": \"Acme <financeiro@acme.com>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<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.useaira.com/v1/email-domains/")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"fromEmail\": \"Acme <financeiro@acme.com>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.useaira.com/v1/email-domains/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"fromEmail\": \"Acme <financeiro@acme.com>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"domain": "acme.com",
"status": "not_started",
"dnsRecords": [
{
"record": "DKIM",
"type": "TXT",
"name": "mail._domainkey",
"value": "p=dkim-public-key",
"ttl": "Auto",
"priority": 123,
"status": "not_started"
}
],
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}