> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://developers.brevo.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developers.brevo.com/_mcp/server.

# Create a new sender domain

POST https://api.brevo.com/v3/senders/domains
Content-Type: application/json

Creates a new domain in Brevo.

Use this to:
- Add new domains for sending emails
- Set up domain authentication for better deliverability
- Configure DNS records for email authentication
- Establish domain-based sender identities

Key information returned:
- Created domain ID and configuration
- Required DNS records for authentication
- Domain provider detection results
- Setup instructions and next steps

Reference: https://developers.brevo.com/reference/create-domain

## Authentication

- `api-key` header (required) — The API key should be passed in the request headers as `api-key` for authentication.

## Request

### Body (application/json)

This endpoint expects an object.

- `name` (string, required) — Domain name to be added

## Response

### 200

Domain created successfully

- `id` (long, required) — ID of the Domain created
- `domain_name` (string, required) — Domain name
- `message` (string, required) — Success message with next steps
- `domain_provider` (string, optional) — Detected domain provider
- `dns_records` (object, optional) — DNS records required for domain authentication
  - `brevo_code` (object, required) — Brevo verification code record
    - `host_name` (string, required) — DNS record hostname
    - `type` (string, required) — DNS record type
    - `value` (string, required) — DNS record value
    - `status` (boolean, required) — Whether the record is properly configured
  - `dkim_record` (object, required) — DKIM authentication record
    - `host_name` (string, required) — DNS record hostname
    - `type` (string, required) — DNS record type
    - `value` (string, required) — DNS record value
    - `status` (boolean, required) — Whether the record is properly configured
  - `dmarc_record` (object, required) — DMARC policy record
    - `host_name` (string, required) — DNS record hostname
    - `type` (string, required) — DNS record type
    - `value` (string, required) — DNS record value
    - `status` (boolean, required) — Whether the record is properly configured

## Errors

### 400 Bad Request Error

bad request

- `code` (enum, required) — Error code displayed in case of a failure
  - Allowed values: `invalid_parameter`, `missing_parameter`, `out_of_range`, `campaign_processing`, `campaign_sent`, `document_not_found`, `not_enough_credits`, `permission_denied`, `duplicate_parameter`, `duplicate_request`, `method_not_allowed`, `unauthorized`, `account_under_validation`, `not_acceptable`, `bad_request`, `unprocessable_entity`, `Domain does not exist`, `Contact email not found`, `Attribute not found`, `Category id not found`, `Invalid parameters passed`, `Record(s) for identifier not found`, `Returned when query params are invalid`, `Returned when invalid data posted`, `Feed not found`, `Campaign ID not found`, `api-key not found`, `DMARC policy requires domain authentication`, `DNS records not properly configured`, `Invalid OTP code provided`, `OTP code has expired`, `Domain already exists in your account`, `The sum of all IP weights must equal 100`, `Authentication failed`, `Insufficient credits`, `Request already processed`
- `message` (string, required) — Readable message associated to the failure

## Examples

### Successful domain creation with DNS records

**Request**

```json
undefined
```

**Response**

```json
{
  "id": 5,
  "domain_name": "mycompany.com",
  "message": "Domain added successfully. To authenticate it, add following DNS records",
  "domain_provider": "Cloudflare",
  "dns_records": {
    "brevo_code": {
      "host_name": "@",
      "type": "TXT",
      "value": "brevo-code=abc123def456",
      "status": false
    },
    "dkim_record": {
      "host_name": "mail._domainkey",
      "type": "TXT",
      "value": "v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GN...",
      "status": false
    },
    "dmarc_record": {
      "host_name": "_dmarc",
      "type": "TXT",
      "value": "v=DMARC1; p=none; rua=mailto:dmarc@mycompany.com",
      "status": false
    }
  }
}
```

**SDK Code**

```typescript Successful domain creation with DNS records
import { BrevoClient } from "@getbrevo/brevo";

async function main() {
    const client = new BrevoClient({
        apiKey: "YOUR_API_KEY_HERE",
    });
    await client.domains.createDomain({});
}
main();

```

```python Successful domain creation with DNS records
from brevo import Brevo

client = Brevo(
    api_key="YOUR_API_KEY_HERE",
)

client.domains.create_domain()

```

```php Successful domain creation with DNS records
<?php

namespace Example;

use Brevo\Brevo;
use Brevo\Domains\Requests\CreateDomainRequest;

$client = new Brevo(
    apiKey: 'YOUR_API_KEY_HERE',
);
$client->domains->createDomain(
    new CreateDomainRequest([]),
);

```

```go Successful domain creation with DNS records
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.brevo.com/v3/senders/domains"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("api-key", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Successful domain creation with DNS records
require 'uri'
require 'net/http'

url = URI("https://api.brevo.com/v3/senders/domains")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["api-key"] = '<apiKey>'

response = http.request(request)
puts response.read_body
```

```java Successful domain creation with DNS records
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.brevo.com/v3/senders/domains")
  .header("api-key", "<apiKey>")
  .asString();
```

```csharp Successful domain creation with DNS records
using RestSharp;

var client = new RestClient("https://api.brevo.com/v3/senders/domains");
var request = new RestRequest(Method.POST);
request.AddHeader("api-key", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift Successful domain creation with DNS records
import Foundation

let headers = ["api-key": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.brevo.com/v3/senders/domains")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

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()
```

### Domain creation with automatic provider detection

**Request**

```json
undefined
```

**Response**

```json
{
  "id": 6,
  "domain_name": "example.com",
  "message": "Domain added successfully. To authenticate it, add following DNS records",
  "domain_provider": "GoDaddy",
  "dns_records": {
    "brevo_code": {
      "host_name": "@",
      "type": "TXT",
      "value": "brevo-code=xyz789abc123",
      "status": false
    },
    "dkim_record": {
      "host_name": "mail._domainkey",
      "type": "TXT",
      "value": "v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GN...",
      "status": false
    },
    "dmarc_record": {
      "host_name": "_dmarc",
      "type": "TXT",
      "value": "v=DMARC1; p=quarantine; rua=mailto:dmarc@example.com",
      "status": false
    }
  }
}
```

**SDK Code**

```typescript Domain creation with automatic provider detection
import { BrevoClient } from "@getbrevo/brevo";

async function main() {
    const client = new BrevoClient({
        apiKey: "YOUR_API_KEY_HERE",
    });
    await client.domains.createDomain({});
}
main();

```

```python Domain creation with automatic provider detection
from brevo import Brevo

client = Brevo(
    api_key="YOUR_API_KEY_HERE",
)

client.domains.create_domain()

```

```php Domain creation with automatic provider detection
<?php

namespace Example;

use Brevo\Brevo;
use Brevo\Domains\Requests\CreateDomainRequest;

$client = new Brevo(
    apiKey: 'YOUR_API_KEY_HERE',
);
$client->domains->createDomain(
    new CreateDomainRequest([]),
);

```

```go Domain creation with automatic provider detection
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.brevo.com/v3/senders/domains"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("api-key", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Domain creation with automatic provider detection
require 'uri'
require 'net/http'

url = URI("https://api.brevo.com/v3/senders/domains")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["api-key"] = '<apiKey>'

response = http.request(request)
puts response.read_body
```

```java Domain creation with automatic provider detection
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.brevo.com/v3/senders/domains")
  .header("api-key", "<apiKey>")
  .asString();
```

```csharp Domain creation with automatic provider detection
using RestSharp;

var client = new RestClient("https://api.brevo.com/v3/senders/domains");
var request = new RestRequest(Method.POST);
request.AddHeader("api-key", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift Domain creation with automatic provider detection
import Foundation

let headers = ["api-key": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.brevo.com/v3/senders/domains")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

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()
```

### Create a basic domain

**Request**

```json
{
  "name": "mycompany.com"
}
```

**Response**

```json
{
  "id": 5,
  "domain_name": "mycompany.com",
  "message": "Domain added successfully. To authenticate it, add following DNS records",
  "domain_provider": "Cloudflare",
  "dns_records": {
    "brevo_code": {
      "host_name": "@",
      "type": "TXT",
      "value": "brevo-code=abc123def456",
      "status": false
    },
    "dkim_record": {
      "host_name": "mail._domainkey",
      "type": "TXT",
      "value": "v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GN...",
      "status": false
    },
    "dmarc_record": {
      "host_name": "_dmarc",
      "type": "TXT",
      "value": "v=DMARC1; p=none; rua=mailto:dmarc@mycompany.com",
      "status": false
    }
  }
}
```

**SDK Code**

```typescript Create a basic domain
import { BrevoClient } from "@getbrevo/brevo";

async function main() {
    const client = new BrevoClient({
        apiKey: "YOUR_API_KEY_HERE",
    });
    await client.domains.createDomain({
        name: "mycompany.com",
    });
}
main();

```

```python Create a basic domain
from brevo import Brevo

client = Brevo(
    api_key="YOUR_API_KEY_HERE",
)

client.domains.create_domain(
    name="mycompany.com",
)

```

```php Create a basic domain
<?php

namespace Example;

use Brevo\Brevo;
use Brevo\Domains\Requests\CreateDomainRequest;

$client = new Brevo(
    apiKey: 'YOUR_API_KEY_HERE',
);
$client->domains->createDomain(
    new CreateDomainRequest([
        'name' => 'mycompany.com',
    ]),
);

```

```go Create a basic domain
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.brevo.com/v3/senders/domains"

	payload := strings.NewReader("{\n  \"name\": \"mycompany.com\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("api-key", "<apiKey>")
	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 Create a basic domain
require 'uri'
require 'net/http'

url = URI("https://api.brevo.com/v3/senders/domains")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"mycompany.com\"\n}"

response = http.request(request)
puts response.read_body
```

```java Create a basic domain
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.brevo.com/v3/senders/domains")
  .header("api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"mycompany.com\"\n}")
  .asString();
```

```csharp Create a basic domain
using RestSharp;

var client = new RestClient("https://api.brevo.com/v3/senders/domains");
var request = new RestRequest(Method.POST);
request.AddHeader("api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"mycompany.com\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Create a basic domain
import Foundation

let headers = [
  "api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["name": "mycompany.com"] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.brevo.com/v3/senders/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()
```

### Create a subdomain

**Request**

```json
{
  "name": "newsletter.mycompany.com"
}
```

**Response**

```json
{
  "id": 5,
  "domain_name": "mycompany.com",
  "message": "Domain added successfully. To authenticate it, add following DNS records",
  "domain_provider": "Cloudflare",
  "dns_records": {
    "brevo_code": {
      "host_name": "@",
      "type": "TXT",
      "value": "brevo-code=abc123def456",
      "status": false
    },
    "dkim_record": {
      "host_name": "mail._domainkey",
      "type": "TXT",
      "value": "v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GN...",
      "status": false
    },
    "dmarc_record": {
      "host_name": "_dmarc",
      "type": "TXT",
      "value": "v=DMARC1; p=none; rua=mailto:dmarc@mycompany.com",
      "status": false
    }
  }
}
```

**SDK Code**

```typescript Create a subdomain
import { BrevoClient } from "@getbrevo/brevo";

async function main() {
    const client = new BrevoClient({
        apiKey: "YOUR_API_KEY_HERE",
    });
    await client.domains.createDomain({
        name: "newsletter.mycompany.com",
    });
}
main();

```

```python Create a subdomain
from brevo import Brevo

client = Brevo(
    api_key="YOUR_API_KEY_HERE",
)

client.domains.create_domain(
    name="newsletter.mycompany.com",
)

```

```php Create a subdomain
<?php

namespace Example;

use Brevo\Brevo;
use Brevo\Domains\Requests\CreateDomainRequest;

$client = new Brevo(
    apiKey: 'YOUR_API_KEY_HERE',
);
$client->domains->createDomain(
    new CreateDomainRequest([
        'name' => 'newsletter.mycompany.com',
    ]),
);

```

```go Create a subdomain
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.brevo.com/v3/senders/domains"

	payload := strings.NewReader("{\n  \"name\": \"newsletter.mycompany.com\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("api-key", "<apiKey>")
	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 Create a subdomain
require 'uri'
require 'net/http'

url = URI("https://api.brevo.com/v3/senders/domains")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"newsletter.mycompany.com\"\n}"

response = http.request(request)
puts response.read_body
```

```java Create a subdomain
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.brevo.com/v3/senders/domains")
  .header("api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"newsletter.mycompany.com\"\n}")
  .asString();
```

```csharp Create a subdomain
using RestSharp;

var client = new RestClient("https://api.brevo.com/v3/senders/domains");
var request = new RestRequest(Method.POST);
request.AddHeader("api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"newsletter.mycompany.com\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Create a subdomain
import Foundation

let headers = [
  "api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["name": "newsletter.mycompany.com"] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.brevo.com/v3/senders/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()
```

### Create a test domain

**Request**

```json
{
  "name": "test.example.com"
}
```

**Response**

```json
{
  "id": 5,
  "domain_name": "mycompany.com",
  "message": "Domain added successfully. To authenticate it, add following DNS records",
  "domain_provider": "Cloudflare",
  "dns_records": {
    "brevo_code": {
      "host_name": "@",
      "type": "TXT",
      "value": "brevo-code=abc123def456",
      "status": false
    },
    "dkim_record": {
      "host_name": "mail._domainkey",
      "type": "TXT",
      "value": "v=DKIM1; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GN...",
      "status": false
    },
    "dmarc_record": {
      "host_name": "_dmarc",
      "type": "TXT",
      "value": "v=DMARC1; p=none; rua=mailto:dmarc@mycompany.com",
      "status": false
    }
  }
}
```

**SDK Code**

```typescript Create a test domain
import { BrevoClient } from "@getbrevo/brevo";

async function main() {
    const client = new BrevoClient({
        apiKey: "YOUR_API_KEY_HERE",
    });
    await client.domains.createDomain({
        name: "test.example.com",
    });
}
main();

```

```python Create a test domain
from brevo import Brevo

client = Brevo(
    api_key="YOUR_API_KEY_HERE",
)

client.domains.create_domain(
    name="test.example.com",
)

```

```php Create a test domain
<?php

namespace Example;

use Brevo\Brevo;
use Brevo\Domains\Requests\CreateDomainRequest;

$client = new Brevo(
    apiKey: 'YOUR_API_KEY_HERE',
);
$client->domains->createDomain(
    new CreateDomainRequest([
        'name' => 'test.example.com',
    ]),
);

```

```go Create a test domain
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.brevo.com/v3/senders/domains"

	payload := strings.NewReader("{\n  \"name\": \"test.example.com\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("api-key", "<apiKey>")
	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 Create a test domain
require 'uri'
require 'net/http'

url = URI("https://api.brevo.com/v3/senders/domains")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"test.example.com\"\n}"

response = http.request(request)
puts response.read_body
```

```java Create a test domain
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.brevo.com/v3/senders/domains")
  .header("api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"test.example.com\"\n}")
  .asString();
```

```csharp Create a test domain
using RestSharp;

var client = new RestClient("https://api.brevo.com/v3/senders/domains");
var request = new RestRequest(Method.POST);
request.AddHeader("api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"test.example.com\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Create a test domain
import Foundation

let headers = [
  "api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["name": "test.example.com"] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.brevo.com/v3/senders/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()
```