Snippr API
The Snippr API allows you to programmatically create, manage, and analyze short links.
Authentication
All API requests require authentication using an API key. You can create an API key in your dashboard.
Include your API key in the Authorization header of your requests:
Authorization: Bearer your_api_keyGET
/api/v1/links
List all your short links.
Rate Limiting: Allow up to 5 requests per 15 seconds (capacity: 100).
Response
{
"links": [
{
"id": "link_id",
"userId": "user_id",
"originalUrl": "https://example.com",
"shortUrl": "https://snppr.link/abc123",
"shortCode": "abc123",
"title": "My Short Link",
"createdAt": "2025-01-01T00:00:00.000Z",
"expiresAt": null,
"expirationUrl": null,
"clicks": 42,
"tags": [
{
"id": "tag_id_1",
"name": "marketing",
"color": "#9A71F4"
},
{
"id": "tag_id_2",
"name": "social",
"color": "#9A71F4"
}
],
"utmParams": [
{
"id": "utm_param_id",
"source": "google",
"medium": "cpc",
"campaign": "newsletter_q3",
"term": "new+merch",
"content": "logo_link",
"shortLinkId": "link_id",
"createdAt": "2025-01-01T00:00:00.000Z",
"updatedAt": "2025-01-01T00:00:00.000Z"
}
],
"customOgImageUrl": "https://imgurl.com",
"customOgTitle": "Custom preview image title",
"customOgDescription": "Custom preview image description"
}
],
"remaining": 100
}POST
/api/v1/links
Create a new short link.
Rate Limiting: Allow up to 1 request per 10 seconds (capacity: 100).
Request Body
{
"originalUrl": "https://example.com",
"shortCode": "my-link",
"expiresAt": "2025-12-31T23:59:59.999Z",
"password": "secret",
"tags": [
{
"id": "tag_id_1",
"name": "marketing",
"color": "#9A71F4"
},
{
"id": "tag_id_2",
"name": "social",
"color": "#9A71F4"
}
],
"utmSets": [
{
"source": "facebook",
"medium": "social",
"campaign": "summer_sale",
"term": "running+shoes",
"content": "logo_link"
}
]
}Response
{
"link": {
"id": "link_id",
"originalUrl": "https://example.com",
"shortUrl": "https://snppr.link/my-link",
"shortCode": "my-link",
"title": "My Short Link",
"createdAt": "2025-01-01T00:00:00.000Z",
"expiresAt": "2025-12-31T23:59:59.999Z",
"expirationUrl": "https://some-redirect-url.com",
"tags": [
{
"id": "tag_id_1",
"name": "marketing",
"color": "#9A71F4"
},
{
"id": "tag_id_2",
"name": "social",
"color": "#9A71F4"
}
],
"utmParams": [
{
"id": "utm_param_id",
"source": "facebook",
"medium": "social",
"campaign": "summer_sale",
"term": "running+shoes",
"content": "logo_link",
"shortLinkId": "link_id",
"createdAt": "2025-01-01T00:00:00.000Z",
"updatedAt": "2025-01-01T00:00:00.000Z"
}
],
"qrCodeUrl": "data:image/png;base64,..."
},
"remaining": 100
}GET
/api/v1/links/:id
Get details of a specific short link.
Rate Limiting: Allow up to 5 requests per 10 seconds (capacity: 100).
Response
{
"link": {
"id": "link_id",
"userId": "user_id",
"originalUrl": "https://example.com",
"shortUrl": "https://snppr.link/abc123",
"shortCode": "abc123",
"title": "My Short Link",
"createdAt": "2025-01-01T00:00:00.000Z",
"expiresAt": null,
"expirationUrl": null,
"clicks": 42,
"tags": [
{
"id": "tag_id_1",
"name": "marketing",
"color": "#9A71F4"
},
{
"id": "tag_id_2",
"name": "social",
"color": "#9A71F4"
}
],
"utmParams": [
{
"id": "utm_param_id",
"source": "facebook",
"medium": "social",
"campaign": "summer_sale",
"term": "running+shoes",
"content": "logo_link",
"shortLinkId": "link_id",
"createdAt": "2025-01-01T00:00:00.000Z",
"updatedAt": "2025-01-01T00:00:00.000Z"
}
],
"qrCodeUrl": "data:image/png;base64,...",
"customOgImageUrl": "https://imgurl.com",
"customOgTitle": "Custom preview image title",
"customOgDescription": "Custom preview image description"
},
"remaining": 100
}PATCH
/api/v1/links/:id
Update a short link.
Rate Limiting: Allow up to 1 request per 10 seconds (capacity: 100).
Request Body
{
"shortCode": "new-alias",
"expiresAt": "2025-12-31T23:59:59.999Z",
"password": "new-secret"
}Response
{
"link": {
"id": "link_id",
"userId": "user_id",
"originalUrl": "https://example.com",
"shortUrl": "https://snppr.link/new-alias",
"shortCode": "new-alias",
"title": "My Short Link",
"clicks": 120,
"createdAt": "2025-01-01T00:00:00.000Z",
"expiresAt": "2025-12-31T23:59:59.999Z",
"expirationUrl": "https://some-redirect-url.com",
"tags": [
{
"id": "tag_id_1",
"name": "marketing",
"color": "#9A71F4"
},
{
"id": "tag_id_2",
"name": "social",
"color": "#9A71F4"
}
],
"utmParams": [
{
"id": "utm_param_id",
"source": "facebook",
"medium": "social",
"campaign": "summer_sale",
"term": "running+shoes",
"content": "logo_link",
"shortLinkId": "link_id",
"createdAt": "2025-01-01T00:00:00.000Z",
"updatedAt": "2025-01-01T00:00:00.000Z"
}
],
"qrCodeUrl": "data:image/png;base64,...",
"customOgImageUrl": "https://imgurl.com",
"customOgTitle": "Custom preview image title",
"customOgDescription": "Custom preview image description"
},
"remaining": 100
}DELETE
/api/v1/links/:id
Delete a short link.
Rate Limiting: Allow up to 1 request per 10 seconds (capacity: 10).
Response
{
"success": true,
"remaining": 10
}Code Examples
const API_KEY = 'your_api_key';
const API_URL = 'https://snppr.vercel.app/api/v1';
// Create a short link
async function createShortLink(url, options = {}) {
const response = await fetch(`${API_URL}/links`, {
method: 'POST',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
url,
...options,
}),
});
return response.json();
}
// Example usage
createShortLink('https://example.com', {
customAlias: 'my-link',
expiresAt: new Date(Date.now() + 30 * 24 * 60 * 60 * 1000).toISOString(), // 30 days
})
.then(data => console.log(data))
.catch(error => console.error(error));