Integration Guide

Streamline assets deployment across the Ceyon Edge Network. Easily manage images, view raw text/code snippets directly in-browser, preview PDFs, and download files with automated copyright branding.

Authentication

All API requests to the upload endpoint require authentication via a Bearer token. Generate an API Key within your Ceyon Dashboard and include it in your HTTP headers:

Authorization: Bearer cyn_YOUR_API_KEY

Supported File Types

Ceyon securely handles web-compatible imagery, plain text, documents, code files, and media (video/audio).

.png .jpg .jpeg .gif .webp .svg .js .ts .jsx .tsx .py .java .c .cpp .cs .html .css .json .xml .md .yaml .sql .go .rs .swift .kt .php .rb .vue .svelte .pdf .doc .docx .xls .xlsx .ppt .pptx .odt .ods .rtf .epub .csv .txt .env .mp4 .webm .avi .mov .mp3 .wav .ogg

When sending programmatic payloads, compile your assets as Base64 data URLs. Ceyon automatically extracts and saves the correct extension based on your originalName attribute.

Method 1: Displaying & Serving Assets

Ceyon serves different asset categories based on their target usability. The URL matches the clean ID structure generated upon upload:

<!-- Use the returned CDN URL directly in your HTML frontend -->
<img src="https://ceyon.netlify.app/asset/CEYONmoac22recwqm7kyvcgszuo" alt="Ceyon Edge Asset" />

Method 2: Client-Side Upload (Browser)

Use client-side scripts to upload files on the fly. Pass the Base64 representation along with the file's metadata directly to the upload endpoint:

// 1. Grab file from input element
const file = document.getElementById('fileInput').files[0];
const reader = new FileReader();

reader.onload = async () => {
  // 2. Upload Base64 representation directly to the API
  const response = await fetch("https://ceyon.netlify.app/api/upload", {
    method: "POST",
    headers: {
      "Authorization": "Bearer cyn_YOUR_API_KEY",
      "Content-Type": "application/json"
    },
    body: JSON.stringify({ 
      base64: reader.result, 
      visibility: "public",
      originalName: file.name
    })
  });

  const data = await response.json();
  console.log("Success! CDN URL:", data.url);
};

reader.readAsDataURL(file);

Method 3: Server-Side REST API

Node.js (Fetch)
Node.js (Fetch) Python (Requests) cURL

Integrate your server or build scripts to programmatically push assets during CI/CD. Ceyon parses any of the standard metadata keys (originalName, name, or fileName).

Method 4: Downloading Assets with Branded Names

Append the query parameter ?download=1 (or ?dl=1) to force an instantaneous download instead of an inline preview. Downloaded assets automatically receive custom Ceyon copyright branding while cleanly maintaining their original file extensions.

Download Prerequisites

A download request successfully triggers when: (1) Visibility is set to public. (2) "Allow public downloads" is enabled in your Project Settings. (3) The referrer matches your allowed CORS domains list.

<!-- Direct branded attachment download -->
<a href="https://ceyon.netlify.app/asset/CEYONabc123?download=1">
  Download File
</a>

<!-- Saved locally as: "© Ceyon | CDN - CEYONabc123.png" -->

Method 5: Overwriting & Replacing Assets

Update or patch file contents globally on the CDN without breaking your live links. Send a PUT request specifying the existing target id. This preserves view logs and date metadata.

const response = await fetch("https://ceyon.netlify.app/api/upload", {
  method: "PUT", // <-- Put ensures we edit the existing record
  headers: {
    "Authorization": "Bearer cyn_YOUR_API_KEY",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({ 
    id: "CEYONmoac22recwqm7kyvcgszuo", // Overwrites this asset ID
    base64: "data:text/css;base64,...",
    originalName: "styles.css"
  })
});

const data = await response.json();
console.log("Successfully overwritten!", data);

CORS & Domain Restrictions

For security, you can restrict where your assets can be viewed or fetched. Domain restrictions can be applied at the **Project level** or the individual **API Key level**:

Edge Gateway Verification

Ceyon inspects incoming Referer and Origin request headers against your database configurations at the gateway level. Requests from unauthorized domains receive an XML AccessDenied 403 response.

AI Crawler & Scraper Compatibility

Ceyon is designed to be fully compatible with AI models and search engine scrapers. When crawlers like ChatGPT (GPTBot), Anthropic (ClaudeBot), Google, or social embeds access your public assets, Ceyon automatically detects them and bypasses standard CORS and domain restrictions.

Supported Scrapers

Bypass triggers automatically for: OpenAI (GPTBot), Anthropic (ClaudeBot), Applebot, Googlebot, Bingbot, Slackbot, Discordbot, Twitter/X, and Facebook external hits. Private files remain entirely blocked from AI access.

Live Flow Simulator JSON request cycles
{ "base64": "data:text/css;base64,Ym9keSB7...", "visibility": "public", "originalName": "global.css" }

Status Codes

CodeMeaning
200 OKSuccessful asset transaction.
400 Bad RequestInvalid Base64 payload or unsupported file format.
401 UnauthorizedMissing or incorrect API Bearer authorization.
403 ForbiddenDomain restricted or downloads disabled on the target project.
404 Not FoundAsset has private visibility or doesn't exist.
405 Method BlockedRoute only supports POST or PUT.
500 ErrorDatabase transaction failure.

Best Practices

  • Prefilter uploads: Enforce format checks in your UI as audio/video binaries will fail instantly.
  • Protect keys: Restrict CORS domains on keys to prevent unauthorized upload attempts.
  • Dashboard Views: Change list, grid, and table layouts from your toolbar to save visual preferences instantly to your profile.
  • Direct URL previews: Share plain links to images/PDFs directly, as the CDN now serves them inline for effortless previews.