> This page is for Developer.

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

# Add a Domain

POST https://api.bigcommerce.com/stores/{store_hash}/v3/infrastructure/projects/{project_uuid}/domains
Content-Type: application/json

Adds a custom domain to a project. Adding a domain triggers DNS verification and binds the domain in the routing layer. The domain starts in the `pending` verification status until DNS propagation and hostname validation completes.

The response's `data.pointing_records` object contains the DNS records that point the domain at the project: use the `CNAME` record value for a subdomain, or the `A` record value for an apex domain. This is the only endpoint that returns the pointing records, so store them before moving on. The [Get a Domain](#get-a-domain) and [List Domains](#list-domains) endpoints don't return them.

If the domain is already bound to a different store, this endpoint returns a `409 Conflict` whose `meta.ownership_verification` contains the TXT record you must publish before claiming the domain with the [Claim a Domain](#claim-a-domain) endpoint.

Reference: https://docs.bigcommerce.com/developer/api-reference/rest/admin/management/infrastructure-hosting/domains/add-domain

## Authentication

- `X-Auth-Token` header (required) — ### OAuth scopes | UI Name | Permission | Parameter | |:--------|:-----------|:----------| | Infrastructure Deployments | read-only | `store_infrastructure_deployments_read_only` | | Infrastructure Deployments | create preview | `store_infrastructure_deployments_create_preview` | | Infrastructure Deployments | manage | `store_infrastructure_deployments_manage` | | Infrastructure Projects | read-only | `store_infrastructure_projects_read_only` | | Infrastructure Projects | manage | `store_infrastructure_projects_manage` | | Infrastructure Logs | read-only | `store_infrastructure_logs_read_only` | ### Authentication header | Header | Argument | Description | |:-------|:---------|:------------| | `X-Auth-Token` | `access_token` | For more about API accounts that generate `access_token`s, see our [Guide to API Accounts](/developer/docs/overview/api-fundamentals/api-accounts#api-accounts). | ### Further reading For example requests and more information about authenticating BigCommerce APIs, see [Authentication and Example Requests](/developer/docs/overview/api-fundamentals/api-accounts#x-auth-token-header-example-requests). For more about BigCommerce OAuth scopes, see our [Guide to API Accounts](/developer/docs/overview/api-fundamentals/api-accounts#oauth-scopes). For a list of API status codes, see [API Status Codes](/developer/api-reference/rest/overview#rest-http-status-codes).

## Request

### Path parameters

- `project_uuid` (string, required) — The UUID of the project to add the domain to.
- `store_hash` (string, required) — Permanent ID of the BigCommerce store.

### Body (application/json)

This endpoint expects an AddDomainRequest.

- `domain` (string, required) — The custom domain name to add to the project.

## Response

### 201

The domain was added successfully.

- `data` (DomainWithPointingRecords, optional) — A custom domain bound to an infrastructure hosting project.
- `meta` (EmptyMeta, optional) — Empty meta object.

## Errors

### 404 Not Found Error

The specified project was not found.

- `status` (integer, optional) — The HTTP status code.
- `title` (string, optional) — A description of the error.
- `type` (string, optional) — A URL identifying the error type.
- `errors` (ErrorResponseErrors, optional) — Additional error details.
- `meta` (map from string to any, optional) — Additional structured context for the error, such as the ownership-verification TXT record to publish, the conflicting `project_uuid`, or the domain `limit` and `current` count.

### 409 Conflict Error

The domain could not be added because of a conflict. This occurs when the domain is already added to this project, is bound to another project in this store (use the [Transfer a Domain](#transfer-a-domain) endpoint), is bound to a different store (verify ownership with the [Claim a Domain](#claim-a-domain) endpoint), is already in use on BigCommerce, or another operation is in progress for the domain.

- `status` (integer, optional) — The HTTP status code.
- `title` (string, optional) — A description of the error.
- `type` (string, optional) — A URL identifying the error type.
- `errors` (ErrorResponseErrors, optional) — Additional error details.
- `meta` (map from string to any, optional) — Additional structured context for the error, such as the ownership-verification TXT record to publish, the conflicting `project_uuid`, or the domain `limit` and `current` count.

### 422 Unprocessable Entity Error

The domain could not be added because it is reserved or the project has reached its custom domain limit.

- `status` (integer, optional) — The HTTP status code.
- `title` (string, optional) — A description of the error.
- `type` (string, optional) — A URL identifying the error type.
- `errors` (ErrorResponseErrors, optional) — Additional error details.
- `meta` (map from string to any, optional) — Additional structured context for the error, such as the ownership-verification TXT record to publish, the conflicting `project_uuid`, or the domain `limit` and `current` count.

## Types

### DomainWithPointingRecords

A custom domain bound to an infrastructure hosting project.

- `domain` (string, optional) — The custom domain name.
- `project_uuid` (string, optional) — The UUID of the project the domain is bound to.
- `verification_status` (enum, optional) — The rolled-up DNS verification and SSL state of the domain. - `pending`: Verification is in progress, awaiting DNS propagation. - `verified`: The domain is verified and serving traffic. - `failed`: Verification failed. - `unknown`: The verification state could not be determined.
  - Allowed values: `pending`, `verified`, `failed`, `unknown`
- `pointing_records` (PointingRecords, optional) — The DNS records that point the domain at the project. Publish the `CNAME` record for a subdomain, or the `A` record for an apex domain, where most DNS providers don't allow a `CNAME`.

### EmptyMeta

Empty meta object.

### ErrorResponseErrors

Additional error details.

### PointingRecords

The DNS records that point the domain at the project. Publish the `CNAME` record for a subdomain, or the `A` record for an apex domain, where most DNS providers don't allow a `CNAME`.

- `a_record_value` (string, optional) — The store's IP address, for use as the value of an `A` record.
- `cname_record_value` (string, optional) — The project's worker URL, for use as the value of a `CNAME` record.

## Examples

### Response

**Response**

```json
{
  "data": {
    "domain": "shop.example.com",
    "project_uuid": "019500e2-933d-7057-8e81-090dd7240795",
    "verification_status": "pending",
    "pointing_records": {
      "a_record_value": "63.141.128.8",
      "cname_record_value": "my-project.catalyst-sandbox.store"
    }
  },
  "meta": {}
}
```

**SDK Code**

```python Response
import requests

url = "https://api.bigcommerce.com/stores/store_hash/v3/infrastructure/projects/project_uuid/domains"

headers = {"X-Auth-Token": "<apiKey>"}

response = requests.post(url, headers=headers)

print(response.json())
```

```javascript Response
const url = 'https://api.bigcommerce.com/stores/store_hash/v3/infrastructure/projects/project_uuid/domains';
const options = {method: 'POST', headers: {'X-Auth-Token': '<apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Response
package main

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

func main() {

	url := "https://api.bigcommerce.com/stores/store_hash/v3/infrastructure/projects/project_uuid/domains"

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

	req.Header.Add("X-Auth-Token", "<apiKey>")

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

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

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

}
```

```ruby Response
require 'uri'
require 'net/http'

url = URI("https://api.bigcommerce.com/stores/store_hash/v3/infrastructure/projects/project_uuid/domains")

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

request = Net::HTTP::Post.new(url)
request["X-Auth-Token"] = '<apiKey>'

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

```java Response
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.bigcommerce.com/stores/store_hash/v3/infrastructure/projects/project_uuid/domains")
  .header("X-Auth-Token", "<apiKey>")
  .asString();
```

```php Response
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.bigcommerce.com/stores/store_hash/v3/infrastructure/projects/project_uuid/domains', [
  'headers' => [
    'X-Auth-Token' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Response
using RestSharp;

var client = new RestClient("https://api.bigcommerce.com/stores/store_hash/v3/infrastructure/projects/project_uuid/domains");
var request = new RestRequest(Method.POST);
request.AddHeader("X-Auth-Token", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift Response
import Foundation

let headers = ["X-Auth-Token": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.bigcommerce.com/stores/store_hash/v3/infrastructure/projects/project_uuid/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()
```

### Add a domain

**Request**

```json
{
  "domain": "shop.example.com"
}
```

**Response**

```json
{
  "data": {
    "domain": "shop.example.com",
    "project_uuid": "019500e2-933d-7057-8e81-090dd7240795",
    "verification_status": "pending",
    "pointing_records": {
      "a_record_value": "63.141.128.8",
      "cname_record_value": "my-project.catalyst-sandbox.store"
    }
  },
  "meta": {}
}
```

**SDK Code**

```python Add a domain
import requests

url = "https://api.bigcommerce.com/stores/store_hash/v3/infrastructure/projects/project_uuid/domains"

payload = { "domain": "shop.example.com" }
headers = {
    "X-Auth-Token": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript Add a domain
const url = 'https://api.bigcommerce.com/stores/store_hash/v3/infrastructure/projects/project_uuid/domains';
const options = {
  method: 'POST',
  headers: {'X-Auth-Token': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"domain":"shop.example.com"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Add a domain
package main

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

func main() {

	url := "https://api.bigcommerce.com/stores/store_hash/v3/infrastructure/projects/project_uuid/domains"

	payload := strings.NewReader("{\n  \"domain\": \"shop.example.com\"\n}")

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

	req.Header.Add("X-Auth-Token", "<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 Add a domain
require 'uri'
require 'net/http'

url = URI("https://api.bigcommerce.com/stores/store_hash/v3/infrastructure/projects/project_uuid/domains")

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

request = Net::HTTP::Post.new(url)
request["X-Auth-Token"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"domain\": \"shop.example.com\"\n}"

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

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

HttpResponse<String> response = Unirest.post("https://api.bigcommerce.com/stores/store_hash/v3/infrastructure/projects/project_uuid/domains")
  .header("X-Auth-Token", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"domain\": \"shop.example.com\"\n}")
  .asString();
```

```php Add a domain
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.bigcommerce.com/stores/store_hash/v3/infrastructure/projects/project_uuid/domains', [
  'body' => '{
  "domain": "shop.example.com"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-Auth-Token' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp Add a domain
using RestSharp;

var client = new RestClient("https://api.bigcommerce.com/stores/store_hash/v3/infrastructure/projects/project_uuid/domains");
var request = new RestRequest(Method.POST);
request.AddHeader("X-Auth-Token", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"domain\": \"shop.example.com\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Add a domain
import Foundation

let headers = [
  "X-Auth-Token": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["domain": "shop.example.com"] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.bigcommerce.com/stores/store_hash/v3/infrastructure/projects/project_uuid/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()
```