Skip to main content

Overview

Enterprise plan customers can configure custom domains for their Grantex API endpoints. Domain ownership is verified via DNS TXT records.

Setup

1. Register a Domain

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:
{
  "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

curl -X POST https://api.grantex.dev/v1/domains/dom_.../verify \
  -H "Authorization: Bearer $GRANTEX_KEY"

SDK Usage

// 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
result = grantex.domains.create(CreateDomainParams(domain="auth.yourcompany.com"))
print(result.instructions)