REST API · v1

REST API — written to be read, not just used.

Stable base URL, standard auth, JSON everywhere, clear limits. No surprises.

https://api.cd4cd.com

Authentication

Every request needs an Authorization header with an API key starting with cd_live_ for production or cd_test_ for sandbox.

$ curl https://api.cd4cd.com/v1/links \
  -H "Authorization: Bearer cd_live_xxxx"

Endpoints

MethodPathDescription
POST/v1/auth/loginSign in, returns JWT.
POST/v1/auth/refreshRefresh the access token.
POST/v1/linksCreate a new short link.
GET/v1/linksList all links.
GET/v1/links/:idSingle link details.
PATCH/v1/links/:idUpdate destination or alias.
DELETE/v1/links/:idDelete a link.
GET/v1/links/:id/clicksClick history + breakdown.
POST/v1/qrCreate a QR code (15+ types).
GET/v1/bio/:usernamePublic Bio page data.
POST/v1/users/me/exportExport all your data (JSON).

Example: create a link

POST /v1/links
Authorization: Bearer cd_live_xxx
Content-Type: application/json

{
  "longUrl": "https://example.com/long/path",
  "alias":   "promo-2026",
  "tags":    ["campaign-q2"],
  "expiresAt": "2026-12-31T23:59:59Z"
}

→ 201 Created
{
  "id":        "lnk_8f3c_a91",
  "shortCode": "promo-2026",
  "shortUrl":  "https://cd4cd.com/promo-2026",
  "longUrl":   "https://example.com/long/path",
  "createdAt": "2026-05-13T05:42:00Z"
}

Rate limits

  • Free: 60 req/min · 10K/month
  • Pro: 600 req/min · 100K/month
  • Business: negotiable

Every response carries headers X-RateLimit-Limit · X-RateLimit-Remaining · X-RateLimit-Reset.

Error codes

StatusMessageReason
400Bad RequestInvalid JSON or missing field.
401UnauthorizedMissing or expired token.
403ForbiddenInsufficient scope.
404Not FoundResource not found.
422ValidationZod validation failed.
429Rate LimitedYou exceeded the limit.
500Server ErrorOur fault — contact support.

Need help? [email protected].