Clatter Labs
Console

Code Buckets

Get a public URL

A stored file's stable public link, and whether it works right now.

GETapi.codebuckets.clatterlabs.xyz/v1/buckets/{bucket_id}/objects/{object_id}/public-urlbuckets:read

Returns the file's public link: https://img.cdn.clatterlabs.xyz/<id> for images (image/*), https://files.cdn-buckets.clatterlabs.xyz/<object_id>/<name> for everything else. public says whether it works right now. An image's id is replaced when it stops being public, so ask again after making it public.

Authorizations

Authorizationstringrequired

Your API key as a bearer token: Bearer clsk_.... Create keys in the Console with the Code Buckets permissions you need.

X-Clatter-Accountstringrequired

The Account ID that owns the key, like CL-7K2M9QXA. Find it in Console › Settings. A missing value answers 401 missing_account_id; someone else's answers 401 account_mismatch.

Path parameters

bucket_idstringrequired

The bucket id (cbk_…).

object_idstringrequired

The object id (cbo_…) of a stored zip or asset.

Response

200 · application/json

objectstring

Always public_url.

object_id / bucket_idstring

The file and its bucket.

urlstring

The public link (images: img.cdn.clatterlabs.xyz/; other files: files.cdn-buckets.clatterlabs.xyz//).

served_asstring

image (public link on img.cdn.clatterlabs.xyz, cached for a year) or file (files.cdn-buckets.clatterlabs.xyz).

content_typestring

The Content-Type the link is served with.

publicboolean

true when the link works now.

visibilitystring

The file's own setting: inherit, private or public.

effective_visibilitystring

public or private: what applies now.

bucket_visibilitystring

The bucket's default.

Errors

StatusCodeWhen
401invalid_api_key / missing_account_id / account_mismatchThe key or Account ID is wrong.
402quota_exceededThis month's free tokens are used up.
403insufficient_scopeThe key lacks the permission.
404not_foundNo bucket or object with that id on your account.
409not_readyThe upload isn't complete yet.
curl "https://api.codebuckets.clatterlabs.xyz/v1/buckets/BUCKET_ID/objects/OBJECT_ID/public-url" \
  -H "Authorization: Bearer $CLATTER_API_KEY" \
  -H "X-Clatter-Account: $CLATTER_ACCOUNT_ID"
import os
import requests

headers = {
    "Authorization": f"Bearer {os.environ['CLATTER_API_KEY']}",
    "X-Clatter-Account": os.environ["CLATTER_ACCOUNT_ID"],
}

r = requests.get("https://api.codebuckets.clatterlabs.xyz/v1/buckets/BUCKET_ID/objects/OBJECT_ID/public-url", headers=headers)
print(r.json())
const headers = {
  Authorization: `Bearer ${process.env.CLATTER_API_KEY}`,
  "X-Clatter-Account": process.env.CLATTER_ACCOUNT_ID,
};

const res = await fetch("https://api.codebuckets.clatterlabs.xyz/v1/buckets/BUCKET_ID/objects/OBJECT_ID/public-url", {
  method: "GET",
  headers,
});
console.log(await res.json());
{
  "object": "public_url",
  "object_id": "cbo_x4p8t2w6r1k9m3q7n5d0",
  "bucket_id": "cbk_q7c1r9t2y6u0i3o8p5a4",
  "url": "https://img.cdn.clatterlabs.xyz/V1StGXR8Z5jdHi6BmyT2kq",
  "served_as": "image",
  "content_type": "image/png",
  "public": true,
  "visibility": "inherit",
  "effective_visibility": "public",
  "bucket_visibility": "public"
}