EmberlyEmberly Docs

URL Shortener API

Create and manage shortened URLs via the Emberly REST API.

Emberly includes a URL shortener that generates 6-character short codes at embrly.ca/<code>. All URL endpoints require a bearer token (your upload token).

Endpoints

MethodPathDescription
POST/api/urlsCreate a shortened URL
GET/api/urlsList your shortened URLs
DELETE/api/urls/[id]Delete a shortened URL

Create a Shortened URL

POST /api/urls

Auth: Bearer token
Content-Type: application/json

Request Body:

FieldTypeRequiredDescription
urlstringYesThe full URL to shorten (must be a valid HTTPS/HTTP URL)

Request:

{ "url": "https://example.com/very/long/path?query=value" }

Response (201):

{
  "success": true,
  "data": {
    "id": "cm8xdef456",
    "shortCode": "abc123",
    "shortUrl": "https://embrly.ca/abc123",
    "originalUrl": "https://example.com/very/long/path?query=value",
    "clicks": 0,
    "createdAt": "2026-04-12T10:00:00Z"
  }
}

Errors:

StatusMeaning
400Invalid or missing URL
401Missing or invalid bearer token
429Rate limit exceeded

cURL:

curl -X POST \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com/long/url"}' \
  https://embrly.ca/api/urls

JavaScript:

const res = await fetch("https://embrly.ca/api/urls", {
  method: "POST",
  headers: {
    "Authorization": "Bearer YOUR_TOKEN",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ url: "https://example.com/long/url" }),
});
 
const { data } = await res.json();
console.log(data.shortUrl); // "https://embrly.ca/abc123"

List Your URLs

GET /api/urls

Returns a paginated list of all shortened URLs you have created.

Auth: Bearer token

Query Parameters:

ParameterDefaultDescription
page1Page number
limit20Results per page

Response (200):

{
  "success": true,
  "data": [
    {
      "id": "cm8xdef456",
      "shortCode": "abc123",
      "shortUrl": "https://embrly.ca/abc123",
      "originalUrl": "https://example.com/long/url",
      "clicks": 14,
      "createdAt": "2026-04-12T10:00:00Z"
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 20,
    "total": 42,
    "totalPages": 3
  }
}

Delete a URL

DELETE /api/urls/[id]

Permanently delete a shortened URL. The short code immediately stops redirecting.

Auth: Bearer token (owner only)

Response (200):

{ "success": true }

Errors:

StatusMeaning
401Not authenticated
403Not the owner of this URL
404URL not found

How Redirects Work

When someone visits https://embrly.ca/<shortCode>, the server performs a 301 permanent redirect to the original URL. No auth is required to follow a short link.

Short codes are 6 characters (nanoid). They are unique globally — two users cannot have the same short code, even if pointing to the same destination URL.


On this page