CDN

Custom domains

By default your account serves from its auto host <slug>.cdn.oblien.com. You can serve from your own domain instead — cdn.yourbrand.com. A custom domain is account-level: it serves all of your CDN files (across every namespace), just like the auto host.

A custom domain is a delivery alias for your account host — it doesn't change where files live or how they're organized. Namespace stays an API-side tag on each file; the domain just changes the hostname in your URLs.

How it works

  1. Point DNS at the Oblien edge (CNAME to edge.oblien.com, or an A record to the edge IP) and add the ownership TXT record.
  2. Connect it with POST /cdn/domains. Oblien verifies DNS, provisions a per-domain TLS certificate, and routes the host to your account's storage. The route registers immediately; SSL flips to active once DNS resolves.
  3. Mint permits with cdnHost so returned URLs use the domain.

DNS records

TypeHostValue
CNAME (or A)cdn.yourbrand.comedge.oblien.com (or the edge IP)
TXT_opsh.cdn.yourbrand.comverify=<cdn-slug>

The exact records (including the verify= value) are returned in dns.required_records of the connect call if DNS isn't ready yet — point the domain, then call connect again.

Connect a domain

const res = await oblien.cdn.domains.add({ domain: 'cdn.yourbrand.com' });

if (res.ssl.status === 'active') {
  console.log('Live:', res.url);          // https://cdn.yourbrand.com
} else {
  console.log('Set these DNS records:', res.dns.required_records);
}
POST /cdn/domains
X-Client-ID: <id>
X-Client-Secret: <secret>
Content-Type: application/json

{ "domain": "cdn.yourbrand.com" }
curl -X POST https://api.oblien.com/cdn/domains \
  -H "X-Client-ID: $OBLIEN_CLIENT_ID" \
  -H "X-Client-Secret: $OBLIEN_CLIENT_SECRET" \
  -H "Content-Type: application/json" \
  -d '{"domain":"cdn.yourbrand.com"}'

Response

{
  "success": true,
  "domain": "cdn.yourbrand.com",
  "host": "cdn.yourbrand.com",
  "url": "https://cdn.yourbrand.com",
  "ssl": { "status": "pending", "expiresAt": null },
  "dns": {
    "verified": false,
    "required_records": {
      "cname": { "host": "cdn.yourbrand.com", "target": "edge.oblien.com" },
      "txt": { "host": "_opsh.cdn.yourbrand.com", "value": "verify=<cdn-slug>" }
    }
  }
}

ssl.status is pending until DNS resolves to the edge, then active (a per-domain certificate is issued automatically and auto-renews).

List & remove

// List your account's CDN hosts (auto subdomain + custom domains)
const { domains } = await oblien.cdn.domains.list();
// domains[] → { domain, custom, status, createdAt }

// Remove a custom domain (the auto subdomain can't be removed)
await oblien.cdn.domains.remove('cdn.yourbrand.com');
GET    /cdn/domains
DELETE /cdn/domains/cdn.yourbrand.com
curl "https://api.oblien.com/cdn/domains" \
  -H "X-Client-ID: $OBLIEN_CLIENT_ID" -H "X-Client-Secret: $OBLIEN_CLIENT_SECRET"

curl -X DELETE "https://api.oblien.com/cdn/domains/cdn.yourbrand.com" \
  -H "X-Client-ID: $OBLIEN_CLIENT_ID" -H "X-Client-Secret: $OBLIEN_CLIENT_SECRET"

Use it for uploads

Once connected, mint permits with cdnHost so returned URLs use the domain:

const { token } = await oblien.cdn.token({
  namespace: 'customer-123',       // still just the API-side tag (quota/sort)
  cdnHost: 'cdn.yourbrand.com',    // delivery host for returned URLs
});
// → uploaded files return URLs like https://cdn.yourbrand.com/static/ab/cd/file.jpg

Notes

  • Account-level & delivery-only — a custom domain serves your whole account's files; uploads still go through a permit. cdnHost must be a domain you've connected, else 400 invalid_cdn_host (no host spoofing).
  • Serving is read-only static delivery over HTTPS with long-lived caching.
  • Delivery traffic on a custom domain bills to your account — one meter per account, whether served from the auto host or a custom domain.
  • Errors: dns_not_configured (records not set yet — see dns.required_records), domain_unavailable (already in use), feature_locked (plan doesn't include custom domains), cannot_remove_subdomain (the auto host).