← Back to TNY

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
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

ScopeGrants
links:readRead links and their click counts
links:writeCreate, edit, and delete links
analytics:readRead detailed analytics
domains:readRead 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

post/links

Create a link

Requires the `links:write` scope.

Request body

FieldTypeNotes
urlrequiredstring <uri>—
isQrboolean—
titlestring—
codestringCustom slug (Pro/Team only).

Responses

  • 201 Created link
  • 400 Error
  • 401 Error
  • 403 Error
  • 429 Error
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/domains

List branded domains

Requires the `domains:read` scope.

Responses

  • 200 Domains
  • 401 Error
  • 403 Error
curl -X GET https://tny.co.in/api/v1/domains \
  -H "Authorization: Bearer tny_live_xxxxxxxxxxxxxxxxxxxxxxxx"

Schemas

FieldTypeNotes
idstring—
codestring—
shortUrlstring <uri>—
destinationstring <uri>—
domainstring | null—
titlestring | null—
isQrboolean—
clicksinteger—
activeboolean—
createdAtstring <date-time>—
FieldTypeNotes
urlrequiredstring <uri>—
isQrboolean—
titlestring—
codestringCustom slug (Pro/Team only).
FieldTypeNotes
destinationstring <uri>—
titlestring—
activeboolean—

AnalyticsRow

FieldTypeNotes
labelstring—
countinteger—

LinkAnalytics

FieldTypeNotes
totalinteger—
last7Daysinteger—
devicesAnalyticsRow[]—
countriesAnalyticsRow[]—
referrersAnalyticsRow[]—
trendobject[]—

Domain

FieldTypeNotes
idstring—
hoststring—
verifiedboolean—
createdAtstring <date-time>—