cURL Examples
Create a link
curl -X POST https://api-sandbox.slimlinkdev.com/api/v1/links/
-H "X-API-Key: <API_KEY>"
-H "Content-Type: application/json"
-d '{"longUrl": "https://example.com/promo"}'
Get a link by ID
curl https://api-sandbox.slimlinkdev.com/api/v1/links/<LINK_ID>
-H "X-API-Key: <API_KEY>"
List links
curl -X POST https://api-sandbox.slimlinkdev.com/api/v1/links/list
-H "X-API-Key: <API_KEY>"
-H "Content-Type: application/json"
-d '{"page": 1, "itemsPerPage": 20}'
Bulk-create links
curl -X POST https://api-sandbox.slimlinkdev.com/api/v1/links/bulk
-H "X-API-Key: <API_KEY>"
-H "Content-Type: application/json"
-d '[{"long_url": "https://example.com/product/1"}]'
Click analytics
curl -G https://api-sandbox.slimlinkdev.com/api/v1/analytics/clicks
-H "X-API-Key: <API_KEY>"
--data-urlencode "group_by=link"
List domains
curl -G https://api-sandbox.slimlinkdev.com/api/v1/domains
-H "X-API-Key: <API_KEY>"
Handling errors
Non-2xx responses return the standard error envelope:
{ "code": "VALIDATION_ERROR", "message": "Invalid request format" }
Check the HTTP status and code field rather than parsing message, since message is meant for humans and may change.