Quick Start
Get your first short link created in under 5 minutes.
1. Get Your API Key
First, navigate to your dashboard and create an API key:
- Go to Dashboard → Settings → API Keys
- Click Create API Key
- Give your key a name (e.g., "Development")
- Select the scopes you need (for this guide, select
links:write) - Copy your API key - you won't be able to see it again!
2. Find Your Workspace ID
Every API request requires a workspace ID. You can find yours in the dashboard URL:
https://app.sniplink.co/dashboard/ws_xxxxxxxxxxxxx/links3. Create Your First Short Link
Now let's create a short link using the API. Here are examples in different languages:
Using cURL
curl -X POST https://api.sniplink.co/v1/workspaces/{workspaceId}/links \
-H "X-API-Key: snip_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/very/long/url",
"slug": "my-link"
}'Using JavaScript/TypeScript
const response = await fetch(
'https://api.sniplink.co/v1/workspaces/{workspaceId}/links',
{
method: 'POST',
headers: {
'X-API-Key': 'snip_your_api_key_here',
'Content-Type': 'application/json',
},
body: JSON.stringify({
url: 'https://example.com/very/long/url',
slug: 'my-link',
}),
}
);
const data = await response.json();
console.log(data.link.shortUrl); // https://snip.link/my-linkUsing Python
import requests
response = requests.post(
'https://api.sniplink.co/v1/workspaces/{workspaceId}/links',
headers={
'X-API-Key': 'snip_your_api_key_here',
'Content-Type': 'application/json',
},
json={
'url': 'https://example.com/very/long/url',
'slug': 'my-link',
}
)
data = response.json()
print(data['link']['shortUrl']) # https://snip.link/my-link4. Success Response
If everything went well, you'll receive a response like this:
{
"link": {
"id": "lnk_xxxxxxxxxxxxx",
"slug": "my-link",
"url": "https://example.com/very/long/url",
"shortUrl": "https://snip.link/my-link",
"title": null,
"description": null,
"tags": [],
"expiresAt": null,
"createdAt": "2025-01-15T10:30:00.000Z"
}
}Password-Protected Links
You can protect sensitive links with a password. Users must enter the correct password before being redirected.
Creating a Password-Protected Link
curl -X POST https://api.sniplink.co/v1/workspaces/{workspaceId}/links \
-H "X-API-Key: snip_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com/private-document",
"password": "securePassword123"
}'Password Verification Flow
When a user accesses a password-protected short link, SnipLink automatically presents a password entry form. The verification process is handled server-side for security.
Removing Password Protection
To remove password protection from an existing link, set the password to null:
curl -X PATCH https://api.sniplink.co/v1/workspaces/{workspaceId}/links/{linkId} \
-H "X-API-Key: snip_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"password": null
}'Security Recommendations
- Use strong passwords: Minimum 8 characters with mixed case, numbers, and symbols.
- Share passwords securely: Never share passwords in the same channel as the link.
- Set expiration dates: Combine password protection with expiration for time-sensitive content.
- Monitor access: Check analytics to see who's accessing your protected links.
Next Steps
Now that you've created your first short link, here are some next steps:
- Learn about authentication - Understand API key scopes and security best practices
- Error handling - Learn how to handle errors gracefully
- Explore the Links API - See all available endpoints
- Track analytics - Monitor link performance