{"openapi":"3.0.0","info":{"title":"ShortLi API Documentation","version":"1.0","description":"Authenticate with `Authorization: Bearer <API_KEY>`. API keys are created by signed-in Pro users at `/api`. Agents can start at `/llms.txt` or `/api/agent` for a machine-readable onboarding guide."},"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"ShortLi API key (JWT). Create one in the web console at /api; requires a Pro account. Send it as `Authorization: Bearer <API_KEY>`."}}},"security":[{"BearerAuth":[]}],"paths":{"/api/link":{"post":{"description":"Creates a short URL pointing to the target address","tags":["Links"],"security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["targetUrl"],"properties":{"targetUrl":{"description":"Required. Can not be empty.","oneOf":[{"type":"string","format":"uri","description":"URL string","example":"https://google.com"},{"type":"string","pattern":"^FileRequest$","description":"Special string literal \"FileRequest\" in case of File Request Links","example":"FileRequest"}]},"customName":{"type":"string","example":"","description":"Optional. Defaults to empty string."},"slug":{"type":"string","example":"","description":"Optional. Defaults to empty string."},"customDomain":{"type":"string","example":"go.yourbrand.com","description":"Optional. Pro-only. Must be a domain owned and verified by the authenticated user. The short link is created on this domain."},"linkType":{"type":"string","example":"FileRequest","description":"Optional. Defaults to empty string."},"expiryDate":{"type":"string","example":"","description":"Optional. Defaults to empty string."},"expiryTime":{"type":"string","example":"","description":"Optional. Defaults to empty string."},"expiryMaxRedirect":{"type":"string","example":"","description":"Optional. Defaults to empty string."},"password":{"type":"string","example":"","description":"Optional. Defaults to empty string."},"webhookUrl":{"type":"string","example":"","description":"Optional. Defaults to empty string."},"webhookEnabled":{"type":"boolean","example":true,"description":"Optional. Defaults to true. Pause deliveries without clearing the URL."},"webhookHeaders":{"type":"string","example":"","description":"Optional JSON object string of extra request headers sent with each delivery (e.g. an Authorization token). Forwarding/hop-by-hop and X-ShortLi-* headers cannot be overridden.\n"},"scheduledRedirectUrl":{"type":"string","example":"","description":"Optional. Pro-only. Destination used automatically once the scheduled switch time has passed.\n"},"scheduledRedirectDate":{"type":"string","example":"2026-12-31","description":"Optional. Pro-only. Date (YYYY-MM-DD) of the scheduled switch."},"scheduledRedirectTime":{"type":"string","example":"23:59","description":"Optional. Pro-only. Time (HH:mm) of the scheduled switch."},"clickRedirectUrl":{"type":"string","example":"","description":"Optional. Pro-only. Destination used automatically once the link has reached the click threshold.\n"},"clickRedirectAfter":{"type":"string","example":"","description":"Optional. Pro-only. Number of clicks before the destination switches."},"allowFileRequestDownloads":{"type":"boolean","example":true,"description":"Optional. Defaults to false."},"geoRules":{"type":"array","description":"Optional. Defaults to empty array if not provided.","items":{"type":"object","properties":{"countryCode":{"type":"string","example":"US"},"url":{"type":"string","example":"https://us.example.com"}}}}}}}}},"responses":{"200":{"description":"Short URL created successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"url":{"type":"string","example":"sli.ink/xYGe"}}}}}},"401":{"description":"Unauthorized – Returned when a Bearer token is provided but is invalid (revoked, expired or malformed). The JSON body carries a machine-readable `code` of API_KEY_REQUIRED or API_KEY_INVALID plus an `actionRequired` hint.\n","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"code":{"type":"string","example":"API_KEY_REQUIRED"}}}}}},"402":{"description":"Payment required – the request asks for a Pro-only feature (custom domain, conditional/geo redirect, webhook, form, …) on an account without a Pro plan. Returns `code: PRO_REQUIRED`. Per-request payment (x402) is planned.\n","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"code":{"type":"string","example":"PRO_REQUIRED"}}}}}}}},"get":{"description":"Get all links for the authenticated user","tags":["Links"],"responses":{"200":{"description":"Successfully retrieved user's links","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true},"linkDataList":{"type":"array","items":{"type":"object","properties":{"shortUrl":{"type":"string"},"targetUrl":{"type":"string"},"customName":{"type":"string"},"slug":{"type":"string"},"expiryDate":{"type":"string"},"expiryTime":{"type":"string"},"expiryMaxRedirect":{"type":"string"},"password":{"type":"string"},"webhookUrl":{"type":"string"},"geoRules":{"type":"array","items":{"type":"object","properties":{"countryCode":{"type":"string"},"url":{"type":"string"}}}}}}},"isProAccount":{"type":"boolean","example":false}}}}}},"401":{"description":"Unauthorized - missing or invalid session/token","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false}}}}}}}},"delete":{"description":"Delete a short URL owned by the authenticated user","tags":["Links"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["shortUrl"],"properties":{"shortUrl":{"type":"string","example":"sli.ink/xYGe"}}}}}},"responses":{"200":{"description":"Link deleted successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true}}}}}},"400":{"description":"Invalid shortUrl or delete operation failed","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false},"error":{"type":"string","example":"Invalid shortUrl"}}}}}},"401":{"description":"Unauthorized - missing or invalid session/token","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false}}}}}}}},"patch":{"description":"Update a short URL owned by the authenticated user","tags":["Links"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["shortUrl","update"],"properties":{"shortUrl":{"type":"string","example":"sli.ink/xYGe"},"update":{"oneOf":[{"type":"object","required":["customName"],"properties":{"customName":{"type":"string","example":"My New Link Name"}}},{"type":"object","required":["password"],"properties":{"password":{"type":"string","example":"secret123"}}},{"type":"object","required":["maxRedirectBeforeExpiry"],"properties":{"maxRedirectBeforeExpiry":{"type":"string","example":"10"}}},{"type":"object","required":["webhookUrl"],"properties":{"webhookUrl":{"type":"string","example":"https://example.com/webhook"}}},{"type":"object","required":["webhookEnabled"],"properties":{"webhookEnabled":{"type":"boolean","example":true}}},{"type":"object","required":["webhookHeaders"],"properties":{"webhookHeaders":{"type":"string","example":"{\"Authorization\":\"Bearer abc123\"}"}}},{"type":"object","required":["webhookSecret"],"properties":{"webhookSecret":{"type":"string","example":"rotate","description":"Send the literal \"rotate\" to generate a new signing secret."}}},{"type":"object","required":["scheduledRedirectUrl"],"properties":{"scheduledRedirectUrl":{"type":"string","example":"https://example.com/after-launch"}}},{"type":"object","required":["scheduledRedirectAt"],"properties":{"scheduledRedirectAt":{"type":"string","example":"2026-12-31T23:59:00Z"}}},{"type":"object","required":["clickRedirectUrl"],"properties":{"clickRedirectUrl":{"type":"string","example":"https://example.com/after-threshold"}}},{"type":"object","required":["clickRedirectThreshold"],"properties":{"clickRedirectThreshold":{"type":"string","example":"1000"}}},{"type":"object","required":["expiryDateTime"],"properties":{"expiryDateTime":{"type":"string","example":"2026-12-31T23:59:00Z"}}},{"type":"object","required":["targetUrl"],"properties":{"targetUrl":{"type":"string","example":"https://example.com"}}},{"type":"object","required":["geoRules"],"properties":{"geoRules":{"type":"array","items":{"type":"object","required":["countryCode","url"],"properties":{"countryCode":{"type":"string","example":"US"},"url":{"type":"string","example":"https://us.example.com"}}}}}}]}}}}}},"responses":{"200":{"description":"Link updated successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":true}}}}}},"400":{"description":"Invalid request body","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false}}}}}},"401":{"description":"Unauthorized - missing or invalid session/token","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false}}}}}},"402":{"description":"Payment required for Pro-only update features","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false}}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean","example":false}}}}}}}}},"/api/domain":{"get":{"description":"List the custom domains owned by the authenticated Pro user","tags":["Domains"],"responses":{"200":{"description":"Domains returned successfully"},"401":{"description":"Unauthorized"},"402":{"description":"Pro account required"}}},"post":{"description":"Add a custom domain for the authenticated Pro user","tags":["Domains"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["domain"],"properties":{"domain":{"type":"string","example":"go.yourbrand.com"}}}}}},"responses":{"200":{"description":"Domain added successfully"},"400":{"description":"Invalid request body or invalid domain"},"401":{"description":"Unauthorized"},"402":{"description":"Pro account required"}}},"patch":{"description":"Verify a custom domain (checks the TXT and CNAME records)","tags":["Domains"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["domain"],"properties":{"domain":{"type":"string","example":"go.yourbrand.com"}}}}}},"responses":{"200":{"description":"Verification result"},"400":{"description":"Invalid request body"},"401":{"description":"Unauthorized"},"402":{"description":"Pro account required"}}},"delete":{"description":"Remove a custom domain owned by the authenticated Pro user","tags":["Domains"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["domain"],"properties":{"domain":{"type":"string","example":"go.yourbrand.com"}}}}}},"responses":{"200":{"description":"Domain removed successfully"},"400":{"description":"Invalid request body"},"401":{"description":"Unauthorized"},"402":{"description":"Pro account required"}}}}},"tags":[]}