Free to try REST API · v1

URL shortener API

Create, bulk-create, edit and track short links from your own app, online store, CRM or scripts, using the same engine as the free URL shortener. Links with your name, auto link previews, expiry and click stats: everything the dashboard does, over simple JSON.

Last updated · API v1

Quick start

  1. Sign up free. Every account can use the API: 100 links a month to try it, and 10,000 a month on mylinq Pro.
  2. Create a key in Dashboard → Short links → API. Copy it: it's shown once.
  3. Make a request with the key in the Authorization header:
curl -X POST "https://mylinq.cc/api/v1/links" \
  -H "Authorization: Bearer $MYLINQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://shop.example.com/sale/diwali-offer?utm_source=instagram",
    "style": "personal",
    "slug": "diwali",
    "preview": "auto",
    "expires_at": "2026-11-02T18:29:00Z"
  }'

Authentication

Send your key as a Bearer token on every request. Keys look like mlq_live_ followed by 32 characters.

Authorization: Bearer mlq_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Treat keys like passwords: call the API from your server, never from a website or mobile app that others can inspect. Make one key per app so you can revoke them separately. We store only a hash of each key.

Limits

FreePro
Requests10 per minute per key60 per minute per key
Links created100 per month10,000 per month
Bulk size10 links per request100 links per request
Keys1 active key5 active keys

Links created count per account per calendar month (UTC). When Pro ends, the account goes back to the Free limits; keys keep working.

Every response carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset (Unix seconds). When you're limited you get 429 with a Retry-After header.

Safe retries. Add an Idempotency-Key header (any unique string, like your order id) to create requests. If you send the same request again within 24 hours, you get the original response back instead of a duplicate link.

Errors

Errors use normal HTTP status codes and always have the same shape:

{
  "error": {
    "code": "slug_taken",
    "message": "That ending is already taken. Try another.",
    "param": "slug"
  }
}
StatuscodeMeaning
400invalid_requestA field is missing or wrong. param names the field.
400invalid_jsonThe body isn't valid JSON.
401invalid_api_keyNo key, or a key that doesn't exist.
401key_revokedThe key was revoked in the dashboard.
404not_foundNo link with that id on your account.
409slug_takenThat ending is already used.
422idempotency_mismatchAn Idempotency-Key was reused with a different body.
429rate_limitedMore than 60 requests in a minute. Wait for Retry-After seconds.
429quota_exceededThis month's 10,000 links are used up.
500internal_errorOur fault. Retry, and quote the X-Request-Id if it keeps happening.

Create a short link

POST/api/v1/links

Shortens one URL. Only url is required; everything else is optional.

FieldTypeDescription
urlstring, requiredThe long link. http or https.
style"short" | "personal""short" gives https://mylinq.cc/s/x7k2qp. "personal" puts your username in it: https://mylinq.cc/you/slug. Default "short".
slugstringYour own ending: 3–40 lowercase letters, numbers or hyphens. Random if left out (personal links need one or get a random one).
preview"auto" | objectLink preview for WhatsApp, X, LinkedIn and others. "auto" copies the page's own title, description and image. Or send { title, description, image }.
expires_atISO 8601 dateThe link stops working after this moment.
max_clicksintegerThe link stops working after this many clicks.
curl -X POST "https://mylinq.cc/api/v1/links" \
  -H "Authorization: Bearer $MYLINQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://shop.example.com/sale/diwali-offer?utm_source=instagram",
    "style": "personal",
    "slug": "diwali",
    "preview": "auto",
    "expires_at": "2026-11-02T18:29:00Z"
  }'

Response 201

{
  "id": "6ac7dd31e0f3ba3b07e96f5d",
  "short_url": "https://mylinq.cc/nila/diwali",
  "slug": "diwali",
  "style": "personal",
  "url": "https://shop.example.com/sale/diwali-offer?utm_source=instagram",
  "preview": {
    "title": "Diwali sale: 50% off everything",
    "description": "Only till Sunday. Free delivery across India.",
    "image": "https://shop.example.com/og/diwali.jpg"
  },
  "expires_at": "2026-11-02T18:29:00.000Z",
  "max_clicks": null,
  "clicks": 0,
  "disabled": false,
  "source": "api",
  "created_at": "2026-10-08T10:15:00.000Z"
}

Create links in bulk

POST/api/v1/links/bulk

Up to 100 links per request, each with the same fields as a single create. A bad item doesn't stop the others: every result has either a link or an error, in the same order you sent them.

FieldTypeDescription
linksarray, required1–100 link objects, as in Create.
curl -X POST "https://mylinq.cc/api/v1/links/bulk" \
  -H "Authorization: Bearer $MYLINQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "links": [
      {
        "url": "https://shop.example.com/p/kurta-blue"
      },
      {
        "url": "https://shop.example.com/p/saree-red",
        "preview": "auto"
      },
      {
        "url": "not a link"
      }
    ]
  }'

Response 200

{
  "created": 2,
  "failed": 1,
  "results": [
    {
      "index": 0,
      "link": {
        "id": "6ac7…5e",
        "short_url": "https://mylinq.cc/s/k7m2qp",
        "slug": "k7m2qp",
        "style": "short",
        "url": "https://shop.example.com/p/kurta-blue",
        "preview": {
          "title": "Diwali sale: 50% off everything",
          "description": "Only till Sunday. Free delivery across India.",
          "image": "https://shop.example.com/og/diwali.jpg"
        },
        "expires_at": "2026-11-02T18:29:00.000Z",
        "max_clicks": null,
        "clicks": 0,
        "disabled": false,
        "source": "api",
        "created_at": "2026-10-08T10:15:00.000Z"
      }
    },
    {
      "index": 1,
      "link": {
        "id": "6ac7…5f",
        "short_url": "https://mylinq.cc/s/x9w4ta",
        "slug": "x9w4ta",
        "style": "short",
        "url": "https://shop.example.com/p/saree-red",
        "preview": {
          "title": "Diwali sale: 50% off everything",
          "description": "Only till Sunday. Free delivery across India.",
          "image": "https://shop.example.com/og/diwali.jpg"
        },
        "expires_at": "2026-11-02T18:29:00.000Z",
        "max_clicks": null,
        "clicks": 0,
        "disabled": false,
        "source": "api",
        "created_at": "2026-10-08T10:15:00.000Z"
      }
    },
    {
      "index": 2,
      "error": {
        "code": "invalid_request",
        "message": "That doesn't look like a web link. Paste one starting with https://",
        "param": "url"
      }
    }
  ]
}

List your links

GET/api/v1/links

Newest first. Pass next_cursor as cursor to get the next page; it's null on the last page.

QueryTypeDescription
limitinteger1–100, default 20.
cursorstringnext_cursor from the previous page.
qstringOnly links whose ending or destination contains this text.
curl "https://mylinq.cc/api/v1/links?limit=20&q=diwali" \
  -H "Authorization: Bearer $MYLINQ_API_KEY"

Response 200

{
  "data": [
    {
      "id": "6ac7dd31e0f3ba3b07e96f5d",
      "short_url": "https://mylinq.cc/nila/diwali",
      "slug": "diwali",
      "style": "personal",
      "url": "https://shop.example.com/sale/diwali-offer?utm_source=instagram",
      "preview": {
        "title": "Diwali sale: 50% off everything",
        "description": "Only till Sunday. Free delivery across India.",
        "image": "https://shop.example.com/og/diwali.jpg"
      },
      "expires_at": "2026-11-02T18:29:00.000Z",
      "max_clicks": null,
      "clicks": 0,
      "disabled": false,
      "source": "api",
      "created_at": "2026-10-08T10:15:00.000Z"
    }
  ],
  "next_cursor": null
}

Get a link

GET/api/v1/links/{id}

One link by id, with its current click count.

curl "https://mylinq.cc/api/v1/links/6ac7dd31e0f3ba3b07e96f5d" \
  -H "Authorization: Bearer $MYLINQ_API_KEY"

Response 200

{
  "id": "6ac7dd31e0f3ba3b07e96f5d",
  "short_url": "https://mylinq.cc/nila/diwali",
  "slug": "diwali",
  "style": "personal",
  "url": "https://shop.example.com/sale/diwali-offer?utm_source=instagram",
  "preview": {
    "title": "Diwali sale: 50% off everything",
    "description": "Only till Sunday. Free delivery across India.",
    "image": "https://shop.example.com/og/diwali.jpg"
  },
  "expires_at": "2026-11-02T18:29:00.000Z",
  "max_clicks": null,
  "clicks": 0,
  "disabled": false,
  "source": "api",
  "created_at": "2026-10-08T10:15:00.000Z"
}

Update a link

PATCH/api/v1/links/{id}

Send only what changes. Change the destination any time: the short link and its QR code keep working. Use preview: "auto" to re-read the (new) page.

FieldTypeDescription
urlstringNew destination.
slugstringNew ending. The old one stops working.
preview"auto" | objectNew link preview.
expires_atISO date | nullNew expiry, or null for never.
max_clicksinteger | nullNew click limit, or null for none.
disabledbooleanSwitch the link off or back on.
curl -X PATCH "https://mylinq.cc/api/v1/links/6ac7dd31e0f3ba3b07e96f5d" \
  -H "Authorization: Bearer $MYLINQ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://shop.example.com/sale/diwali-final-hours",
    "preview": "auto",
    "max_clicks": null
  }'

Response 200

{
  "id": "6ac7dd31e0f3ba3b07e96f5d",
  "short_url": "https://mylinq.cc/nila/diwali",
  "slug": "diwali",
  "style": "personal",
  "url": "https://shop.example.com/sale/diwali-final-hours",
  "preview": {
    "title": "Diwali sale: 50% off everything",
    "description": "Only till Sunday. Free delivery across India.",
    "image": "https://shop.example.com/og/diwali.jpg"
  },
  "expires_at": "2026-11-02T18:29:00.000Z",
  "max_clicks": null,
  "clicks": 0,
  "disabled": false,
  "source": "api",
  "created_at": "2026-10-08T10:15:00.000Z"
}

Delete a link

DELETE/api/v1/links/{id}

Removes the link and its click history. The short URL stops working.

curl -X DELETE "https://mylinq.cc/api/v1/links/6ac7dd31e0f3ba3b07e96f5d" \
  -H "Authorization: Bearer $MYLINQ_API_KEY"

Response 200

{
  "id": "6ac7dd31e0f3ba3b07e96f5d",
  "deleted": true
}

Click stats

GET/api/v1/links/{id}/stats

Clicks per day (UTC) for the last 1–90 days, plus the top sources and countries. Bots and link-preview crawlers are never counted.

QueryTypeDescription
daysinteger1–90, default 30.
curl "https://mylinq.cc/api/v1/links/6ac7dd31e0f3ba3b07e96f5d/stats?days=7" \
  -H "Authorization: Bearer $MYLINQ_API_KEY"

Response 200

{
  "id": "6ac7dd31e0f3ba3b07e96f5d",
  "clicks_total": 1284,
  "total": 412,
  "days": [
    {
      "day": "2026-10-02",
      "clicks": 38
    },
    {
      "day": "2026-10-03",
      "clicks": 51
    },
    {
      "day": "…",
      "clicks": 0
    }
  ],
  "sources": [
    {
      "name": "instagram.com",
      "n": 230
    },
    {
      "name": "Direct",
      "n": 98
    },
    {
      "name": "web.whatsapp.com",
      "n": 61
    }
  ],
  "countries": [
    {
      "name": "IN",
      "n": 371
    },
    {
      "name": "AE",
      "n": 22
    }
  ]
}

Check your key

GET/api/v1/me

Who the key belongs to, this month's usage and your limits. Perfect for a “Test connection” button.

curl "https://mylinq.cc/api/v1/me" \
  -H "Authorization: Bearer $MYLINQ_API_KEY"

Response 200

{
  "username": "nila",
  "plan": "pro",
  "usage": {
    "links_created_this_month": 312,
    "resets_at": "2026-11-01T00:00:00.000Z"
  },
  "limits": {
    "requests_per_minute": 60,
    "links_per_month": 10000,
    "bulk_max": 100
  }
}

Try it

Paste a key from your dashboard and send a real request.

This makes a real link on your account and counts toward your monthly quota.

Questions or need higher limits? Email support@mylinq.cc.