Fief Logo
Fief

API Documentation

Learn how to manage your DNS records programmatically using the Fief REST API.

Authentication

All API requests require an API key passed in the `Authorization` header as a Bearer token.

Authorization: Bearer <YOUR_API_KEY>
GET

List Records

Retrieve all DNS records associated with your subdomain path.

Endpoint

/api/v1/records

Example Request

curl -X GET "${NEXT_PUBLIC_APP_URL}/api/v1/records" \
  -H "Authorization: Bearer <YOUR_API_KEY>"

Success Response

[
  {
    "type": "A",
    "host": "www",
    "value": "1.2.3.4",
    "ttl": 3600
  }
]
POST

Set Record

Create or update a DNS record. Note that NameCheap's API is replacement-based; Fief handles the fetch-patch-push cycle for you.

Endpoint

/api/v1/records

Example Request

curl -X POST "${NEXT_PUBLIC_APP_URL}/api/v1/records" \
  -H "Authorization: Bearer <YOUR_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "A",
    "host": "www",
    "value": "1.2.3.4",
    "ttl": 3600
  }'

Success Response

{ "success": true }
DELETE

Delete Record

Remove a specific DNS record by host and type.

Endpoint

/api/v1/records/:host/:type

Example Request

curl -X DELETE "${NEXT_PUBLIC_APP_URL}/api/v1/records/www/A" \
  -H "Authorization: Bearer <YOUR_API_KEY>"

Success Response

{ "success": true }