Development7 min

API reference

Manage domains, rules, certificates and live metrics through the API.

Complete this guide in a test environment first, then roll it out to production in stages.
01

Create an API token

Create a least-privilege token in the console. Use separate tokens for automation, monitoring and deployments, then rotate them regularly.

  • Limit tokens to the required site scope
  • Choose the minimum read/write permission
  • Never commit a token to source control
02

Make a request

All requests use Bearer authentication and return JSON.

CONFIG
curl https://api.1dun.example/v1/sites \
+  -H "Authorization: Bearer $ONE_DUN_TOKEN" \
+  -H "Content-Type: application/json"
03

Handle responses

Use the request ID to correlate logs and support cases. For rate limits, respect Retry-After and apply exponential backoff.