API Documentation
The URLit API allows you to programmatically shorten, manage, and track URLs.
Base URL
API Version
All endpoints are versioned with /v1. The current version is v1.
Example: https://urlit.zone.id/api/v1/shorten
✅ All API endpoints are publicly accessible – no API key required for basic shortening. For user‑specific endpoints (listing, updating, deleting), you'll need to authenticate using Firebase ID tokens.
Authentication
For endpoints that require user authentication (listing, updating, deleting URLs), you must provide a Firebase ID token in the Authorization header:
To obtain a Firebase ID token:
- Sign in using Firebase Auth (via the web interface or your own integration).
- Call
currentUser.getIdToken()to get the token. - Include it in the header for authenticated requests.
Shorten a URL
Create a short URL from a long URL. Optionally provide a custom slug.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | Yes | The original URL to shorten (must include http:// or https://) |
customSlug | string | No | A custom short code (letters, numbers, hyphens only, 3-20 characters) |
userId | string | No | Firebase UID – if provided, the URL will be associated with a user account |
Response
Example Request
Get URL Details
Retrieve details about a specific short URL.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
shortCode | string | Yes | The short code (e.g., Ab3Kx9) |
Response
List User URLs
Retrieve all URLs belonging to a specific user. Requires authentication (Firebase ID token).
Headers
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer YOUR_FIREBASE_ID_TOKEN |
Response
Update a URL
Update the status or original URL of a short URL. Requires authentication (Firebase ID token) and ownership.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
status | string | No | "active" or "disabled" |
originalUrl | string | No | New destination URL |
Response
Delete a URL
Permanently delete a short URL. Requires authentication (Firebase ID token) and ownership.
Response
Get URL Analytics
Retrieve click analytics for a short URL, including total clicks and recent click events.
Response
Error Codes
The API uses standard HTTP status codes to indicate success or failure.
| Status Code | Description |
|---|---|
200 | OK – request succeeded |
400 | Bad Request – missing or invalid parameters |
401 | Unauthorized – missing or invalid authentication |
403 | Forbidden – not allowed to access resource |
404 | Not Found – resource doesn't exist |
409 | Conflict – custom slug already taken |
429 | Too Many Requests – rate limiting exceeded |
500 | Internal Server Error – something went wrong |