> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.monite.com/v2023-09-01/api/mailbox-domains/post-mailbox-domains/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.monite.com/_mcp/server. # Create a mailbox domain POST https://api.sandbox.monite.com/v1/mailbox_domains Content-Type: application/json Create domain for the partner_id Reference: https://docs.monite.com/api/mailbox-domains/post-mailbox-domains ## Authentication - `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer `, where token is your auth token. ## Servers - `https://api.sandbox.monite.com/v1` (sandbox, default) - `https://api.monite.com/v1` (eu_production) - `https://us.api.monite.com/v1` (na_production) ## Request ### Headers - `x-monite-version` (string, required) ### Body (application/json) This endpoint expects an object. - `domain` (string, required) — The domain name, such as `mail.mycompany.com`. Can contain only alphanumeric characters (A..Z a..z 0..9), dots (.), and hyphens (-). Each segment of the domain name must start and end with either a letter or a digit. ## Response ### 200 Successful Response - `id` (string, required) — Entry UUID - `dns_records` (DomainResponseDnsRecords, required) - `domain` (string, required) — The domain name. - `status` (string, required) - `dedicated_ip` (string, optional) — A dedicated IP address assigned to this mailbox and used to send outgoing email. - `last_updated_at` (datetime, optional) — The time the domain was updated for the last time ## Errors ### 422 Post Mailbox Domains Request Unprocessable Entity Error Validation Error - `detail` (list of ValidationError, optional) ### 500 Post Mailbox Domains Request Internal Server Error Internal Server Error - `error` (ErrorSchema, required) ## Types ### DomainResponseDnsRecords ### ValidationError - `loc` (list of ValidationErrorLocItem, required) - `msg` (string, required) - `type` (string, required) ### ErrorSchema - `message` (string, required) ### DnsRecords - `receiving_dns_records` (list of DnsRecord, required) — Set of DNS settings required by Mailgun for domain verification before emails receiving is possible. - `sending_dns_records` (list of DnsRecord, required) — Set of DNS settings required by Mailgun for domain verification before emails sending is possible. ### ValidationErrorLocItem ### DnsRecord - `is_active` (boolean, required) - `record_type` (enum, required) - Allowed values: `TXT`, `MX`, `CNAME` - `valid` (string, required) — Field reflecting validation status by Mailgun. - `value` (string, required) - `name` (string, optional) - `record_purpose` (enum, optional) — Purpose of specific entry to distinguish between various TXT entries. - Allowed values: `DKIM`, `SPF` ## Examples **Request** ```json { "domain": "domain" } ``` **Response** ```json { "id": "id", "dns_records": { "receiving_dns_records": [ { "is_active": true, "name": "name", "record_purpose": "DKIM", "record_type": "TXT", "valid": "valid", "value": "value" } ], "sending_dns_records": [ { "is_active": true, "name": "name", "record_purpose": "DKIM", "record_type": "TXT", "valid": "valid", "value": "value" } ] }, "domain": "domain", "status": "status", "dedicated_ip": "dedicated_ip", "last_updated_at": "2024-01-15T09:30:00Z" } ``` **SDK Code** ```python import requests url = "https://api.sandbox.monite.com/v1/mailbox_domains" payload = { "domain": "domain" } headers = { "x-monite-version": "2023-09-01", "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.sandbox.monite.com/v1/mailbox_domains'; const options = { method: 'POST', headers: { 'x-monite-version': '2023-09-01', Authorization: 'Bearer ', 'Content-Type': 'application/json' }, body: '{"domain":"domain"}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.sandbox.monite.com/v1/mailbox_domains" payload := strings.NewReader("{\n \"domain\": \"domain\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("x-monite-version", "2023-09-01") req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://api.sandbox.monite.com/v1/mailbox_domains") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["x-monite-version"] = '2023-09-01' request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"domain\": \"domain\"\n}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.sandbox.monite.com/v1/mailbox_domains") .header("x-monite-version", "2023-09-01") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"domain\": \"domain\"\n}") .asString(); ``` ```php request('POST', 'https://api.sandbox.monite.com/v1/mailbox_domains', [ 'body' => '{ "domain": "domain" }', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', 'x-monite-version' => '2023-09-01', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.sandbox.monite.com/v1/mailbox_domains"); var request = new RestRequest(Method.POST); request.AddHeader("x-monite-version", "2023-09-01"); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"domain\": \"domain\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "x-monite-version": "2023-09-01", "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = ["domain": "domain"] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.sandbox.monite.com/v1/mailbox_domains")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```