cURL Examples
Complete examples for using the yLnk API with cURL.
Authentication
Set your API key as an environment variable:
export API_KEY="your-api-key-here"
Create Short Link
curl -X POST "https://api.ylnk.cc/v2/external/client/short-links" \
-H "X-API-Key: $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"originalUrl": "https://example.com/very/long/url",
"title": "My Link",
"customUrl": "my-link"
}'
Update Short Link
curl -X PUT "https://api.ylnk.cc/v2/external/client/short-links/abc123" \
-H "X-API-Key: $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"id": "abc123",
"title": "Updated Title",
"isActive": true
}'
List Short Links
curl -X GET "https://api.ylnk.cc/v2/external/client/short-links?page=1&size=10" \
-H "X-API-Key: $API_KEY"
Get Short Link
curl -X GET "https://api.ylnk.cc/v2/external/client/short-links/abc123" \
-H "X-API-Key: $API_KEY"
Get Analytics Details
curl -X GET "https://api.ylnk.cc/v2/external/client/analytics/details?shortUrl=abc123" \
-H "X-API-Key: $API_KEY"
Get Click Traffic
curl -X GET "https://api.ylnk.cc/v2/external/client/analytics/click-traffic-platforms?shortUrl=abc123" \
-H "X-API-Key: $API_KEY"
Get Visit Logs
curl -X GET "https://api.ylnk.cc/v2/external/client/analytics/visit-logs?shortUrl=abc123&startDate=2024-01-01&endDate=2024-01-31&page=1&pageSize=10" \
-H "X-API-Key: $API_KEY"
Filter Visit Logs by UTM
curl -X GET "https://api.ylnk.cc/v2/external/client/analytics/filter-visit-logs?shortUrl=abc123&startDate=2024-01-01&endDate=2024-01-31&utmSource=google&utmMedium=cpc&utmCampaign=summer-sale" \
-H "X-API-Key: $API_KEY"
