cURL Examples

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"}'
curl https://api-sandbox.slimlinkdev.com/api/v1/links/<LINK_ID> 
  -H "X-API-Key: <API_KEY>"
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}'
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.