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.
2. Create a Shortlink¶
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).
3. Create a Link with Data and Webhooks¶
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"]
}'
4. Click the Link¶
Open the short_url in your browser. yousnap.me will:
- Redirect you to the target URL
- Record the hit
- 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:
Customize colors, format (PNG/SVG), and scale — see the API Reference.