API Documentation

Build powerful integrations with the URLPapa API.

API Overview

The URLPapa API allows you to programmatically create short links, manage your links, retrieve analytics, and generate QR codes. All API endpoints are RESTful and return JSON.

Base URL: https://api.urlpapa.com/v1

Authentication

All API requests require an API key. Pass it in the Authorization header as a Bearer token.

curl -X GET https://api.urlpapa.com/v1/links \
  -H "Authorization: Bearer YOUR_API_KEY"

Create a Link

Shorten a URL and get a short link back.

POST/v1/links
curl -X POST https://api.urlpapa.com/v1/links \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"destination":"https://example.com/very-long-url","slug":"my-link"}'

Example Response

{
  "id": "link_123",
  "shortUrl": "https://urlpapa.com/my-link",
  "destination": "https://example.com/very-long-url",
  "clicks": 0,
  "createdAt": "2025-01-01T00:00:00Z"
}

List Links

Retrieve a paginated list of your links.

GET/v1/links
curl -X GET https://api.urlpapa.com/v1/links?limit=25&offset=0 \
  -H "Authorization: Bearer YOUR_API_KEY"

Example Response

{
  "data": [
    {
      "id": "link_123",
      "shortUrl": "https://urlpapa.com/my-link",
      "destination": "https://example.com",
      "clicks": 42
    }
  ],
  "total": 100,
  "limit": 25,
  "offset": 0
}

Get Analytics

Retrieve click analytics for a specific link.

GET/v1/links/{id}/analytics
curl -X GET https://api.urlpapa.com/v1/links/link_123/analytics \
  -H "Authorization: Bearer YOUR_API_KEY"

Example Response

{
  "totalClicks": 1248,
  "uniqueVisitors": 987,
  "countries": [
    {"code": "US", "clicks": 450},
    {"code": "GB", "clicks": 200}
  ],
  "devices": {
    "mobile": 68,
    "desktop": 32
  }
}

Generate QR Code

Generate a QR code for any URL. Returns a PNG image.

GET/v1/qr?url=...&size=512
curl -X GET "https://api.urlpapa.com/v1/qr?url=https://urlpapa.com/my-link&size=512" \
  -H "Authorization: Bearer YOUR_API_KEY"