Developer-ready

Upload from bots, tools, dashboards, and scripts without losing the pretty links.

The EmbedCDN API turns file uploads into Discord and social-friendly file routes, compact short links, and metadata-rich previews that are easy to automate.

Overview

What this API does

Programmatically upload files, mint short links, and return preview-friendly routes that work nicely with Discord, internal dashboards, moderation tools, CI jobs, and bot workflows.

Automated uploads

Send multipart uploads from a server, bot, job runner, or admin tool.

Embed-friendly links

Get a `fileLink` route that is designed for rich unfurl and preview behavior.

Short links included

Every upload can produce a cleaner `shortLink` for captions, messages, and handoffs.

Authentication

Token-based auth, sent in a header

The API expects your token in the request header below. Keep it on the server side only.

x-api-token: YOUR_API_TOKEN
Never expose this token in public frontend code

Use it from your backend, bot, CLI, cron job, or internal admin tooling.

Browser tester is for trusted app owners

The tester on this page is useful inside your own app, but production integrations should still call the API from your server or bot.

Upload Endpoint

POST /api/upload

Send a `multipart/form-data` request with your file and optional metadata. The current backend expects the uploaded file field to be named `myFile`.

POST /api/upload
Content type

multipart/form-data

Required file field

myFile

Optional fields

customSlug, title, description

Auth header

x-api-token

Request fields
  • myFile: the file to upload
  • customSlug: optional branded short code, 3-40 chars
  • title: optional embed title
  • description: optional embed description
Response example
{
  "data": {
    "fileLink": "https://discordcdn-omega.vercel.app/files/abc123.png",
    "shortLink": "https://discordcdn-omega.vercel.app/s/demo",
    "shortCode": "demo",
    "fileSize": "248 KB",
    "fileName": "abc123.png",
    "uploadLink": "https://discordcdn-omega.vercel.app/uploads/abc123.png",
    "title": "Launch poster",
    "description": "Tiny link. Big preview."
  }
}
Examples

Copy-pasteable examples in the languages people actually use

Each sample uploads a file, sends the token header, and reads back the returned `fileLink` or `shortLink`.

cURL upload
curl -X POST "https://discordcdn-omega.vercel.app/api/upload" \
+  -H "x-api-token: YOUR_API_TOKEN" \
+  -F "myFile=@./image.png" \
+  -F "customSlug=launch-assets" \
+  -F "title=Launch poster" \
+  -F "description=Tiny link. Big preview."
Test Your API

Check your token and upload flow right from the docs

Useful for quick setup verification. The token is used only for this request and is not stored permanently by the page.

Production note

For production, call this API from your server or bot, not public frontend code.

Result preview Waiting for a test upload
{
  "message": "Upload a file with your token to see the live response here."
}
API Status

Quick health check for uptime and response time

The button below calls `/api/health` and reports the server timestamp and request duration.

Status Idle
Response time Not checked yet
Server time Waiting for a request
{
  "ok": true,
  "service": "EmbedCDN API",
  "time": "ISO_DATE"
}
Common Errors

What went wrong, and how to fix it fast

401 Invalid API token

Meaning: the token header is missing or does not match the configured API token.

Fix: send the correct value in `x-api-token` and make sure the server has `API_TOKEN` configured.

400 No file uploaded

Meaning: the request did not include a file in `myFile` or the payload shape was wrong.

Fix: send `multipart/form-data` and make sure the file field name exactly matches `myFile`.

409 Custom slug already exists

Meaning: the requested `customSlug` is already taken.

Fix: choose a different slug or leave it blank and let the server mint one automatically.

413 File too large

Meaning: the upload exceeded the server or platform file size limit.

Fix: reduce the asset size or adjust your deployment upload limit if your hosting setup supports it.

500 Server error

Meaning: storage, filesystem, or server-side upload handling failed.

Fix: check server logs, storage credentials, and write permissions, then retry the request.

Developer Notes

Small habits that save time later

  • Use shortLink for clean sharing in chat messages, dashboards, and captions.
  • Use fileLink when Discord embed preview behavior is required.
  • Use customSlug for branded, memorable links when the name is available.
  • Rotate your API token immediately if it is leaked or committed anywhere public.
  • Keep webhook URLs and API tokens in environment variables, not hardcoded into app code.