Redirects
A redirect answers HTTP(S) requests for a host name in one of your zones with an HTTP redirect. It belongs to its zone: the zone key, the zone’s Owner and its Administrators can manage it. See DNS hosting.
interface Redirect { name: string; // host name, e.g. "go.example.com" — the redirect's identity zone_id: string; code: 301 | 302 | 303 | 307 | 308; location: string; // target URL tls: 'Auto' | 'Manual' | 'None'; certificate?: { // only for tls "Auto", and not in lists status: 'Pending' | 'Valid' | 'Failed'; certificate_id?: string; // once issued; see Certificates renew_at: number; // when Dinio next acts on it: issue, renew or retry last_error?: string; // why the last attempt failed }; created_at: number; updated_at: number;}Routes that take :name use the redirect’s host name. The name is fixed after creation.
What Dinio does for you
Section titled “What Dinio does for you”- DNS records. Creating a redirect adds the records that point the name at Dinio’s edge:
a
CNAMEbelow the apex,A/AAAAat the apex. They are markedmanaged_by: "Redirect", can’t be changed through/records, and are removed with the redirect. - Certificate. With
tls: "Auto"Dinio requests a Let’s Encrypt certificate right after the redirect is created, renews it, and retries if issuance fails. Follow it incertificate.status. WithManual, upload your own certificate for the name. WithNone, HTTPS requests get the platform’s default certificate.
List redirects
Section titled “List redirects”/api/v1/redirectsRedirects of every zone you can access; with a zone key, of its zone. Paginated.
| Query | |
|---|---|
zone_id |
Only this zone. |
page, per_page |
Pagination, per_page default 50, up to 500. |
List items don’t carry certificate; read one redirect for that.
Get a redirect
Section titled “Get a redirect”/api/v1/redirects/:namecurl -H "Authorization: Bearer $DINIO_API_KEY" \ https://api-dinio.bitelex.com/api/v1/redirects/go.example.com{ "success": true, "data": { "name": "go.example.com", "zone_id": "6f1c2a9e-3d4b-4c8a-9a51-0e2f7b1d4c33", "code": 302, "location": "https://www.example.com/campaign", "tls": "Auto", "certificate": { "status": "Valid", "certificate_id": "9b2e…", "renew_at": 1765000000 }, "created_at": 1760000000, "updated_at": 1760000000 }}Create a redirect
Section titled “Create a redirect”/api/v1/redirects| Field | Type | |
|---|---|---|
zone_id |
uuid | The zone the name is in. |
name |
string | Host name inside the zone. |
code |
integer | 301, 302, 303, 307 or 308. 301 and 308 are permanent, and browsers may cache them for a long time. |
location |
string | http:// or https:// URL, up to 2 048 characters. |
tls |
string | Optional: None (default), Auto or Manual. |
curl -X POST -H "Authorization: Bearer $DINIO_API_KEY" -H "Content-Type: application/json" \ -d '{"zone_id":"'$ZONE_ID'","name":"go.example.com","code":302,"location":"https://www.example.com/campaign","tls":"Auto"}' \ https://api-dinio.bitelex.com/api/v1/redirectsReturns 201. Refused with 409 CONFLICT when:
- the name is not inside the zone, belongs to a more specific zone hosted on Dinio, or is delegated away to other nameservers;
- the name already has
A,AAAAorCNAMErecords of your own — Dinio never overwrites them; remove them first; - the name already has a redirect;
tlsisAutoand another certificate already covers the name.
details gives the reasons: a list of messages, or for the last case
[{ "name": …, "certificate": "<uuid>" }]. 403 if you have no access to the zone.
Change a redirect
Section titled “Change a redirect”/api/v1/redirects/:nameAny of code, location, tls. The name and its DNS records stay.
Switching tls away from Auto deletes the automatic certificate. Switching to Auto starts
issuance, and is a 409 while another certificate covers the name — delete that one first.
curl -X PATCH -H "Authorization: Bearer $DINIO_API_KEY" -H "Content-Type: application/json" \ -d '{"location":"https://www.example.com/autumn"}' \ https://api-dinio.bitelex.com/api/v1/redirects/go.example.comDelete a redirect
Section titled “Delete a redirect”/api/v1/redirects/:nameDeletes the redirect with its DNS records and its automatic certificate.