Skip to content

Quickstart

Create a data-carrying shortlink, click it, and see your webhook fire — all in five steps.

1. Get an API Key

You need an API key to create links. If you have the master key, skip to step 2. Otherwise, create a scoped key:

curl -X POST https://usnp.me/api-keys \
  -H "X-API-Key: YOUR_MASTER_KEY" \
  -H "Content-Type: application/json" \
  -d '{"label": "my first key"}'

Save the key and webhook_secret from the response.

Create a basic shortlink that redirects to your target URL:

curl -X POST "$BASE_URL/shorten" \
  -H "X-API-Key: $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "redirect_url": "https://example.com/landing"
  }'

The response includes your short_url (e.g., https://usnp.me/abc123).

Attach custom data and register a webhook to receive it on every click:

curl -X POST "$BASE_URL/shorten" \
  -H "X-API-Key: $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "redirect_url": "https://example.com/product",
    "data": {"sku": "WIDGET-42", "campaign": "summer-2026"},
    "webhooks": ["https://your-server.com/webhook"]
  }'

Open the short_url in your browser. yousnap.me will:

  1. Redirect you to the target URL
  2. Record the hit
  3. POST your custom data to each registered webhook

Your webhook receives a JSON payload like:

{
  "event": "hit",
  "short_id": "abc123",
  "redirect_url": "https://example.com/product",
  "hit_id": "...",
  "hit_at": "2026-01-15T10:30:00Z",
  "data": {"sku": "WIDGET-42", "campaign": "summer-2026"}
}

5. Generate a QR Code

Generate a printable QR code for any shortlink:

curl -O -J "$BASE_URL/abc123/qr?format=png&scale=10"

Customize colors, format (PNG/SVG), and scale — see the API Reference.