---
title: "Create Domain"
full: true
_openapi:
  method: POST
  toc: []
  structuredData:
    headings: []
    contents:
      - content: "Creates a new domain"
_apiData:
  document: "https://reloop.sh/api/domain/openapi/json"
  operationData: [{"path":"/api/domain/v1/create","method":"post"}]
  parameterList: [{"name":"domain","type":"string","required":true,"description":"Domain name (e.g., send.reloop.com)","location":"body","minLength":4,"maxLength":255,"pattern":"^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*\\.[a-zA-Z]{2,}$"},{"name":"custom_return_path","type":"string","required":false,"description":"Custom return-path subdomain (e.g., inbound)","location":"body","defaultValue":"inbound","minLength":1,"maxLength":255,"pattern":"^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$"},{"name":"tracking","type":"string","required":false,"description":"Custom tracking subdomain (e.g., tracking)","location":"body","defaultValue":"tracking","minLength":1,"maxLength":255,"pattern":"^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$"},{"name":"click_tracking","type":"boolean","required":false,"description":"Whether click tracking is enabled","location":"body","defaultValue":false},{"name":"open_tracking","type":"boolean","required":false,"description":"Whether open tracking is enabled","location":"body","defaultValue":false},{"name":"tls","type":"\"opportunistic\" | \"enforced\"","required":false,"description":"","location":"body","enumValues":["opportunistic","enforced"]},{"name":"sending_email","type":"boolean","required":false,"description":"Whether sending email is enabled","location":"body","defaultValue":true},{"name":"receiving_email","type":"boolean","required":false,"description":"Whether receiving email is enabled","location":"body","defaultValue":true}]
  responseMap: {"201":{"description":"Response for status 201","schema":{"object":"domain","id":"con_123456789","domain":"send.example.com","status":"pending","userVerifiedDomain":true,"systemVerified":true,"customReturnPath":"inbound","trackingSubdomain":"tracking","isClickTrackingEnabled":true,"isOpenTrackingEnabled":true,"tls":"opportunistic","isTrackingDomain":true,"isSendingEmailEnabled":true,"isReceivingEmailEnabled":true,"verificationFailedReason":"example_verificationFailedReason","dnsRecords":[{"id":"dns_123456789","recordType":"MX","recordTypeName":"MX","domain":"example.com","name":"@","value":"feedback-smtp.us-east-1.amazonses.com","ttl":"Auto","priority":10,"status":"active","createdAt":"2026-03-30T10:00:00.000Z","updatedAt":"2026-03-30T10:00:00.000Z"}],"lastVerifiedAt":"2026-03-23T10:00:00.000Z","createdAt":"2026-03-23T10:00:00.000Z","updatedAt":"2026-03-23T10:00:00.000Z","event":"evt_123456789"}},"400":{"description":"Response for status 400","schema":{"message":"Contact already exists","why":"A contact with this email already exists in your organization.","fix":"Use a different email address or update the existing contact instead.","link":"https://reloop.sh/docs/api/contacts"}},"403":{"description":"Response for status 403","schema":{"message":"Contact already exists","why":"A contact with this email already exists in your organization.","fix":"Use a different email address or update the existing contact instead.","link":"https://reloop.sh/docs/api/contacts"}},"409":{"description":"Response for status 409","schema":{"message":"Contact already exists","why":"A contact with this email already exists in your organization.","fix":"Use a different email address or update the existing contact instead.","link":"https://reloop.sh/docs/api/contacts"}}}
  codeSamples:
    - id: node
      lang: javascript
      label: Node.js
      source: |-
        import { Reloop } from "reloop-email";
        
        const reloop = new Reloop({ apiKey: "rl_123456789" });
        
        const { domain, domainError } = await reloop.domain.create({
          domain: "send.example.com",
          click_tracking: true,
          open_tracking: true,
          tls: "opportunistic",
          sending_email: true,
          receiving_email: false,
        });
        
        if (domainError) throw domainError;
        
        console.log(domain.id, domain.domain);
    - id: curl
      lang: bash
      label: cURL
      source: |-
        curl -X POST https://reloop.sh/api/domain/v1/create \
          -H "x-api-key: rl_123456789" \
          -H "Content-Type: application/json" \
          -d '{"domain": "send.example.com","click_tracking": true,"open_tracking": true,"tls": "opportunistic","sending_email": true,"receiving_email": false}'
    - id: python
      lang: python
      label: Python
      source: |-
        from reloop_email import Reloop
        
        reloop = Reloop(api_key="rl_123456789")
        
        result = reloop.domain.create({
          "domain": "send.example.com",
          "click_tracking": True,
          "open_tracking": True,
          "tls": "opportunistic",
          "sending_email": True,
          "receiving_email": False,
        })
        
        if result.domain_error:
            raise result.domain_error
        
        print(result.domain["id"], result.domain["domain"])
    - id: php
      lang: php
      label: PHP
      source: |-
        <?php
        
        require 'vendor/autoload.php';
        
        use Reloop\Reloop;
        
        $reloop = Reloop::client('rl_123456789');
        
        $domain = $reloop->domain->create([
            'domain' => 'send.example.com',
            'click_tracking' => true,
            'open_tracking' => true,
            'tls' => 'opportunistic',
            'sending_email' => true,
            'receiving_email' => false,
        ]);
        echo $domain['id'] . ' ' . $domain['domain'] . PHP_EOL;
    - id: java
      lang: java
      label: Java
      source: |-
        import sh.reloop.ReloopClient;
        ReloopClient reloop = new ReloopClient("rl_123456789");
        
        CreateDomainParams params = new CreateDomainParams();
        params.domain = "send.example.com";
        params.clickTracking = true;
        params.openTracking = true;
        params.tls = "opportunistic";
        params.sendingEmail = true;
        params.receivingEmail = false;
        var domain = reloop.domain.create(params);
        System.out.println(domain.id + " " + domain.domain);
    - id: dotnet
      lang: csharp
      label: .NET
      source: |-
        using Reloop;
        using Reloop.Models;
        
        var reloop = new ReloopClient("rl_123456789");
        
        var domain = await reloop.Domain.CreateAsync(new CreateDomainParams(
            Domain: "send.example.com",
            ClickTracking: true,
            OpenTracking: true,
            Tls: "opportunistic",
            SendingEmail: true,
            ReceivingEmail: false
        ));
    - id: go
      lang: go
      label: Go
      source: |-
        import reloop "github.com/reloop-labs/reloop-go"
        
        client, _ := reloop.NewClient(reloop.ClientOptions{
            APIKey: "rl_123456789",
        })
        
        domain, _ := client.Domain.Create(reloop.CreateDomainParams{
            Domain: "send.example.com",
            ClickTracking: reloop.Bool(true),
            OpenTracking: reloop.Bool(true),
            Tls: reloop.String("opportunistic"),
            SendingEmail: reloop.Bool(true),
            ReceivingEmail: reloop.Bool(false),
        })
    - id: rust
      lang: rust
      label: Rust
      source: |-
        use reloop::ReloopClient;
        #[tokio::main]
        async fn main() -> Result<(), Box<dyn std::error::Error>> {
            let reloop = ReloopClient::new("rl_123456789".to_string(), None);
        
            reloop.domain().create(CreateDomainParams {
                domain: "send.example.com".to_string(),
                click_tracking: Some(true),
                open_tracking: Some(true),
                tls: Some("opportunistic".to_string()),
                sending_email: Some(true),
                receiving_email: Some(false),
                ..Default::default()
            }).await?;
        
            Ok(())
        }
    - id: ruby
      lang: ruby
      label: Ruby
      source: |-
        require "reloop"
        
        reloop = Reloop::Client.new(api_key: "rl_123456789")
        
        domain = reloop.domain.create(
          domain: "send.example.com",
          click_tracking: true,
          open_tracking: true,
          tls: "opportunistic",
          sending_email: true,
          receiving_email: false,
        )
    - id: elixir
      lang: elixir
      label: Elixir
      source: |-
        client = Reloop.client("rl_123456789")
        
        {:ok, domain} = Reloop.Services.Domain.create(client, %{
          domain: "send.example.com",
          click_tracking: true,
          open_tracking: true,
          tls: "opportunistic",
          sending_email: true,
          receiving_email: false
        })
---
> For the complete documentation index, see [llms-docs.txt](/llms-docs.txt) or the site index [llms.txt](/llms.txt). Full docs corpus: [llms-full-docs.txt](/llms-full-docs.txt). Prefer markdown URLs (append `.md`) for agent consumption. Product skill: [skill.md](/skill.md).


{/* This file was generated by the OpenAPI doc generator. Do not edit this file directly. Run `bun run generate:api-docs` to regenerate. */}

<APIPage />
