CDN

Auto-delete (TTL)

Some assets are ephemeral — stories, one-time shares, previews. Mark an upload with a TTL and the CDN deletes it (and its variants) automatically when it expires, releasing the quota it used.

Set an expiry

Put ttl (seconds from now) or expireAt (epoch) in the permit's variants object when you mint the token:

const { token } = await oblien.cdn.token({
  namespace: 'customer-123',
  variants: { ttl: 86400 },   // expires 24h after upload
});
POST /cdn/token
X-Client-ID: <id>
X-Client-Secret: <secret>

{ "namespace": "customer-123", "variants": { "ttl": 86400 } }
curl -X POST https://api.oblien.com/cdn/token \
  -H "X-Client-ID: $OBLIEN_CLIENT_ID" -H "X-Client-Secret: $OBLIEN_CLIENT_SECRET" \
  -H "Content-Type: application/json" \
  -d '{"namespace":"customer-123","variants":{"ttl":86400}}'

The upload response includes expires_at so your app knows when the asset will vanish. Omit ttl/expireAt for permanent assets.

How reclamation works

TTL is node-owned. The permit carries the expiry into the upload, and the CDN node itself runs a sweeper that deletes expired files (and their variants) from storage when they expire, then reports each deletion to the Oblien API — which marks the record deleted and frees the quota. There is no Oblien→CDN delete call; the node cleans itself. The freed space shows up in usage after the next flush.

TTL is per-upload, so you can mix permanent and ephemeral assets in the same namespace (e.g. avatars forever, stories for 24h).