> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sequenzy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Configure Domain Tracking

> Give an older sending domain its own tracking subdomain

Move tracked links and opens for a domain added before per-domain tracking
(`website.tracking.policy` is `legacy`) to a subdomain of that domain, such as
`links.mail.example.com`. Publish the returned `website.tracking.cnameRecord`.
Links keep using their current tracking domain until the new subdomain
verifies, and sending is never paused while it does.

Once the subdomain verifies, the domain switches to per-domain tracking like
newly added domains: `tracking.policy` becomes `required`, and links no longer
fall back to the company tracking domain. A tracking subdomain cannot be changed
once set. Sending the same value again changes nothing; a different value
returns 400.

Domains with `tracking.policy: "required"` chose their tracking subdomain when
they were added, so any other value returns 400. This endpoint requires the
`websites:write` scope.

## Request

<ParamField path="domain" type="string" required>
  Configured sending domain.
</ParamField>

<ParamField body="trackingPrefix" type="string" required>
  Tracking subdomain label, for example `links`. Use one DNS label of 1 to 63
  letters, numbers or hyphens, without a leading or trailing hyphen. It cannot
  be `inbound` or the label that holds the domain's bounce records.
</ParamField>

An invalid label returns 400. A missing or non-string `trackingPrefix` returns 422. An unexpected server error returns 500; retrying with the same value is
safe.

```bash theme={null}
curl -X PATCH "https://api.sequenzy.com/api/v1/websites/mail.example.com" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"trackingPrefix": "links"}'
```

## Responses

<ResponseExample>
  ```json 200 theme={null}
  {
    "success": true,
    "website": {
      "id": "domain_abc123",
      "domain": "mail.example.com",
      "status": "verified",
      "dnsVerified": true,
      "readyToSend": true,
      "tracking": {
        "policy": "legacy",
        "required": false,
        "hostname": "links.mail.example.com",
        "status": "pending",
        "ready": false,
        "error": null,
        "cnameRecord": {
          "type": "CNAME",
          "name": "links.mail.example.com",
          "value": "links1.sequenzydns.com"
        }
      }
    }
  }
  ```

  ```json 400 theme={null}
  {
    "success": false,
    "error": "This domain already uses links.mail.example.com for tracking, and it cannot be changed."
  }
  ```

  ```json 404 theme={null}
  {
    "success": false,
    "code": "SENDING_DOMAIN_NOT_CONFIGURED",
    "error": "Sending domain not configured",
    "title": "Sending domain not configured",
    "docsUrl": "https://docs.sequenzy.com/api-reference/websites/create",
    "details": { "domain": "mail.example.com" }
  }
  ```

  ```json 409 theme={null}
  {
    "success": false,
    "error": "The tracking hostname links.mail.example.com is already in use. Choose another tracking subdomain."
  }
  ```
</ResponseExample>
