API Documentation

Integrate URL shortening into your apps using the DrTrim.io REST API. Generate an API key from your dashboard.

Base URL:https://api.drtrim.io/v1

Authentication

All API requests must include your API key as a Bearer token in the Authorization header. API keys begin with sk_.

curl https://api.drtrim.io/v1/links/ \
  -H "Authorization: Bearer YOUR_API_KEY"
Keep your API key secret. Never expose it in client-side code or public repositories.

Rate limiting

All API endpoints are rate limited to 5 requests per second per authenticated user. Every response includes the following headers so you can track your current usage.

HeaderTypeDescription
X-RateLimit-LimitintegerMaximum requests allowed per second
X-RateLimit-RemainingintegerRequests remaining in the current window
X-RateLimit-ResetUnix timestampTime at which the current window resets

When the limit is exceeded the API returns 429 Too Many Requests. Back off and retry after the time indicated in X-RateLimit-Reset.

429 response

Response429 Too Many Requests
{
  "status": false,
  "message": "Request was throttled. Expected available in 1 second.",
  "data": null,
  "meta": null,
  "links": null
}

Link analytics

GET/links/{'{id}'}/visits

Returns paginated visit records for a specific link, including IP address, country, and city for each click.

Query parameters

ParameterTypeDefaultDescription
pageinteger1Page number
limitinteger50Results per page (max 100)
curl "https://api.drtrim.io/v1/links/{id}/visits?page=1&limit=50" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response

Response200 OK
{
  "status": true,
  "message": "Successful Response",
  "data": [
    {
      "id": 1,
      "ip": "192.168.1.1",
      "country": "United States",
      "city": "New York",
      "created_at": "2026-05-05T10:00:00Z"
    }
  ],
  "meta": {
    "current_page": 1,
    "from": 1,
    "last_page": 29,
    "path": "https://api.drtrim.io/v1/links/42/visits",
    "per_page": 50,
    "to": 50,
    "total": 1420
  }
}