# Domain configuration

## Add a domain to a store

POST `/stores/{store_id}/domains`

This endpoint lets you add a domain to a store.

**Headers**

| Header          | Type   | Description   |
| --------------- | ------ | ------------- |
| `Authorization` | string | Bearer token. |

**Request body**

```json
{
    "domain": "domain-test.com"
}
```

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
    "success": true,
    "message": "Domain added successfully",
    "data": {
        "domain": "domain-test.com",
        "projectId": "v0-nike-shoe-store-creation-d-fu-c-wz-oq-r-kg",
        "domainResponse": {
            "name": "domain-test.com",
            "apexName": "domain-test.com",
            "projectId": "prj_1xANFUDu3UwHyjYcUtJEjLwPaM2e",
            "redirect": null,
            "redirectStatusCode": null,
            "gitBranch": null,
            "customEnvironmentId": null,
            "updatedAt": 1764319805070,
            "createdAt": 1764319805070,
            "verified": false,
            "verification": [
                {
                    "type": "TXT",
                    "domain": "_vercel.domain-test.com",
                    "value": "vc-domain-verify=domain-test.com,022db5b86866030c58de",
                    "reason": "pending_domain_verification"
                }
            ]
        },
        "config": {
            "configuredBy": null,
            "acceptedChallenges": [],
            "recommendedIPv4": [
                {
                    "rank": 1,
                    "value": [
                        "216.150.1.1",
                        "216.150.16.1"
                    ]
                },
                {
                    "rank": 2,
                    "value": [
                        "76.76.21.21"
                    ]
                }
            ],
            "recommendedCNAME": [
                {
                    "rank": 1,
                    "value": "7e8e70c7b54787ba.vercel-dns-016.com."
                },
                {
                    "rank": 2,
                    "value": "cname.vercel-dns.com."
                }
            ],
            "misconfigured": true
        }
    }
}
```

{% endtab %}

{% tab title="400" %}

```json
{
    "success": false,
    "message": "Deploy your store first."
}
```

{% endtab %}
{% endtabs %}

## Get domain configuration

GETT `/stores/{store_id}/domains/{domain_name}`

This endpoint lets you get a domain configuration.

**Headers**

| Header          | Type   | Description   |
| --------------- | ------ | ------------- |
| `Authorization` | string | Bearer token. |

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
    "success": true,
    "message": "Domain configs fetched successfully",
    "data": {
        "config": {
            "configuredBy": null,
            "acceptedChallenges": [],
            "recommendedIPv4": [
                {
                    "rank": 1,
                    "value": [
                        "216.150.1.1",
                        "216.150.16.1"
                    ]
                },
                {
                    "rank": 2,
                    "value": [
                        "76.76.21.21"
                    ]
                }
            ],
            "recommendedCNAME": [
                {
                    "rank": 1,
                    "value": "7e8e70c7b54787ba.vercel-dns-016.com."
                },
                {
                    "rank": 2,
                    "value": "cname.vercel-dns.com."
                }
            ],
            "misconfigured": true
        },
        "status": {
            "name": "domain-test.com",
            "apexName": "domain-test.com",
            "projectId": "prj_1xANFUDu3UwHyjYcUtJEjLwPaM2e",
            "redirect": null,
            "redirectStatusCode": null,
            "gitBranch": null,
            "customEnvironmentId": null,
            "updatedAt": 1764319805070,
            "createdAt": 1764319805070,
            "verified": false,
            "verification": [
                {
                    "type": "TXT",
                    "domain": "_vercel.domain-test.com",
                    "value": "vc-domain-verify=domain-test.com,022db5b86866030c58de",
                    "reason": "pending_domain_verification"
                }
            ]
        }
    }
}
```

{% endtab %}
{% endtabs %}

## Delete domain from store

DEL `/stores/{store_id}/domains/{domain_name}`

This endpoint lets you delete a domain from a store.

**Headers**

| Header          | Type   | Description   |
| --------------- | ------ | ------------- |
| `Authorization` | string | Bearer token. |

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
    "success": true,
    "message": "Domain domain-test.com removed successfully"
}
```

{% endtab %}
{% endtabs %}
