New: free WhatsApp, UPI QR and link-safety tools — no sign-up needed. Try them
Developers

Developers & REST API

Create, update and track hi4.in short links from your own app, CRM or SMS system. One API key, plain JSON, works with curl.

Base URLhttps://hi4.in/api/v1
AuthenticationX-API-Key
FormatJSON in, JSON out
StatusLive Pro and Business plans
Quick start

Your first short link in three steps

Create an account

Sign up free and open your dashboard.

Create free account

Create an API key

Dashboard → API keys. Copy the key straight away: it is shown only once.

How to create a key

Call the API

Send the key in the X-API-Key header. Start with GET /test, then create a link.

Request
curl -X POST https://hi4.in/api/v1/links \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "long_url": "https://example.com/diwali-sale",
    "title": "Diwali sale",
    "custom_slug": "diwali-sale"
  }'
Response
{
    "success": true,
    "data": {
        "id": "1234",
        "slug": "diwali-sale",
        "short_url": "https://hi4.in/u/diwali-sale",
        "long_url": "https://example.com/diwali-sale",
        "title": "Diwali sale",
        "expires_at": null,
        "created_at": "2026-10-22 16:05:10"
    }
}

Read slug from the response. If custom_slug is invalid or already taken, the API uses a random slug instead of failing.

Authentication

One key in one header

  • Send your key in the X-API-Key header on every call. Only /test, /health and /docs work without one.
  • A key is shown once. We store only a fingerprint (hash) of it, so we cannot show it again — create a new key if you lose it.
  • You can give a key an expiry date when you create it, and delete keys at any time.
  • Keep keys on your server. Never put them in a website, mobile app or public code.
  • Every call counts towards your account’s hourly limit. Check it with GET /stats.
Example
# Every request carries your key
curl https://hi4.in/api/v1/links \
  -H "X-API-Key: YOUR_API_KEY"

# No key or a wrong key: HTTP 401
{
    "error": "API key required"
}
# No key needed: check you can reach the API
curl https://hi4.in/api/v1/test

{
    "success": true,
    "message": "API is working",
    "timestamp": "2026-10-22T16:04:52+05:30"
}
Reference

Endpoints

All paths are relative to https://hi4.in/api/v1. Requests and responses are JSON.

  • POST /links Create a short link API key
  • GET /links List your links, newest first (page, limit up to 100) API key
  • GET /links/{id} One link with its click analytics API key
  • PUT /links/{id} Change the title, destination, expiry or visibility API key
  • DELETE /links/{id} Delete a link API key
  • GET /links/{id}/analytics Click summary, top locations and devices API key
  • GET /domains Your custom domains Coming soonAPI key
  • POST /domains Add a custom domain to your account Coming soonAPI key
  • GET /stats Your hourly request limit and what is left API key
  • GET /test Check the API is reachable No key
  • GET /health Service health check No key
  • GET /docs Machine-readable list of these endpoints No key

Examples

Newest first. limit is capped at 100; use pagination.pages to loop.

Request
curl "https://hi4.in/api/v1/links?page=1&limit=20" \
  -H "X-API-Key: YOUR_API_KEY"
Response
{
    "success": true,
    "data": [
        {
            "id": 1234,
            "slug": "diwali-sale",
            "long_url": "https://example.com/diwali-sale",
            "title": "Diwali sale",
            "total_clicks": 42,
            "last_click": "2026-10-21 18:30:12",
            "short_url": "https://hi4.in/u/diwali-sale"
        }
    ],
    "pagination": { "page": 1, "limit": 20, "total": 57, "pages": 3 }
}
Fields

What to send and what you get back

Create a link — POST /links

FieldTypeRequiredWhat it does
long_urlstring (URL)RequiredThe destination. A full address including https://.
titlestringOptionalA label for your dashboard and reports.
custom_slugstringOptional3–50 letters, numbers or hyphens. If it is invalid, reserved or already taken, a random slug is used instead — always read slug from the response.
passwordstringOptionalVisitors must type this password before they are sent on.
expires_atstring (ISO 8601)OptionalAfter this time the link stops working. Include a time zone, e.g. 2026-12-31T23:59:59+05:30.
domain_idintegerOptionalOne of your own domains from GET /domains. Until a domain is verified, short_url stays on hi4.in.

Update a link — PUT /links/{id}

FieldTypeWhat it does
titlestringNew label.
long_urlstring (URL)New destination. The short link and any printed QR code keep working.
expires_atstring (ISO 8601)New expiry. Send an empty string "" to remove the expiry.
is_publicbooleanMarks the link as public (true) or private (false).

Link object in responses

FieldTypeNotes
idintegerUse it with /links/{id}. In the create response it arrives as a string.
slugstringThe part after the domain. May differ from custom_slug (see above).
short_urlstringReady-to-share link, e.g. https://hi4.in/u/diwali-sale. hi4.in/diwali-sale opens the same link.
long_urlstringWhere the link sends visitors.
titlestringYour label.
expires_atstring or nullWhen the link stops working.
created_atstringWhen the link was made.
total_clicks, last_clickinteger, stringAdded in GET /links results.
analyticsobjectAdded in GET /links/{id}: summary, geographic and devices.

GET /links returns every stored field of each link, plus total_clicks, last_click and short_url. List responses also include pagination: page, limit, total and pages.

Errors and limits

When something goes wrong

Errors use normal HTTP status codes and a JSON body with a single error message.

{
    "error": "message"
}

Each account has an hourly request limit, and calls made with your key count towards it. GET /stats shows your limit and how many calls are left.

HTTPMeaningExample body
400 Bad request
The body is not valid JSON, long_url is missing, or a URL or domain name is malformed.
{"error": "long_url is required"}
401 Unauthorised
The X-API-Key header is missing, wrong or the key has expired.
{"error": "Invalid API key"}
403 Forbidden
domain_id belongs to someone else or does not exist.
{"error": "Invalid domain or access denied"}
404 Not found
The link ID does not exist or is not yours. Unknown paths also return 404.
{"error": "Link not found"}
409 Conflict
That custom domain is already registered.
{"error": "Domain is already taken"}
429 Too many requests
You reached your hourly request limit. Wait, then retry with back-off.
{"error": "Rate limit exceeded"}
500 Server error
Something failed on our side. Retry later; tell us if it keeps happening.
{"error": "Failed to create link"}
Bulk links

Hundreds of links without writing an app

Making links for a whole campaign, catalogue or SMS list? Use the bulk tool in your dashboard, or loop over a file with the API.

Live

Bulk tool in the dashboard

  • Paste up to 100 links, one per line, or upload a .txt file
  • Optional name prefix and expiry for the whole batch
  • Download the new short links as a CSV file
Live

Bulk with the API

Call POST /links once per row. Stay inside your hourly limit and save the slug from every response.

Shell
# links.csv has two columns: url,title (no header row)
while IFS=, read -r url title; do
  curl -s -X POST https://hi4.in/api/v1/links \
    -H "X-API-Key: $HI4_KEY" \
    -H "Content-Type: application/json" \
    -d "{\"long_url\": \"$url\", \"title\": \"$title\"}"
  echo
done < links.csv

For real projects, build the JSON with a proper library so titles with quotes or commas are handled safely.

Coming soon

Integrations we are working towards

None of these are available yet. Tell us which one you need and we will let you know when it is ready.

See the roadmap
Coming soon
Webhooks Your server is told when a link is clicked or a link-health alert fires.
Coming soon
Zapier and Make Create links from forms, sheets and CRMs without writing code.
Coming soon
Shopify and WooCommerce plugins Short, trackable links for products and campaigns from inside your store.
Coming soon
Public API v2 A larger, versioned API planned to cover more of hi4.in, such as QR codes and pages.
Coming soon
SMS Sender-ID link API Create hi4.in/SENDERID/offer links for DLT-registered SMS in bulk.

Get told when your integration is ready

One email when it launches. No newsletter unless you ask for it.

Building something for SMS? See SMS links

We reply within one working day. We never share your details.

Developer questions

Which plans include the API?

Per our plan comparison, the REST API and bulk tools are part of the Pro and Business plans. See the pricing page for everything each plan includes.

How do I authenticate?

Send your API key in the X-API-Key header with every request. There is no OAuth or login flow in the API today, so keep the key on your server.

Why did my link get a different slug from the one I asked for?

If custom_slug is shorter than 3 characters, uses anything other than letters, numbers and hyphens, is a reserved word or is already taken, the API quietly uses a random slug. Always read slug and short_url from the response.

What do short links from the API look like?

Responses return links as https://hi4.in/u/{slug}. The shorter https://hi4.in/{slug} opens the same link, so you can use either.

Are there rate limits?

Yes. Each account has an hourly request limit. GET /stats shows your limit and how many calls are left; above the limit the API answers with HTTP 429.

Is there a sandbox or test mode?

Not yet. Use GET /test to check your connection, give test links a title like "test", and delete them afterwards.

Do you have webhooks, SDKs or Zapier?

Not yet — they are on the roadmap. The API is plain JSON over HTTPS, so the HTTP client in any language works.

Do I need the API to make a few links?

No. The free tools on hi4.in make short links, WhatsApp links and QR codes in the browser without any key or code.

Stuck? Write to us from the contact page with the request you sent and the response you got (remove your key first).

Build on hi4.in

Free account, no card needed. Create your API key from the dashboard and make your first link in minutes.

hi4.in/@

Esc
↑ ↓ to moveEnter to open/ opens search