# Add Tracking Domain

> Register your own subdomain for open and click tracking.

Requires an API key with the `write` scope.

Create the domain, then add a CNAME record at your DNS provider pointing the subdomain at `cnameTarget`. Once DNS resolves, call [Verify Tracking Domain](/api-reference/tracking-domains/verify-domain) until `status` is `active`. Sending keeps using the shared tracking domain until then. A workspace can have one tracking domain at a time (a `failed` one does not count).

## Body Parameters

<ParamField body="domain" type="string" required>
  A subdomain such as `track.yourcompany.com`. A leading `https://`, a path, a port and a trailing dot are stripped. A root domain such as `yourcompany.com` is rejected.
</ParamField>

## Response

<ResponseField name="data" type="object">
  The new tracking domain. `status` starts as `pending`, or `verifying` once the certificate is requested.

  <Expandable title="data">
    <ResponseField name="id" type="string">Tracking domain identifier.</ResponseField>
    <ResponseField name="domain" type="string">The tracking subdomain.</ResponseField>
    <ResponseField name="status" type="string">`pending`, `verifying`, `active` or `failed`.</ResponseField>
    <ResponseField name="cnameTarget" type="string">The hostname to point your CNAME record at.</ResponseField>
    <ResponseField name="sslStatus" type="string">Certificate status, for example `pending_validation` or `active`. `null` until provisioning has run.</ResponseField>
    <ResponseField name="failureReason" type="string">Why provisioning or verification failed, or `null`.</ResponseField>
    <ResponseField name="verifiedAt" type="string">ISO 8601 timestamp, or `null`.</ResponseField>
    <ResponseField name="lastCheckedAt" type="string">ISO 8601 timestamp, or `null`.</ResponseField>
    <ResponseField name="createdAt" type="string">ISO 8601 timestamp.</ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
```bash cURL
curl -X POST "https://api.foxreach.io/api/v1/tracking-domains" \
  -H "X-API-Key: otr_your_key" \
  -H "Content-Type: application/json" \
  -d '{"domain": "track.yourcompany.com"}'
```

```python Python SDK (beta)
from foxreach import FoxReach

client = FoxReach(api_key="otr_your_key")
domain = client.tracking_domains.add("track.yourcompany.com")
```

```typescript TypeScript SDK (beta)
import { FoxReach } from "foxreach";

const client = new FoxReach({ apiKey: "otr_your_key" });
const domain = await client.trackingDomains.create({ domain: "track.yourcompany.com" });
```
</RequestExample>

<ResponseExample>
```json
{
  "data": {
    "id": "trk_abc123",
    "domain": "track.yourcompany.com",
    "status": "verifying",
    "cnameTarget": "cname.foxtrk.com",
    "sslStatus": "pending_validation",
    "failureReason": null,
    "verifiedAt": null,
    "lastCheckedAt": null,
    "createdAt": "2026-10-31T10:00:00"
  }
}
```
</ResponseExample>

## Errors

| Status | Description |
|--------|-------------|
| `401` | Missing, invalid, revoked or expired API key |
| `403` | API key does not have the required scope: `write` |
| `400` | `Enter a valid subdomain, e.g. track.yourcompany.com`, `Use a subdomain (track.yourcompany.com), not the root domain.` or `That domain is reserved.` |
| `409` | `A tracking domain already exists. Remove it before adding another.` or `That domain is already registered.` |
| `422` | `domain` is missing |
| `501` | `Custom tracking domains are not enabled on this environment.` |

<Note>
  If provisioning fails the domain is still created and the response carries the reason in `failureReason`. Fix the cause and call Verify, or delete it and add it again.
</Note>

## Rate Limit

- **100 requests per minute, per API key.** Fixed 60-second window.
- Every response includes `X-RateLimit-Limit`, `X-RateLimit-Remaining`, and `X-RateLimit-Reset` (unix epoch seconds).
- A `429` response includes a `Retry-After` header (seconds until the bucket resets).

For client-side patterns (`Retry-After`, exponential backoff, monitoring `X-RateLimit-Remaining`), see [Rate Limiting](/rate-limiting).
