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
| Method | Path | Description |
|---|---|---|
POST | /api/urls | Create a shortened URL |
GET | /api/urls | List 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:
| Field | Type | Required | Description |
|---|---|---|---|
url | string | Yes | The full URL to shorten (must be a valid HTTPS/HTTP URL) |
Request:
Response (201):
Errors:
| Status | Meaning |
|---|---|
400 | Invalid or missing URL |
401 | Missing or invalid bearer token |
429 | Rate limit exceeded |
cURL:
JavaScript:
List Your URLs
GET /api/urls
Returns a paginated list of all shortened URLs you have created.
Auth: Bearer token
Query Parameters:
| Parameter | Default | Description |
|---|---|---|
page | 1 | Page number |
limit | 20 | Results per page |
Response (200):
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):
Errors:
| Status | Meaning |
|---|---|
401 | Not authenticated |
403 | Not the owner of this URL |
404 | URL 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.
Related
- User Guide: URL Shortener
- Analytics API — track click counts on your URLs
- Files API — upload files alongside short links