Skip to content

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.

  • DNS records. Creating a redirect adds the records that point the name at Dinio’s edge: a CNAME below the apex, A/AAAA at the apex. They are marked managed_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 in certificate.status. With Manual, upload your own certificate for the name. With None, HTTPS requests get the platform’s default certificate.
GET /api/v1/redirects

Redirects 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 /api/v1/redirects/:name
Terminal window
curl -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
}
}
POST /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.
Terminal window
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/redirects

Returns 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, AAAA or CNAME records of your own — Dinio never overwrites them; remove them first;
  • the name already has a redirect;
  • tls is Auto and 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.

PATCH /api/v1/redirects/:name

Any 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.

Terminal window
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.com
DELETE /api/v1/redirects/:name

Deletes the redirect with its DNS records and its automatic certificate.