SnipURL API Documentation
RESTful API for creating and managing short URLs and paste links
Base URL
https://snipurl.live/api/v1
Short Links API
POST Create Short Link
Create a new short URL
Endpoint:
POST https://snipurl.live/api/v1/links
Request Body:
{
"original_url": "https://example.com", // Required
"custom_code": "my-link", // Optional
"domain": "https://snipurl.co", // Optional
"expiry_date": "2024-12-31T23:59:59Z", // Optional
"password": "secret123", // Optional
"description": "My awesome link" // Optional
}
Response:
{
"success": true,
"message": "Short link created successfully",
"data": {
"id": 1,
"original_url": "https://example.com",
"short_url": "https://snipurl.co/abc123",
"short_code": "abc123",
"clicks": 0,
"expiry_date": null,
"has_password": false,
"description": null,
"created_at": "2024-01-01T00:00:00.000000Z",
"qr_code_url": "https://snipurl.co/qr/abc123"
}
}
GET Get Link Details
Retrieve details and analytics for a short link
Endpoint:
GET https://snipurl.live/api/v1/links/{shortCode}
Response:
{
"success": true,
"data": {
"id": 1,
"original_url": "https://example.com",
"short_code": "abc123",
"short_url": "https://snipurl.co/abc123",
"clicks": 42,
"description": "My awesome link",
"expiry_date": null,
"has_password": false,
"is_active": true,
"created_at": "2024-01-01T00:00:00.000000Z",
"analytics": {
"total_clicks": 42,
"unique_clicks": 28,
"clicks_today": 5,
"clicks_this_week": 15,
"clicks_this_month": 42
}
}
}
GET List User Links Auth Required
Get all links created by the authenticated user
Endpoint:
GET https://snipurl.live/api/v1/links?per_page=15
PUT Update Link Auth Required
Endpoint:
PUT https://snipurl.live/api/v1/links/{shortCode}
DELETE Delete Link Auth Required
Endpoint:
DELETE https://snipurl.live/api/v1/links/{shortCode}
Paste Links API
POST Create Paste
Create a new paste link
Endpoint:
POST https://snipurl.live/api/v1/pastes
Request Body:
{
"title": "My Code Snippet", // Optional
"content": "console.log('Hello World');", // Required
"language": "javascript", // Optional, default: "text"
"expiry_hours": 24, // Optional, hours until expiry
"password": "secret123", // Optional
"is_private": false // Optional, default: false
}
Response:
{
"success": true,
"message": "Paste created successfully",
"data": {
"id": 1,
"paste_code": "abc12345",
"paste_url": "https://snipurl.co/paste/abc12345",
"title": "My Code Snippet",
"language": "javascript",
"content_length": 28,
"views": 0,
"expiry_date": "2024-01-02T00:00:00.000000Z",
"has_password": false,
"is_private": false,
"created_at": "2024-01-01T00:00:00.000000Z"
}
}
GET Get Paste
Endpoint:
GET https://snipurl.live/api/v1/pastes/{pasteCode}
GET Get Raw Paste Content
Endpoint:
GET https://snipurl.live/api/v1/pastes/{pasteCode}/raw
POST Verify Paste Password
Endpoint:
POST https://snipurl.live/api/v1/pastes/{pasteCode}/verify-password
Request Body:
{
"password": "secret123"
}
HTTP Response Codes
Code | Status | Description |
---|---|---|
200 | OK | Request successful |
201 | Created | Resource created successfully |
401 | Unauthorized | Authentication required |
403 | Forbidden | Access denied |
404 | Not Found | Resource not found |
422 | Unprocessable Entity | Validation failed |
500 | Internal Server Error | Server error occurred |
Usage Examples
cURL Examples
Create a short link:
curl -X POST https://snipurl.live/api/v1/links \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"original_url": "https://example.com",
"custom_code": "my-link"
}'
Create a paste:
curl -X POST https://snipurl.live/api/v1/pastes \
-H "Content-Type: application/json" \
-d '{
"title": "Hello World",
"content": "console.log('\''Hello World'\'');",
"language": "javascript"
}'
Get link analytics:
curl -X GET https://snipurl.live/api/v1/links/abc123 \
-H "Authorization: Bearer YOUR_API_TOKEN"