Getting Started
1 · Pick your auth
JWT Bearer — call POST /api/login (or sign in with Google) and sendAuthorization: Bearer <token> on every dashboard API. Tokens last 30 days.
API Token — the classic shorten API GET /api takes your token as theapi query parameter. Copy it from Dashboard → Settings or rotate it withPOST /api/regenerate-key.
2 · Typical flow
Register → Login (keep the JWT) → shorten with POST /api/create → sharehttps://urlking.in/{id} → watch clicks & earnings in GET /api/stats → cash out with POST /api/withdraw/request.
Uploading files? Two steps: GET /api/dev/server tells you where to upload, then POST /api/dev/finalize registers the file and returns its share URL.
3 · Errors & limits
Errors always come as { "error": "message" } with a proper HTTP status (400 validation · 401 auth · 403 forbidden · 404 missing · 409 conflict · 429 rate-limited).
The public GET /api endpoint uses its own shape:{ status, message, shortenedUrl }. General API rate-limit applies per IP; Google auth is capped at 30 req / 15 min.
Developer API
/apiAPI TokenThe classic public shorten API. No login required — authenticate with your API token and get a monetized short link back. Re-shortening the same URL for the same account returns the existing link (deduplicated) instead of a new one.
curl "https://go.urlking.in/api?api=YOUR_API_TOKEN&url=https://example.com/page&alias=my-deal"{
"status": "success",
"message": "",
"shortenedUrl": "https://go.urlking.in/api/step2/AbC12"
}Authentication
/api/registerPublicCreate a new publisher account. The account is provisioned in Firebase Auth + the users table, a wallet row is created, and referral credit is applied when a valid ref is supplied.
curl -X POST "https://go.urlking.in/api/register" \ -H "Content-Type: application/json" \ -d '{"username":"vikubhai","email":"[email protected]","password":"secret123","ref":"friend_username"}'
{
"ok": true
}/api/loginPublicSign in with username or e-mail + password. Returns a JWT session token valid for 30 days. Send it as Authorization: Bearer <token> on every protected call.
curl -X POST "https://go.urlking.in/api/login" \ -H "Content-Type: application/json" \ -d '{"identifier":"vikubhai","password":"secret123"}'
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9…"
}/api/google-authPublicSign in / auto-register with Google. Accepts either a Google ID token (credential, from GIS button) or an OAuth access token (from the custom premium button). Existing e-mail → instant login; new e-mail → account auto-created (Firebase user without password, wallet, default CPM, referral link).
curl -X POST "https://go.urlking.in/api/google-auth" \ -H "Content-Type: application/json" \ -d '{"access_token":"ya29.a0AfB_…","ref":"friend_username"}'
{
"token": "eyJhbGciOiJIUzI1NiIs…",
"username": "john_doe95",
"is_new_user": true
}/api/auth/forgot-passwordPublicRequest a password-reset e-mail. A secure, expiring reset token is generated and dispatched to the registered address.
curl -X POST "https://go.urlking.in/api/auth/forgot-password" \ -H "Content-Type: application/json" \ -d '{"email":"[email protected]"}'
{
"ok": true
}/api/auth/verify-token/:tokenPublicCheck whether a password-reset token is still valid before showing the new-password form.
curl -X GET "https://go.urlking.in/api/auth/verify-token/RESET_TOKEN"{
"ok": true
}/api/auth/reset-confirmPublicComplete the password reset. Updates the Firebase password and syncs the has_password flag (so Google-only users can also use this route).
curl -X POST "https://go.urlking.in/api/auth/reset-confirm" \ -H "Content-Type: application/json" \ -d '{"token":"RESET_TOKEN","newPassword":"newSecret123"}'
{
"ok": true
}Account & Profile
/api/meBearer JWTFull session profile: identity, CPM rate, API token, upload permission, payout settings and the live wallet snapshot in one call.
curl -X GET "https://go.urlking.in/api/me" \ -H "Authorization: Bearer YOUR_JWT_TOKEN"
{
"uid": "FirebaseUID123",
"username": "vikubhai",
"email": "[email protected]",
"name": "Viku",
"role": "user",
"cpm": 2,
"has_password": 1,
"can_upload": 1,
"api_token": "R4nd0mAp1K3y…",
"mobile": "",
"telegram": "",
"youtube": "",
"social": "",
"referred_by": null,
"withdrawal_method": "upi",
"withdrawal_account": "",
"balance": 12.5,
"total_withdrawn": 40,
"pending_withdrawn": 0,
"lifetime_collected": 52.5,
"created_at": 1700000000000
}/api/profileBearer JWTUpdate profile details and payout settings in a single request. Only the fields you send are required by the client — the endpoint stores all of them.
curl -X POST "https://go.urlking.in/api/profile" \ -H "Authorization: Bearer YOUR_JWT_TOKEN" \ -H "Content-Type: application/json" \ -d '{"name":"Viku","social":"","mobile":"+91…","telegram":"vikubhai01","youtube":"","withdrawal_method":"upi","withdrawal_account":"name@upi","upi_id":"name@upi"}'
{
"ok": true
}/api/change-passwordBearer JWTChange an existing password. The old password is verified against Firebase first, then the new one is applied.
curl -X POST "https://go.urlking.in/api/change-password" \ -H "Authorization: Bearer YOUR_JWT_TOKEN" \ -H "Content-Type: application/json" \ -d '{"oldPassword":"secret123","newPassword":"newSecret123"}'
{
"ok": true,
"message": "Password updated successfully"
}/api/set-passwordBearer JWTFirst-time password for Google signups. No current password required (there is none). Only allowed while has_password = 0; after this the account behaves like a normal e-mail + password account.
curl -X POST "https://go.urlking.in/api/set-password" \ -H "Authorization: Bearer YOUR_JWT_TOKEN" \ -H "Content-Type: application/json" \ -d '{"newPassword":"mySecret123"}'
{
"ok": true,
"message": "Password set successfully"
}/api/regenerate-keyBearer JWTRotate the API token used by the public Developer API. The old token stops working immediately.
curl -X POST "https://go.urlking.in/api/regenerate-key" \ -H "Authorization: Bearer YOUR_JWT_TOKEN"
{
"api_key": "NEW_R4nd0mAp1K3y…"
}Link Management
/api/createBearer JWTCreate a short link. Without an alias and expiry, re-submitting the same destination URL returns the existing link id (dedupe). With an alias you choose the back-half.
curl -X POST "https://go.urlking.in/api/create" \ -H "Authorization: Bearer YOUR_JWT_TOKEN" \ -H "Content-Type: application/json" \ -d '{"url":"https://example.com/very/long/target","alias":"my-deal","expires_at":"2026-12-31T18:30:00.000Z"}'
{
"id": "xK9mP"
}/api/history?page=1Bearer JWTPaged short-link history for the logged-in account (5 per page, newest first). Deleted links and internal file rows (raw_*) are excluded.
curl "https://go.urlking.in/api/history?page=1?page=1"[
{
"id": "xK9mP",
"url": "https://example.com/page",
"created_at": 1700000000000,
"expires_at": null
},
{
"id": "aB3zQ",
"url": "https://example.com/other",
"created_at": 1699999000000,
"expires_at": 1730000000000
}
]/api/linkBearer JWTChange the destination URL of an existing short link. Redirect caches are invalidated instantly.
curl -X POST "https://go.urlking.in/api/link" \ -H "Authorization: Bearer YOUR_JWT_TOKEN" \ -H "Content-Type: application/json" \ -d '{"id":"xK9mP","url":"https://new-destination.com"}'
{
"ok": true
}/api/mass-createBearer JWTBulk shorten up to 20 URLs in one request. Each URL gets a fresh random id.
curl -X POST "https://go.urlking.in/api/mass-create" \ -H "Authorization: Bearer YOUR_JWT_TOKEN" \ -H "Content-Type: application/json" \ -d '{"urls":["https://site-one.com","site-two.com/page"]}'
{
"shortLinks": [
"https://urlking.in/mQ2xZ",
"https://urlking.in/Lp0wN"
]
}Stats & Wallet
/api/statsBearer JWTDashboard analytics aggregate: click counts and earnings for the account. Admins can throttle heavy polling via an hourly-limit switch (429 when triggered).
curl -X GET "https://go.urlking.in/api/stats" \ -H "Authorization: Bearer YOUR_JWT_TOKEN"
{
"today_clicks": 320,
"yesterday_clicks": 512,
"total_clicks": 15420,
"today_earnings": 0.64,
"total_earnings": 52.5
}/api/stats/earningsBearer JWTEarnings time-series used by the dashboard chart (daily buckets).
curl -X GET "https://go.urlking.in/api/stats/earnings" \ -H "Authorization: Bearer YOUR_JWT_TOKEN"
{
"daily": [
{
"date": "2026-11-04",
"earnings": 0.64,
"clicks": 320
}
]
}/api/stats/devicesBearer JWTTraffic split by device / platform for the account.
curl -X GET "https://go.urlking.in/api/stats/devices" \ -H "Authorization: Bearer YOUR_JWT_TOKEN"
{
"devices": [
{
"name": "Android",
"share": 62.4
},
{
"name": "Windows",
"share": 24.1
},
{
"name": "iOS",
"share": 13.5
}
]
}/api/user/top-linksBearer JWTBest performing short links ranked by clicks.
curl -X GET "https://go.urlking.in/api/user/top-links" \ -H "Authorization: Bearer YOUR_JWT_TOKEN"
{
"links": [
{
"id": "xK9mP",
"url": "https://example.com",
"clicks": 8421,
"earnings": 32.1
}
]
}/api/wallet/balanceBearer JWTLightweight live wallet balance (briefly cached per user for speed).
curl -X GET "https://go.urlking.in/api/wallet/balance" \ -H "Authorization: Bearer YOUR_JWT_TOKEN"
{
"balance": "12.5000",
"currency": "USD"
}File Uploader
/api/dev/server?size=&name=&type=JWT + Upload AccessStep 1 of every upload — asks the backend where to send the bytes. ≤100 MB goes to the Telegram pipeline; larger files get a presigned Cloudflare R2 URL (quota checked); duplicates of known hashes can return an instant clone.
curl "https://go.urlking.in/api/dev/server?size=&name=&type=?size=5242880&name=movie.mp4&type=video/mp4"{
"upload_type": "r2",
"url": "https://r2-presigned-upload-url…",
"file_code": "Fc8xK2aQ",
"r2_key": "uploads/…"
}/api/dev/finalizeJWT + Upload AccessStep 2 — register the uploaded bytes as a file link. Creates the internal raw_ row and the public file_xxx row and returns the shareable download-page URL.
curl -X POST "https://go.urlking.in/api/dev/finalize" \ -H "Authorization: Bearer YOUR_JWT_TOKEN" \ -H "Content-Type: application/json" \ -d '{"file_code":"Fc8xK2aQ","file_name":"movie.mp4","file_size":"5242880","upload_type":"r2","r2_key":"uploads/…","file_hash":"sha256…"}'
{
"short_id": "file_Ab12Cd34",
"url": "https://go.urlking.in/d?id=raw_Xy9…",
"file_name": "movie.mp4",
"file_size": "5.00 MB"
}/api/dev/storage-infoJWT + Upload AccessStorage meter data — counts ONLY active files (soft-deleted / orphan rows are excluded), so the number always matches the File Manager list.
curl -X GET "https://go.urlking.in/api/dev/storage-info" \ -H "Authorization: Bearer YOUR_JWT_TOKEN"
{
"used": "728.31 MB",
"limit": "20 GB",
"files": 42
}/api/dev/my-filesJWT + Upload AccessFile Manager listing: every active file owned by the account with its share URL, name and formatted size.
curl -X GET "https://go.urlking.in/api/dev/my-files" \ -H "Authorization: Bearer YOUR_JWT_TOKEN"
{
"files": [
{
"id": "file_Ab12Cd34",
"file_name": "movie.mp4",
"file_size": "5.00 MB",
"url": "https://go.urlking.in/d?id=raw_Xy9…",
"created_at": 1700000000000
}
]
}/api/dev/delete-file/:idJWT + Upload AccessSoft-delete a file: it disappears from the File Manager and its size is freed from the storage meter.
curl -X DELETE "https://go.urlking.in/api/dev/delete-file/file_abc123" \ -H "Authorization: Bearer YOUR_JWT_TOKEN"
{
"ok": true
}/api/dev/rename-fileJWT + Upload AccessRename a file in the File Manager (also syncs the name on the storage backend).
curl -X POST "https://go.urlking.in/api/dev/rename-file" \ -H "Authorization: Bearer YOUR_JWT_TOKEN" \ -H "Content-Type: application/json" \ -d '{"short_id":"file_Ab12Cd34","new_name":"My Holiday Video.mp4"}'
{
"ok": true
}/api/dev/all-permissionsJWT + Upload AccessUpload permission overview used by the manager panel (who can upload, global allow-all flag).
curl -X GET "https://go.urlking.in/api/dev/all-permissions" \ -H "Authorization: Bearer YOUR_JWT_TOKEN"
{
"can_upload": 1,
"allow_all": 0
}Downloads
/api/download/infoPublicPublic file metadata for the download page header — resolves both raw_ internal ids and public file_ ids.
curl -X POST "https://go.urlking.in/api/download/info" \ -H "Content-Type: application/json" \ -d '{"file_id":"raw_Xy9AbC"}'
{
"filename": "movie.mp4",
"size": "5.00 MB"
}/api/download/generate-tokenPublicIssue the final download token/URL for a file. Monetization gate: a valid click on the short link within the last 24 hours is required.
curl -X POST "https://go.urlking.in/api/download/generate-token" \ -H "Content-Type: application/json" \ -d '{"file_id":"raw_Xy9AbC"}'
{
"token": "dl_xxx…",
"url": "https://cdn…/file?token=dl_xxx"
}Withdrawals & Referrals
/api/withdraw/info?page=1Bearer JWTWithdrawal center data: balances, the minimum limit for the user’s selected method, and paged transaction history (withdrawals + rewards combined).
curl "https://go.urlking.in/api/withdraw/info?page=1?page=1"{
"balance": "12.5000",
"total_withdrawn": "40.0000",
"pending_withdrawn": "0.0000",
"min_limit": 5,
"history": [
{
"id": "W123",
"amount": 10,
"status": "approved",
"method": "upi",
"created_at": 1700000000000,
"transaction_type": "withdrawal"
}
],
"total": 4,
"pages": 2,
"currentPage": 1
}/api/withdraw/requestBearer JWTCreate a withdrawal request from the available wallet balance. Amount must respect the method’s minimum limit; the request goes to the admin queue.
curl -X POST "https://go.urlking.in/api/withdraw/request" \ -H "Authorization: Bearer YOUR_JWT_TOKEN" \ -H "Content-Type: application/json" \ -d '{"amount":10}'
{
"ok": true,
"message": "Withdrawal request submitted"
}/api/referral/statsBearer JWTReferral program dashboard: referred users, lifetime commission and the shareable referral link.
curl -X GET "https://go.urlking.in/api/referral/stats" \ -H "Authorization: Bearer YOUR_JWT_TOKEN"
{
"total_earnings": 3.2,
"referral_count": 7,
"referral_link": "https://urlking.in/register?ref=vikubhai",
"commission_rate": "5%",
"users": [
{
"username": "friend_one",
"created_at": 1700000000000
}
]
}System
/healthPublicContainer-level liveness probe (used by uptime monitors and orchestrators).
curl -X GET "https://go.urlking.in/health"{
"status": "ok"
}/api/server-healthPublicDeeper health check with process uptime and a live database latency measurement.
curl -X GET "https://go.urlking.in/api/server-health"{
"status": "Online 🟢",
"uptime": "132.45 mins",
"db_latency": "3ms"
}/api/maintenance-statusPublicReturns the current maintenance flag so clients can show/hide the maintenance screen.
curl -X GET "https://go.urlking.in/api/maintenance-status"{
"maintenance": false,
"message": ""
}