API Reference
The TNY REST API lets you create and manage short links and dynamic QR codes, read scan analytics, and list branded domains — everything the dashboard does, from your own code.
- Base URL
- https://tny.co.in/api/v1
- Auth
- API key · Bearer token
- OpenAPI spec
- /api/v1/openapi.json
- For AI agents
- /llms.txt
Authentication
Create an API key from your dashboard, then send it as a Bearer token on every request. Keys are shown once at creation and are prefixed tny_live_.
curl https://tny.co.in/api/v1/links \
-H "Authorization: Bearer tny_live_xxxxxxxxxxxxxxxxxxxxxxxx"Each key carries a set of scopes. A request fails with 403 if the key is missing the scope the endpoint requires.
Scopes
| Scope | Grants |
|---|---|
links:read | Read links and their click counts |
links:write | Create, edit, and delete links |
analytics:read | Read detailed analytics |
domains:read | Read branded domains |
Rate limits & errors
Each key is limited to 120 read and 60 write requests per minute. Exceeding the limit returns 429 with a Retry-After header (seconds).
Errors use standard HTTP statuses and return a JSON body of the shape { "error": "..." }: 400 invalid request, 401 missing/invalid key, 403 missing scope or plan, 404 not found, 429 rate limited.
Endpoints
List links
Requires the `links:read` scope.
Parameters
limitquery · integer
Responses
200A page of links401Error403Error429Error
curl -X GET https://tny.co.in/api/v1/links \
-H "Authorization: Bearer tny_live_xxxxxxxxxxxxxxxxxxxxxxxx"Create a link
Requires the `links:write` scope.
Request body
| Field | Type | Notes |
|---|---|---|
urlrequired | string <uri> | — |
isQr | boolean | — |
title | string | — |
code | string | Custom slug (Pro/Team only). |
Responses
201Created link400Error401Error403Error429Error
curl -X POST https://tny.co.in/api/v1/links \
-H "Authorization: Bearer tny_live_xxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{"url":"https://example.com/page"}'Get a link
Requires the `links:read` scope.
Parameters
idpath · string · required
Responses
200Link401Error404Error
curl -X GET https://tny.co.in/api/v1/links/:id \
-H "Authorization: Bearer tny_live_xxxxxxxxxxxxxxxxxxxxxxxx"Update a link
Requires the `links:write` scope. Provide any of destination, title, active.
Parameters
idpath · string · required
Request body
| Field | Type | Notes |
|---|---|---|
destination | string <uri> | — |
title | string | — |
active | boolean | — |
Responses
200Updated link400Error401Error404Error
curl -X PATCH https://tny.co.in/api/v1/links/:id \
-H "Authorization: Bearer tny_live_xxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{"destination":"https://example.com/page"}'Delete a link
Requires the `links:write` scope.
Parameters
idpath · string · required
Responses
204Deleted401Error404Error
curl -X DELETE https://tny.co.in/api/v1/links/:id \
-H "Authorization: Bearer tny_live_xxxxxxxxxxxxxxxxxxxxxxxx"Get link analytics
Device/geo/referrer breakdown + 14-day trend. Requires the `analytics:read` scope and a Pro or Team plan.
Parameters
idpath · string · required
Responses
200Analytics401Error403Error404Error
curl -X GET https://tny.co.in/api/v1/links/:id/analytics \
-H "Authorization: Bearer tny_live_xxxxxxxxxxxxxxxxxxxxxxxx"List branded domains
Requires the `domains:read` scope.
Responses
200Domains401Error403Error
curl -X GET https://tny.co.in/api/v1/domains \
-H "Authorization: Bearer tny_live_xxxxxxxxxxxxxxxxxxxxxxxx"Schemas
Link
| Field | Type | Notes |
|---|---|---|
id | string | — |
code | string | — |
shortUrl | string <uri> | — |
destination | string <uri> | — |
domain | string | null | — |
title | string | null | — |
isQr | boolean | — |
clicks | integer | — |
active | boolean | — |
createdAt | string <date-time> | — |
CreateLink
| Field | Type | Notes |
|---|---|---|
urlrequired | string <uri> | — |
isQr | boolean | — |
title | string | — |
code | string | Custom slug (Pro/Team only). |
UpdateLink
| Field | Type | Notes |
|---|---|---|
destination | string <uri> | — |
title | string | — |
active | boolean | — |
AnalyticsRow
| Field | Type | Notes |
|---|---|---|
label | string | — |
count | integer | — |
LinkAnalytics
| Field | Type | Notes |
|---|---|---|
total | integer | — |
last7Days | integer | — |
devices | AnalyticsRow[] | — |
countries | AnalyticsRow[] | — |
referrers | AnalyticsRow[] | — |
trend | object[] | — |
Domain
| Field | Type | Notes |
|---|---|---|
id | string | — |
host | string | — |
verified | boolean | — |
createdAt | string <date-time> | — |