Skip to main content Sink short link API operations via OpenAPI. Use when managing short links: creating, querying, updating, deleting, listing, importing, or exporting links. Also covers AI-powered slug generation and link analytics.
Triggers: "create short link", "shorten URL", "delete link", "edit link", "list links", "export links", "import links", "link analytics", "AI slug".
npx skills add miantiao-me/sink --skill sink cloudflare link-shortener url-shortener analytics nuxt nuxthub
Sink API
Sink is a link shortener running on Cloudflare. Manage links via REST API.
Authentication
All endpoints require Bearer token authentication:
Authorization: Bearer YOUR_SITE_TOKEN
Token = NUXT_SITE_TOKEN environment variable.
Base URL
https://your-sink-domain
API Reference
Create Link
POST /api/link/create
Content-Type: application/json
{
"url": "https://example.com/long-url",
"slug": "custom-slug",
"comment": "optional note",
"expiration": 1735689599,
"apple": "https://apps.apple.com/app/id123",
"google": "https://play.google.com/store/apps/details?id=com.example",
"geo": {
"US": "https://example.com/us"
},
"title": "Example Title",
"description": "Example social preview description",
"password": "optional-password",
"redirectWithQuery": true
}
Required : url
: (auto-generated if omitted), , (unix timestamp), (Apple device redirect), (Android redirect), (country-specific routing map), , , , , , ,
Optional
slug
comment
expiration
apple
google
geo
password
unsafe
title
description
image
cloaking
redirectWithQuery
If NUXT_SAFE_BROWSING_DOH is configured and unsafe is not explicitly set, the server auto-detects via DoH and marks unsafe links automatically.
{
"link": {
"id": "abc123",
"url": "https://example.com/long-url",
"slug": "custom-slug",
"createdAt": 1718119809,
"updatedAt": 1718119809
},
"shortLink": "https://your-domain/custom-slug"
}
Errors : 409 (slug exists)
Query Link GET /api/link/query?slug=custom-slug
{
"id": "abc123",
"url": "https://example.com",
"slug": "custom-slug",
"createdAt": 1718119809,
"updatedAt": 1718119809
}
Edit Link PUT /api/link/edit
Content-Type: application/json
{
"slug": "existing-slug",
"url": "https://new-url.com",
"comment": "updated note"
}
Required : slug (identifies which link to edit), url
Optional : other fields to update
Response (201): Same as create
Delete Link POST /api/link/delete
Content-Type: application/json
{
"slug": "slug-to-delete"
}
Response : 200 (empty body)
List Links GET /api/link/list?limit=20&cursor=abc123
limit: max 1024, default 20
cursor: pagination cursor from previous response
{
"keys": [],
"list_complete": false,
"cursor": "next-cursor"
}
Export Links {
"version": "1.0",
"exportedAt": "2024-01-01T00:00:00Z",
"count": 100,
"links": [],
"list_complete": true
}
Import Links POST /api/link/import
Content-Type: application/json
{
"links": [
{"url": "https://example1.com", "slug": "ex1"},
{"url": "https://example2.com", "slug": "ex2"}
]
}
Response : imported links array
AI Slug Generation GET /api/link/ai?url=https://example.com/article
The server can use the URL and extracted page content to generate a readable slug.
{
"slug": "ai-generated-slug"
}
AI OpenGraph Metadata Generation GET /api/link/og-ai?url=https://example.com/article&locale=en-US
Generates a localized OpenGraph title and description from the URL and extracted page content.
{
"title": "Example Article",
"description": "A concise social preview description."
}
Verify Token Verify if the site token is valid.
{
"name": "Sink",
"url": "https://sink.cool"
}
Errors : 401 (invalid token)
Link Fields Field Type Required Description urlstring Yes Target URL (max 2048) slugstring No Custom slug (auto-generated) commentstring No Internal note expirationnumber No Unix timestamp applestring No iOS/macOS redirect URL googlestring No Android redirect URL geoobject No Country-specific routing map, for example { "US": "https://example.com/us" } titlestring No Custom title (max 256) descriptionstring No Custom description imagestring No Custom image path cloakingboolean No Enable link cloaking redirectWithQueryboolean No Append query params to destination URL (overrides global NUXT_REDIRECT_WITH_QUERY) passwordstring No Password protection for the link unsafeboolean No Mark as unsafe (shows warning page before redirect)
Analytics Endpoints
Counters
Metrics
Views
Heatmap
Export Access Analytics GET /api/stats/export?startAt=1717200000&endAt=1719791999&slug=custom-slug
Returns text/csv with slug, url, viewer, views, and referer columns.
OpenAPI Docs
JSON: /_docs/openapi.json
Scalar UI: /_docs/scalar
Swagger UI: /_docs/swagger
cURL Examples curl -X POST https://your-domain/api/link/create \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"url": "https://github.com/example"}'
curl https://your-domain/api/link/list \
-H "Authorization: Bearer YOUR_TOKEN"
curl -X POST https://your-domain/api/link/delete \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"slug": "my-slug"}'
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Set up and use 1Password CLI (op). Use when installing the CLI, enabling desktop app integration, signing in (single or multi-account), or reading/injecting/running secrets via op.
CLI to manage emails via IMAP/SMTP. Use `himalaya` to list, read, write, reply, forward, search, and organize emails from the terminal. Supports multiple accounts and message composition with MML (MIME Meta Language).
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Set up and use 1Password CLI (op). Use when installing the CLI, enabling desktop app integration, signing in (single or multi-account), or reading/injecting/running secrets via op.
CLI to manage emails via IMAP/SMTP. Use `himalaya` to list, read, write, reply, forward, search, and organize emails from the terminal. Supports multiple accounts and message composition with MML (MIME Meta Language).