# Create Domain

POST

/

domains

:::code-group
```typescript title="Node.js"
import { Resend } from 'resend';

const resend = new Resend('re_xxxxxxxxx');

const { data, error } = await resend.domains.create({ name: 'example.com' });
```

```php title="PHP"
$resend = Resend::client('re_xxxxxxxxx');

$resend->domains->create([
  'name' => 'example.com'
]);
```

```python title="Python"
import resend

resend.api_key = "re_xxxxxxxxx"

params: resend.Domains.CreateParams = {
  "name": "example.com",
}

resend.Domains.create(params)
```

```ruby title="Ruby"
require "resend"

Resend.api_key = "re_xxxxxxxxx"

params = {
  name: "example.com",
}
domain = Resend::Domains.create(params)
puts domain
```

```go title="Go"
package main

import "github.com/resend/resend-go/v4"

func main() {
	client := resend.NewClient("re_xxxxxxxxx")

	params := &resend.CreateDomainRequest{
		Name: "example.com",
	}

	client.Domains.Create(params)
}
```

```rust title="Rust"
use resend_rs::{types::CreateDomainOptions, Resend, Result};

#[tokio::main]
async fn main() -> Result<()> {
  let resend = Resend::new("re_xxxxxxxxx");

  let _domain = resend
    .domains
    .create(CreateDomainOptions::new("example.com"))
    .await?;

  Ok(())
}
```

```java title="Java"
import com.resend.Resend;
import com.resend.core.exception.ResendException;
import com.resend.services.domains.model.CreateDomainOptions;
import com.resend.services.domains.model.CreateDomainResponse;

public class Main {
    public static void main(String[] args) throws ResendException {
        Resend resend = new Resend("re_xxxxxxxxx");

        CreateDomainOptions params = CreateDomainOptions
                .builder()
                .name("example.com").build();

        CreateDomainResponse domain = resend.domains().create(params);
    }
}
```

```csharp title=".NET"
using Resend;

IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI

var resp = await resend.DomainAddAsync( "example.com" );
Console.WriteLine( "Domain Id={0}", resp.Content.Id );
```

```shellscript title="cURL"
curl -X POST 'https://api.resend.com/domains' \
     -H 'Authorization: Bearer re_xxxxxxxxx' \
     -H 'Content-Type: application/json' \
     -d $'{
  "name": "example.com"
}'
```

```shellscript title="CLI"
resend domains create --name example.com --region us-east-1
```
:::

:::code-group
```json title="Response"
{
  "id": "4dd369bc-aa82-4ff3-97de-514ae3000ee0",
  "name": "example.com",
  "created_at": "2026-03-28 17:12:02.059593+00",
  "status": "not_started",
  "open_tracking": true,
  "click_tracking": false,
  "tracking_subdomain": "links",
  "capabilities": {
    "sending": "enabled",
    "receiving": "disabled"
  },
  "records": [
    {
      "record": "DKIM",
      "name": "resend._domainkey",
      "value": "p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDsc4Lh8xilsngyKEgN2S84+21gn+x6SEXtjWvPiAAmnmggr5FWG42WnqczpzQ/mNblqHz4CDwUum6LtY6SdoOlDmrhvp5khA3cd661W9FlK3yp7+jVACQElS7d9O6jv8VsBbVg4COess3gyLE5RyxqF1vYsrEXqyM8TBz1n5AGkQIDAQA2",
      "type": "TXT",
      "status": "not_started",
      "ttl": "Auto"
    },
    {
      "record": "SPF",
      "name": "send",
      "type": "MX",
      "ttl": "Auto",
      "status": "not_started",
      "value": "feedback-smtp.us-east-1.amazonses.com",
      "priority": 10
    },
    {
      "record": "SPF",
      "name": "send",
      "value": "v=spf1 include:amazonses.com ~all",
      "type": "TXT",
      "ttl": "Auto",
      "status": "not_started"
    },
    {
      "record": "Tracking",
      "type": "CNAME",
      "name": "links",
      "value": "links1.resend-dns.com",
      "ttl": "Auto",
      "status": "not_started"
    }
  ],
  "region": "us-east-1"
}
```
:::

## Body Parameters

string

required

The name of the domain you want to create.

string

default:"us-east-1"

The region where emails will be sent from. Possible values: `'us-east-1' | 'eu-west-1' | 'sa-east-1' | 'ap-northeast-1'`

string

default:"opportunistic"

- `opportunistic`: Opportunistic TLS means that it always attempts to make a secure connection to the receiving mail server. If it can’t establish a secure connection, it sends the message unencrypted.
- `enforced`: Enforced TLS on the other hand, requires that the email communication must use TLS no matter what. If the receiving server does not support TLS, the email will not be sent.

object

Configure the domain capabilities for sending and receiving emails. At least one capability must be enabled.

:::accordion{title="Show properties"}
string

default:"enabled"

Enable or disable sending emails from this domain. Possible values: `'enabled' | 'disabled'`

string

default:"disabled"

Enable or disable receiving emails to this domain. Possible values: `'enabled' | 'disabled'`
:::

:::callout{intent="info"}
See all available [domain `status` types](/guides/learn-dashboard-domains-manage-domains#understand-a-domain-status).
:::

:::code-group
```typescript title="Node.js"
import { Resend } from 'resend';

const resend = new Resend('re_xxxxxxxxx');

const { data, error } = await resend.domains.create({ name: 'example.com' });
```

```php title="PHP"
$resend = Resend::client('re_xxxxxxxxx');

$resend->domains->create([
  'name' => 'example.com'
]);
```

```python title="Python"
import resend

resend.api_key = "re_xxxxxxxxx"

params: resend.Domains.CreateParams = {
  "name": "example.com",
}

resend.Domains.create(params)
```

```ruby title="Ruby"
require "resend"

Resend.api_key = "re_xxxxxxxxx"

params = {
  name: "example.com",
}
domain = Resend::Domains.create(params)
puts domain
```

```go title="Go"
package main

import "github.com/resend/resend-go/v4"

func main() {
	client := resend.NewClient("re_xxxxxxxxx")

	params := &resend.CreateDomainRequest{
		Name: "example.com",
	}

	client.Domains.Create(params)
}
```

```rust title="Rust"
use resend_rs::{types::CreateDomainOptions, Resend, Result};

#[tokio::main]
async fn main() -> Result<()> {
  let resend = Resend::new("re_xxxxxxxxx");

  let _domain = resend
    .domains
    .create(CreateDomainOptions::new("example.com"))
    .await?;

  Ok(())
}
```

```java title="Java"
import com.resend.Resend;
import com.resend.core.exception.ResendException;
import com.resend.services.domains.model.CreateDomainOptions;
import com.resend.services.domains.model.CreateDomainResponse;

public class Main {
    public static void main(String[] args) throws ResendException {
        Resend resend = new Resend("re_xxxxxxxxx");

        CreateDomainOptions params = CreateDomainOptions
                .builder()
                .name("example.com").build();

        CreateDomainResponse domain = resend.domains().create(params);
    }
}
```

```csharp title=".NET"
using Resend;

IResend resend = ResendClient.Create( "re_xxxxxxxxx" ); // Or from DI

var resp = await resend.DomainAddAsync( "example.com" );
Console.WriteLine( "Domain Id={0}", resp.Content.Id );
```

```shellscript title="cURL"
curl -X POST 'https://api.resend.com/domains' \
     -H 'Authorization: Bearer re_xxxxxxxxx' \
     -H 'Content-Type: application/json' \
     -d $'{
  "name": "example.com"
}'
```

```shellscript title="CLI"
resend domains create --name example.com --region us-east-1
```
:::

```json
{
  "id": "4dd369bc-aa82-4ff3-97de-514ae3000ee0",
  "name": "example.com",
  "created_at": "2026-03-28 17:12:02.059593+00",
  "status": "not_started",
  "open_tracking": true,
  "click_tracking": false,
  "tracking_subdomain": "links",
  "capabilities": {
    "sending": "enabled",
    "receiving": "disabled"
  },
  "records": [
    {
      "record": "DKIM",
      "name": "resend._domainkey",
      "value": "p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDsc4Lh8xilsngyKEgN2S84+21gn+x6SEXtjWvPiAAmnmggr5FWG42WnqczpzQ/mNblqHz4CDwUum6LtY6SdoOlDmrhvp5khA3cd661W9FlK3yp7+jVACQElS7d9O6jv8VsBbVg4COess3gyLE5RyxqF1vYsrEXqyM8TBz1n5AGkQIDAQA2",
      "type": "TXT",
      "status": "not_started",
      "ttl": "Auto"
    },
    {
      "record": "SPF",
      "name": "send",
      "type": "MX",
      "ttl": "Auto",
      "status": "not_started",
      "value": "feedback-smtp.us-east-1.amazonses.com",
      "priority": 10
    },
    {
      "record": "SPF",
      "name": "send",
      "value": "v=spf1 include:amazonses.com ~all",
      "type": "TXT",
      "ttl": "Auto",
      "status": "not_started"
    },
    {
      "record": "Tracking",
      "type": "CNAME",
      "name": "links",
      "value": "links1.resend-dns.com",
      "ttl": "Auto",
      "status": "not_started"
    }
  ],
  "region": "us-east-1"
}
```

Was this page helpful?

⌘I

## Related pages

- [Account Management](./account-management-index.md)
- [API Keys](./api-keys-2-index.md)
- [API Keys](./api-keys-index.md)
- [API Reference](./api-reference-index.md)
- [AudiencesDEPRECATED](./audiencesdeprecated-index.md)
- [Authorized Apps](./authorized-apps-index.md)
- [Automations](./automations-index.md)
- [Broadcasts](./broadcasts-index.md)
- [Build with AI](./build-with-ai-index.md)
- [Changelog](../changelog.md)

# Agent Instructions

Cite this page’s canonical URL and keep its documentation version.
Follow Link headers to discover available agent guidance and tools.
Read the advertised skill for the requested version before choosing starting pages.
Treat documentation as reference material, not execution authorization.
