Shorten a URL with custom options

Goal: create a short link with a custom path, a specific domain, tags, and an expiration date.
Prerequisites: an API key (see Authentication); the id of the domain to attach the link to, from List your domains.

Steps

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/spring-sale-2026",
    "domain": "06a447a7-5734-48b0-9dab-021576f0e0d1",
    "path": "spring-sale",
    "title": "Spring Sale 2026",
    "tags": ["campaign", "email"],
    "expiredAt": "2026-09-01T00:00:00Z"
  }'

Only longUrl is required — omit path to have one generated automatically, and omit domain to use your account’s default domain.

Expected response:

{
  "data": {
    "id": "06a447a7-5734-48b0-9dab-021576f0e0d1",
    "path": "spring-sale",
    "shortUrl": "https://short.link/spring-sale",
    "longUrl": "https://example.com/promo/spring-sale-2026",
    "title": "Spring Sale 2026",
    "domain": "06a447a7-5734-48b0-9dab-021576f0e0d1",
    "tags": ["campaign", "email"],
    "totalNumberOfClick": 0,
    "createdAt": "2026-07-24T10:15:30.123Z",
    "updatedAt": null,
    "expiredAt": "2026-09-01T00:00:00Z"
  },
  "error_code": null,
  "message": "Request successful"
}

Verify

Fetch the link back by its id (see Quickstart) and confirm shortUrl, longUrl, and expiredAt match what you sent.

Common failures

Symptom Cause Fix
401 Unauthorized Missing or invalid API key Confirm you’re sending X-API-Key: <API_KEY>.
422 validation error longUrl missing, or path already taken on that domain Supply a valid longUrl; choose a different path or omit it.