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

# Custom Domains

> Use your own domain for Grantex API endpoints (Enterprise)

## Overview

Enterprise plan customers can register a custom domain and prove ownership via DNS TXT records. The current release covers the registration and verification lifecycle — runtime traffic routing through verified domains (consent UI and API endpoints actually served from your domain) is on the roadmap; today both still resolve under `*.grantex.dev`.

## Setup

### 1. Register a Domain

```bash theme={null}
curl -X POST https://api.grantex.dev/v1/domains \
  -H "Authorization: Bearer $GRANTEX_KEY" \
  -H "Content-Type: application/json" \
  -d '{"domain": "auth.yourcompany.com"}'
```

Response includes verification instructions:

```json theme={null}
{
  "id": "dom_...",
  "domain": "auth.yourcompany.com",
  "verified": false,
  "verificationToken": "grantex-verify-abc123",
  "instructions": "Add a DNS TXT record: _grantex.auth.yourcompany.com = grantex-verify-abc123"
}
```

### 2. Add DNS Record

Add a TXT record to your DNS:

* **Name**: `_grantex.auth.yourcompany.com`
* **Value**: `grantex-verify-abc123`

### 3. Verify

```bash theme={null}
curl -X POST https://api.grantex.dev/v1/domains/dom_.../verify \
  -H "Authorization: Bearer $GRANTEX_KEY"
```

## SDK Usage

```typescript theme={null}
// TypeScript
const result = await grantex.domains.create({ domain: 'auth.yourcompany.com' });
console.log(result.instructions);

// After DNS setup:
await grantex.domains.verify(result.id);

// List domains
const { domains } = await grantex.domains.list();
```

```python theme={null}
# Python
result = grantex.domains.create(CreateDomainParams(domain="auth.yourcompany.com"))
print(result.instructions)
```
