Endpoint
Authentication
Requires a developer API key in theAuthorization header.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Register a custom domain on your Grantex account. Returns a token to add as a DNS TXT record. Requires Enterprise plan. Runtime traffic routing on your domain is on the roadmap; today endpoints still resolve under *.grantex.dev.
POST /v1/domains
Authorization header.
| Header | Value |
|---|---|
Authorization | Bearer <api_key> |
Content-Type | application/json |
| Field | Type | Required | Description |
|---|---|---|---|
domain | string | Yes | The custom domain to register (e.g. auth.example.com) |
curl -X POST https://api.grantex.dev/v1/domains \
-H "Authorization: Bearer gx_..." \
-H "Content-Type: application/json" \
-d '{
"domain": "auth.example.com"
}'
{
"id": "dom_01HXYZ...",
"domain": "auth.example.com",
"verified": false,
"verificationToken": "grantex-verify-a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"instructions": "Add a DNS TXT record: _grantex.auth.example.com = grantex-verify-a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}
| Field | Type | Description |
|---|---|---|
id | string | Unique domain ID |
domain | string | The registered domain |
verified | boolean | Whether the domain has been verified (always false on creation) |
verificationToken | string | Token to add as a DNS TXT record for verification |
instructions | string | Human-readable DNS configuration instructions |
| Status | Code | Description |
|---|---|---|
| 400 | BAD_REQUEST | Missing domain field |
| 401 | UNAUTHORIZED | Invalid or missing API key |
| 402 | PLAN_LIMIT_EXCEEDED | Custom domains require Enterprise plan |
| 409 | CONFLICT | Domain already registered |
import Grantex from '@grantex/sdk';
const grantex = new Grantex({ apiKey: 'gx_...' });
const domain = await grantex.domains.create({ domain: 'auth.example.com' });
console.log(domain.verificationToken);
console.log(domain.instructions);
from grantex import Grantex
grantex = Grantex(api_key="gx_...")
domain = grantex.domains.create(domain="auth.example.com")
print(domain.verification_token)
print(domain.instructions)