API Documentation

Welcome to the URL Shortener API. This API allows you to programmatically create short links and retrieve detailed tracking analytics for your campaigns. You can also create links on your own branded domains once they're verified in the dashboard.

Base URL: https://snip.tendstoinfinity.com

Authentication

All API requests must be authenticated using an API Key. You can pass this key in the Authorization header.

Note: Keep your API key secure. Do not share it in client-side code (browsers).

GET

/api/domains

List every custom domain attached to your account, along with its verification status. Use the id of a verified domain as the domainId when creating a short link.

Only domains where verified: true can be used for link creation. Domains that are still pending will return a 400 if passed as domainId.
POST

/api/urls

Create a new short URL. Accepts a long URL and optional parameters for customization, including an optional verified branded domain.

Body Parameters

  • originalUrl
    string, required
    The destination URL you want to shorten.
  • customCode
    string, optional
    A custom alias for your link (e.g. summer-sale). Must be unique within the chosen domain.
  • domainId
    string, optional
    The id of one of your verified custom domains (from GET /api/domains). If omitted or null, the link is created on the default shortener host.
  • title
    string, optional
    A descriptive title for dashboard organization.
  • description
    string, optional
    Free-form notes attached to the link.
409 Conflict: the chosen customCode is already taken on that domain. The same code can exist on different domains (e.g. go.brand-a.com/sale and go.brand-b.com/sale).
GET

/api/stats/{id}

Retrieve detailed analytics for a specific short link, including click counts, referrers, and geographic data.

Path Parameters

  • id
    string, required
    The internal ID of the URL (returned from POST /api/urls).
Authorization Header
Authorization: Bearer YOUR_API_KEY
Request Example
curl https://snip.tendstoinfinity.com/api/domains \
  -H 'Authorization: Bearer YOUR_API_KEY'
Response (200 OK)
[
  {
    "id": "clt_abc123",
    "hostname": "go.yourdomain.com",
    "verified": true,
    "verification_token": "verify_xyz...",
    "created_at": "2024-03-20T10:00:00Z"
  }
]
Request Example
curl -X POST https://snip.tendstoinfinity.com/api/urls \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{
    "originalUrl": "https://example.com/long-url",
    "customCode": "summer-sale",
    "domainId": "clt_abc123"
  }'
Response (200 OK)
{
  "id": "clt_url456",
  "code": "summer-sale",
  "short_url": "https://go.yourdomain.com/summer-sale",
  "original_url": "https://example.com/long-url",
  "domain_id": "clt_abc123",
  "created_at": "2024-03-20T10:00:00Z"
}
Request Example
curl https://snip.tendstoinfinity.com/api/stats/clt_url456 \
  -H 'Authorization: Bearer YOUR_API_KEY'
Response (200 OK)
{
  "code": "summer-sale",
  "totalClicks": 1250,
  "countries": [
    { "name": "United States", "value": 500 },
    { "name": "Germany", "value": 200 }
  ],
  "referrers": [
    { "name": "twitter.com", "value": 800 },
    { "name": "Direct", "value": 450 }
  ]
}