Skip to content
Toolkit

Cardsite API Reference

Canonical machine-readable spec: shared/contracts/openapi.yaml (OpenAPI 3.1). This document is the human-readable reference and operational guide.

Surface: 366 routes across user, admin, public, webhook, and observability namespaces. Current stable version is v1.


Table of contents


Base URLs

EnvironmentURL
Productionhttps://prod.cardsite.io
Local dev (Docker Compose / Vite proxy)http://localhost:8080

The production backend listens on :18810 behind the Caddy reverse proxy (PORT=18810 in .env.production); local development uses :8080 (the binary default, and what docker-compose exposes). Point the app at http://localhost:8080 for local work.

All user/admin endpoints live under /api/v1 and /admin-api/v1 respectively. Public endpoints (/l/{url}, /b/{url}, /webhook/{gateway}, /health, /ready, /metrics, /sitemap*.xml) sit at the root.

Authentication

Pass one of:

Authorization: Bearer <jwt-or-token-or-api-key>
  • JWT — obtained via POST /api/v1/auth/login. HS256, 7-day expiry. Full account access; non-revocable until expiry, which is why the lifetime is short — long-lived programmatic access belongs to scoped tokens.
  • Scoped API token (ADR-0002) — cst_-prefixed secret minted via POST /api/v1/account/tokens. Recommended for headless/agent access. Scoped deny-by-default (links:read, links:write, biolinks:write, billing:read, … — write implies read; the grantable list is returned by GET /api/v1/account/tokens), revocable immediately (DELETE /api/v1/account/tokens/{id}), optional expiry, stored only as a SHA-256 digest — the plaintext is shown once at creation. Tokens cannot reach account settings, token management, auth/2FA, checkout, teams, workspaces, history/undo, the realtime stream, or admin endpoints regardless of scopes, and billing surfaces are read-only. Tokens are pinned to the workspace they were minted in — the X-Workspace-ID header is ignored for token principals.
  • Legacy API key — full-access bearer credential, regenerated via POST /api/v1/account/api-key (the new key is returned once; only its digest is stored). Kept for backward compatibility as a single implicit full-scope token — prefer scoped tokens for anything new.
  • 2FA challenge — if 2FA is enabled, /auth/login returns requires_2fa: true instead of a token; resend with code in the body to complete the login.

Workspace context (migration 000026, ADR-0006). user_id is the owner-of-record and billing anchor; workspace_id is the access boundary. Session requests may select a workspace with the X-Workspace-ID header — it must be a workspace the caller is a member of (403 otherwise; unknown and foreign ids are indistinguishable). No header resolves to the caller's personal workspace, so pre-workspace clients behave unchanged. Roles: member reads/creates/edits, admin additionally deletes resources and manages members, owner additionally renames/deletes the workspace.

Admin endpoints (/admin-api/v1/*) additionally require the authenticated user to have type = 1.

# Login → get JWT
curl -X POST https://prod.cardsite.io/api/v1/auth/login \
  -H 'Content-Type: application/json' \
  -H 'X-Requested-With: XMLHttpRequest' \
  -d '{"email":"you@example.com","password":"…"}'

# Use the JWT
curl https://prod.cardsite.io/api/v1/links \
  -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIs…'

Versioning policy

  • The current stable version is v1 (/api/v1/, /admin-api/v1/).
  • Breaking changes (field removal, semantic changes) are published under a new prefix (/api/v2/).
  • Deprecated fields remain in responses for at least two minor releases and are annotated in openapi.yaml with x-deprecated: true.
  • Non-breaking additions (new optional fields, new endpoints) are introduced without a version bump.

Response envelope

Every JSON endpoint returns:

{
  "data":  <payload | null>,
  "meta":  { "page": 1, "per_page": 25, "total": 412 },
  "error": null
}
FieldWhen set
dataSuccessful response payload. null on error. For empty collections, the axios interceptor on the frontend normalizes null → [].
metaPresent on paginated/list responses. May also carry resource-specific keys.
errornull on success. On failure, a human-readable string. Some validation errors include additional fields (e.g. limit, current, max on plan-limit failures).

Pagination

List endpoints accept these query params:

ParamTypeDefaultNotes
pageint11-indexed
per_pageint25Max 100
searchstring—Free-text search where supported
sortstringresource-specifice.g. created_at:desc
filter[*]string—Resource-specific filters

Response meta carries {page, per_page, total}.

Error model

StatusMeaning
400Malformed request (bad JSON, missing required field)
401Missing or invalid token; 2FA challenge required
403Authenticated but not authorized (admin gate, ownership, blacklisted IP, maintenance mode)
404Resource not found or not visible to the caller
409Conflict (duplicate slug, etc.)
422Validation or plan-limit failure — body adds {limit, current, max} when applicable
429Rate-limited (Retry-After header in seconds)
500Internal error (request_id in X-Request-ID for support)
503Maintenance mode

Example plan-limit response:

HTTP/1.1 422
{
  "data": null,
  "error": "Plan limit reached: links",
  "limit": "links",
  "current": 50,
  "max": 50
}

Idempotency

POST requests may include an Idempotency-Key: <uuid> header:

curl -X POST https://prod.cardsite.io/api/v1/links \
  -H 'Authorization: Bearer …' \
  -H 'X-Requested-With: XMLHttpRequest' \
  -H 'Idempotency-Key: 5cda6f5e-1f0b-4f02-a8b7-94b41f1f7b1e' \
  -H 'Content-Type: application/json' \
  -d '{"url":"https://example.com"}'

Within 24 hours a repeated call with the same key returns the original cached response (same status, same body) and adds:

Idempotent-Replayed: true

A daily cron purges expired keys.

Rate limits

ScopeLimitHeader on lockout
Authenticated /api/v1 and /admin-api/v1, per IP60 req / 60 sRetry-After: 60
Public routes (redirects, public biolinks, webhooks, sitemaps), per IP300 req / 60 sRetry-After: 60
Auth (/auth/register, /auth/login, /auth/lost-password) per IP6 attempts / 10 minRetry-After: 600
AI generations (POST /ai/*) per user (fallback to IP)50 / hourRetry-After: 3600

All limits are runtime-tunable from /admin/settings → Security — changes take effect within 60 s without restart. See services/ratelimit_config.go.

Rate-limited responses return HTTP 429.

Security headers & CSRF

Every response includes:

X-Content-Type-Options: nosniff
X-Frame-Options: DENY
Referrer-Policy: strict-origin-when-cross-origin
X-Request-ID: <16-hex-char-id>

State-changing requests (POST/PUT/PATCH/DELETE) must include:

X-Requested-With: XMLHttpRequest

…or the request is rejected with 403 by the CSRF guard. Exemptions: webhooks (/webhook/*), OAuth callbacks (/api/v1/auth/oauth/*/callback), and the two routes whose credential is in the request itself: POST /unsubscribe (token) and POST /api/v1/emails/bounce (X-Bounce-Secret).

The frontend's axios client sets X-Requested-With automatically. CLI users (curl, httpie, scripts) must add it manually for non-idempotent verbs.

Request tracing

Every request gets a 16-hex-char ID:

  • Echoed back as X-Request-ID response header
  • Attached to every slog log line as request_id
  • Pass X-Request-ID: <your-id> to propagate from an upstream

When opening a support ticket, include X-Request-ID from the failing response.


Endpoint groups

Auth

/api/v1/auth/* — no authentication required.

MethodPathDescription
POST/registerCreate account. Body: {email, password, name?, captcha?}. Sends activation email if email_activation setting is on.
POST/loginReturns {token, user} or {requires_2fa: true} if 2FA enabled.
POST/lost-passwordSend reset email. Body: {email}.
POST/reset-passwordApply reset token. Body: {code, password}.
POST/resend-activationRe-send activation email.
POST/activate-userActivate via code from email.
GET/captchaGet CAPTCHA challenge (when enabled).
GET/oauth/providersList configured OAuth providers.
GET/oauth/{provider}/initiateStart OAuth flow → redirects to provider.
POST/oauth/{provider}/callbackComplete OAuth flow. Body: {code, state}.
POST/2fa/setup(auth required) Returns TOTP provisioning URI + recovery codes.
POST/2fa/verify(auth required) Activate 2FA. Body: {code}.
DELETE/2fa(auth required) Disable 2FA. Body: {password}.

Lockout: 6 attempts / 10 min per IP on /register, /login, /lost-password.

Two-factor recovery codes

ADR-0173. POST /api/v1/auth/2fa/verify (body {code}) turns 2FA on and returns recovery_codes: ten one-time codes, xxxx-xxxx-xxxx-xxxx, shown this once and stored only as hashes. At sign-in, POST /api/v1/auth/login takes recovery_code in place of twofa_token (after a correct password; case, spaces and dashes ignored; spent on use; a wrong or used code is 401 under the same lockout) and answers with recovery_codes_remaining. GET /api/v1/auth/2fa/recovery-codes → {twofa_enabled, remaining}; POST /api/v1/auth/2fa/recovery-codes {password} replaces the set and returns it once (409 when 2FA is off). Turning 2FA off deletes the codes. 2FA turns on only when verify confirms the code; setup alone stores a pending secret and is refused (409) while 2FA is on (ADR-0174). An OAuth sign-in to an account with 2FA on answers {twofa_required, twofa_pending_token, twofa_pending_expires, twofa_complete_at} instead of a session; POST /api/v1/auth/login/2fa {pending_token, twofa_token | recovery_code} exchanges it (5 minutes, 5 attempts, single use, same lockout). Each event is written to the account's log (login.recovery_code, login.recovery_code_rejected, twofa.enabled, twofa.recovery_codes_regenerated, twofa.disabled).

Account

/api/v1/* — authenticated.

MethodPathDescription
GET/userCurrent user profile (id, email, name, type, plan, settings, preferences, billing).
PUT/accountUpdate profile. Accepts name, email, timezone, language, billing (JSONB), is_newsletter_subscribed, anti_phishing_code, and per-profile settings.
PUT/account/passwordBody: {current_password, new_password}.
GET/account/planPlan + subscription summary (renewal date, limits, current usage).
POST/account/api-keyRegenerate legacy API key — old key invalidated; the new key is returned once.
GET/account/tokensList scoped API tokens (revoked included) + the grantable scope list.
POST/account/tokensMint a scoped token. Body: {name, scopes[], expires_at?}. Secret returned once. Session-only.
DELETE/account/tokens/{id}Revoke a token — takes effect immediately; the row is kept as an audit record.
GET/account/preferencesLoad UI/feature preferences (JSONB).
PUT/account/preferencesSave preferences.
GET/account/exportGDPR data export — returns a ZIP archive of all user data (one JSON file per category: profile, links, qr_codes, payments, activity_logs, notification_handlers, splash_pages, domains, pixels, projects, uploads).
DELETE/accountDelete account. Body must include password. Cascades across all user-owned tables.

Every addressable resource — short link, bio page, vCard, event, file link, static page, splash page, payment link — is a row in links, discriminated by type. That table backs the whole collection; the endpoints below are the short-link product only, and type is not a filter on them (ADR-0008). For a view across every type, see GET /resources/recent (ADR-0009); for one other type, see that product's own endpoints.

MethodPathDescription
GET/linksList short links (type='link' only) with pagination, search, filter by project_id, domain_id, is_enabled. meta.total counts the filtered set.
POST/linksCreate. See body schema below.
GET/links/{id}Get one.
PUT/links/{id}Update.
DELETE/links/{id}Delete.
{
  "url": "https://example.com/long-url",
  "alias": "my-link",
  "domain_id": 5,
  "project_id": 12,
  "splash_page_id": 3,
  "pixels_ids": [1, 7],
  "settings": {
    "password": "secret",
    "clicks_limit": 100,
    "expiration_url": "https://example.com/expired",
    "forward_query_parameters": true,
    "http_status_code": 301,
    "targeting_countries": ["US", "CA"],
    "cloaking_is_enabled": true,
    "app_linking_is_enabled": true,
    "app_linking_android_url": "https://play.google.com/...",
    "app_linking_ios_url": "https://apps.apple.com/..."
  },
  "display_rules": { "...": "see Display rules section" },
  "scheduled_at": "2026-06-01T00:00:00Z",
  "scheduled_end": "2026-06-30T23:59:59Z",
  "timezone": "America/Los_Angeles"
}

Plan-limit-checked: returns 422 {limit: "links", current, max} when the user has reached their quota.

A biolink is a link of type=biolink plus its ordered blocks.

MethodPathDescription
GET/biolinksList biolink pages.
POST/biolinksCreate. Body accepts everything a link does + settings for SEO, theme, branding, PWA, custom code, display_rules.
GET/biolinks/{id}Get one.
PUT/biolinks/{id}Update.
DELETE/biolinks/{id}Delete.
GET/biolinks/{id}/blocksList blocks for a biolink (returned as part of /biolinks/{id} too).
GET/biolink-blocksList all blocks (with biolink_id filter).
GET/biolink-blocks/typesPublic block type registry — returns 85 typed BlockTypeInfo entries with Fields []BlockFieldSpec.
POST/biolink-blocksCreate a block. Body: {type, biolink_id, settings, sort}.
POST/biolink-blocks/orderReorder blocks. Body: {ids: [1, 7, 3]}.
GET/biolink-blocks/{id}Get one.
PUT/biolink-blocks/{id}Update.
DELETE/biolink-blocks/{id}Delete.

Block types

85 typed block types organized as Fields []BlockFieldSpec with {Name, Kind, Label, Help, DefaultValue, Validation, Options}. The frontend renders them with a generic BlockFields (apps/web/src/components/blocks/BlockFields.tsx) based on Kind:

text, textarea, url, email, phone, color, image_upload, file_upload, bool, int, select, datetime, timezone, multi_select, rich_text, code, display_rules, notification_handlers_picker, payment_processors_picker, markers_list, times_grid.

MethodPathDescription
GET/biolinks-templatesPublic list of biolink page templates.
GET/biolinks-themesPublic list of typed BiolinkThemeSettings themes (41 fields covering background, profile, buttons, social icons, typography, animation, custom CSS).

QR codes

MethodPathDescription
GET/qr-codesList user's QR codes.
POST/qr-codesCreate a saved QR code.
GET/qr-codes/typesPublic list of 28 QR types across 8 groups (web, basic, contact, messaging, network, location, calendar, payment, app).
POST/qr-codes/generateGenerate a one-off PNG without saving.
GET/qr-codes/{id}Get one.
PUT/qr-codes/{id}Update.
DELETE/qr-codes/{id}Delete.
GET/qr-codes/{id}/generateReturns PNG (Content-Type: image/png).

Style fields

foreground, background, background_color_transparency, foreground_gradient_color, foreground_gradient_type, eyes_inner_color, eyes_outer_color, inner_eye_style, outer_eye_style, frame, frame_color, frame_text, frame_text_font, frame_text_size, qr_code_logo_size.

Projects, domains, pixels

Standard CRUD under each path:

ResourcePath
Projects/projects, /projects/{id}
Domains/domains, /domains/{id}, POST /domains/{id}/verify
Pixels/pixels, /pixels/{id}, GET /pixels/types (public list of 24 pixel providers)

Pixel types (24)

facebook, google_analytics, google_tag_manager, linkedin, pinterest, twitter, quora, tiktok, snapchat, reddit, bing, hotjar, mixpanel, segment, intercom, crisp, freshchat, clarity, adobe_analytics, matomo, plausible, fathom, simple_analytics, umami.

Domain verification

Domain rows track SSL state, redirect_type, forward_parameters, and verification. POST /domains/{id}/verify runs the DNS check and updates is_verified + last_verified_at.

Splash pages, notification handlers

ResourcePath
Splash pages/splash-pages, /splash-pages/{id}
Notification handlers/notification-handlers, /notification-handlers/{id}

Splash-page advanced fields (secondary_button_*, ads_header, ads_footer, custom_css, custom_js) live in the settings JSONB.

Notification handler types: webhook, slack, discord, telegram, msteams, googlechat, email, twilio_sms, twilio_call, whatsapp, x.

vCards, events, signatures, static, files

Each is a links-table type-discriminated resource with its own CRUD path:

ResourcePathNotes
vCards/vcards, /vcards/{id}, GET /vcards/{id}/downloadDownload returns a .vcf file
Events/events, /events/{id}Event links with ICS export
Signatures/signatures, /signatures/{id}Email signature HTML builder
Static pages/static, /static/{id}Self-hosted page builder
File links/files, /files/{id}File download links (upload via /uploads first)
Payment links/payment-links, /payment-links/{id}Short URLs redirecting to an external checkout (location_url must be http/https)

Workspaces

Session-only (closed to API tokens). These act on the workspace named in the path, not the X-Workspace-ID context; membership is checked per call, and non-membership answers 404 like an unknown id. Personal workspaces cannot be renamed, deleted, or given members.

MethodPathDescription
GET/workspacesWorkspaces the caller belongs to, with their role.
POST/workspacesCreate a shared workspace (caller becomes owner; draws on the teams plan limit).
PUT/workspaces/{id}Rename (owner only).
DELETE/workspaces/{id}Delete the workspace and everything in it (owner only).
GET/workspaces/{id}/membersMembers with name/email/role (any member).
POST/workspaces/{id}/membersAdd an existing user by email. Body: {email, role: member|admin} (admin+).
PUT/workspaces/{id}/members/{user_id}Change a member's role between member and admin (admin+; the owner row is immutable).
DELETE/workspaces/{id}/members/{user_id}Remove a member (admin+; the owner cannot be removed).
POST/workspaces/{id}/leaveLeave (non-owners).

Teams (legacy)

The user-facing teams UI was retired in favor of workspaces (ADR-0006); these endpoints remain for legacy data access and the admin resources tab.

MethodPathDescription
GET/teamsTeams the caller owns.
POST/teamsCreate team.
GET/teams/{id}Get team.
PUT/teams/{id}Update.
DELETE/teams/{id}Delete.
GET/teams/{team_id}/membersList members.
POST/teams/{team_id}/membersAdd member. Body: {email, access_keys}.
PUT/teams/{team_id}/members/{member_id}Update member's access_keys.
DELETE/teams/{team_id}/members/{member_id}Remove member.
GET/teams-memberTeams the caller is a member of.
PUT/teams-member/{id}Accept invitation.
DELETE/teams-member/{id}Leave team.

access_keys is a string array drawn from the 47-key permission matrix (AllTeamAccessKeys in the Go models). Format: {create|update|delete|read}.{resource} (e.g. create.biolinks, delete.qr_codes, read.statistics).

AI tools

All POST endpoints are rate-limited by the AI quota (50/hour/user).

Generation is synchronous: the provider call may take up to 120 s, so every /api/v1/ai/* route has a 130 s write deadline instead of the server's 15 s. A proxy in front must allow at least that (nginx proxy_read_timeout 300s does).

Chat

MethodPathDescription
GET/ai/chatsList chats.
POST/ai/chatsCreate chat. Body: {title, assistant_id?}.
GET/ai/chats/{id}Get chat with messages.
POST/ai/chats/{id}/messagesSend a message. Body: {content, model?}.
DELETE/ai/chats/{id}Delete.

Images

MethodPathDescription
GET/ai/imagesList generated images.
POST/ai/imagesBody: {prompt, model, size, quality, n}.
DELETE/ai/images/{id}Delete.

Text

MethodPathDescription
GET/ai/textsList generated texts.
POST/ai/textsBody: {template_id?, variants, max_words_per_variant, creativity_level, creativity_level_custom?, language, dynamic_inputs}. creativity_level (low/medium/high/custom) maps to temperature.
DELETE/ai/texts/{id}Delete.

Syntheses (TTS)

MethodPathDescription
GET/ai/synthesesList.
POST/ai/synthesesBody: {text, voice, model, format}.
DELETE/ai/syntheses/{id}Delete.

Transcriptions (STT)

MethodPathDescription
GET/ai/transcriptionsList.
POST/ai/transcriptionsMultipart: audio file + form fields.
DELETE/ai/transcriptions/{id}Delete.

Statistics

MethodPathDescription
GET/statisticsUser-level analytics. Query: type, range.
GET/statistics/{link_id}Per-link analytics.

type values: clicks_chart, countries, continents, cities, referrers, devices, browsers, operating_systems, languages, clicks_over_time, unique_vs_total, qr_scans.

range values: today, yesterday, week, month, year, all. Or pass from/to ISO 8601 dates.

Payments & billing

MethodPathDescription
GET/plansList active plans.
POST/checkoutInitiate payment. Body: {plan_id, gateway, billing_cycle, coupon?} → returns redirect URL or client-side payment intent.
GET/paymentsPayment history.
GET/payments/{id}Get one.
POST/subscription/cancelCancel active subscription.
GET/invoices/{id}Download invoice PDF.
GET/credit-notes/{id}Download credit note PDF.

Payment processors

User-side CRUD for per-user payment processors used by donation/product/service biolink blocks.

MethodPathDescription
GET/payment-processorsList the caller's processors.
POST/payment-processorsBody: {name, gateway, credentials} — credentials are encrypted at rest.
GET/payment-processors/{id}Get one.
PUT/payment-processors/{id}Update.
DELETE/payment-processors/{id}Delete.

Affiliates / referrals

MethodPathDescription
GET/referrals/statsVisit/sign-up/commission summary.
POST/referrals/key(Re)generate the caller's referral key.
GET/referrals/commissionsList commissions.
GET/referrals/withdrawalsList withdrawal requests.
POST/referrals/withdrawRequest a withdrawal. Body: {amount, payment_method, details}.

Uploads

MethodPathDescription
GET/uploadsList the caller's uploaded files.
POST/uploadsMultipart upload — returns {url, key, size, content_type}. Stored locally or on S3 (if S3_* configured) with optional CDN prefix.
DELETE/uploads/{id}Delete.

MIME type sniffed from the file contents (http.DetectContentType), not the filename.

Codes (gift codes)

User-side endpoints for redeeming codes created by admins:

MethodPathDescription
POST/codes/validateBody: {code} — check if a code is valid and what it does.
POST/codes/redeemBody: {code} — apply the code to the current account.

PWAs

MethodPathDescription
GET/pwasList the caller's PWAs.
POST/pwasCreate.
GET/pwas/{id}Get one.
PUT/pwas/{id}Update.
DELETE/pwas/{id}Delete.
GET/pwas/{id}/manifest.jsonPublic PWA manifest endpoint.

Logs & internal notifications

MethodPathDescription
GET/logsUser's activity logs.
GET/internal-notificationsAll notifications.
GET/internal-notifications/unreadUnread only.
POST/internal-notifications/{id}/readMark one as read.
POST/internal-notifications/read-allMark all read.
GET/historyUndo/redo history for the caller.
GET/history/session?session_id={undoable, redoable} counts for one editor session.
POST/history/undoUndo the session's single most recent event. Body: {session_id} — a per-tab id; "default"/empty are rejected.
POST/history/redoRedo the most recently undone event (same body).
GET/realtimeServer-Sent Events stream: {type, data} events on the caller's user:{id} and active workspace:{id} channels, 25s heartbeats. Session-only.

History is scoped to (user, workspace, per-tab session) and moves one event per call; block writes only record history when the editor sends X-Session-ID. Biolink block updates support optimistic concurrency: send the loaded version and a stale save answers 409 instead of overwriting (omit version for last-write-wins).

Public endpoints

No authentication required.

MethodPathDescription
GET/l/{url}Short-link redirect — applies GeoIP, cookie-based unique visitors, display rules, click tracking, click limit, password gate, expiration_url. Returns 30x to the destination (or the expiration_url when limits exhausted).
GET/b/{url}Public biolink JSON — display-rule-filtered blocks ready for React rendering.
GET/api/public/biolinks/{url}Same as /b/{url} (alias).
POST/b/{url}/submitForm submission (email/phone collector). Dispatches to the page's configured notification handlers.
GET/api/v1/blogList blog posts.
GET/api/v1/blog/categoriesList categories.
GET/api/v1/blog/{url}Get post.
GET/api/v1/pagesList CMS pages.
GET/api/v1/pages/{url}Get page.
GET/api/v1/languagesi18n catalogs (for the frontend bootstrap).
GET/api/v1/reference/targetingDisplay-rule targeting vocabulary — see Reference data.
POST/api/v1/push-subscribersSubscribe a browser to Web Push.
POST/api/v1/push-subscribers/unsubscribeUnsubscribe.
GET/api/v1/og-imagesDynamic Open Graph image generator.
POST/api/v1/og-images/webhookOG image generator webhook.
GET/sitemap.xml, /sitemap-*.xmlSEO sitemaps.
POST/api/v1/cookie-consentRecord cookie-consent acceptance.
GET/broadcast/viewEmail-open tracking pixel.
GET/broadcast/clickEmail-click tracking redirect. Redirects only to a URL signed for that broadcast and recipient (id, url, sig); anything else is 400.
GET/unsubscribe?token=Confirmation page for a person who opened the List-Unsubscribe link. Changes nothing.
POST/unsubscribe?token=RFC 8058 one-click unsubscribe. The token is the per-recipient token in the List-Unsubscribe URL (also accepted as a form or JSON token). Idempotent. Exempt from the CSRF header.
POST/api/v1/emails/bounceESP webhook for bounce notification. Header X-Bounce-Secret: $BOUNCE_WEBHOOK_SECRET; 404 while that is unset, 401 without it. Body: {email, bounce_type: hard|soft|complaint, reason}. A hard bounce or complaint suppresses every later send.
GET/api/public/resolve/{url}What a bare address is, for the app's catch-all. No side effects. See Bare addresses.
GET/{url}, /{url}/*A bare address (card.site/slug, yourdomain.com/slug): the redirect path's rules. A reserved word is 404. With X-Cardsite-Spa-Fallback: 1 (set by the web server) a page the app draws is 404 so the app is served in place.
GET/internal/tls/ask?domain=Caddy on-demand TLS: 200 only for an enabled, verified custom domain (ADR-0169). Internal; never expose.

Every public resource door (/api/public/{biolinks,vcards,events,payments,cards}/{url}, /@{url}) resolves by (host, slug): the request's Host, or the host query parameter when the app draws a custom-domain resource from its own origin (ADR-0169).

Bare addresses

card.site/{slug} and card.site/@{slug} (ADR-0170). The app's catch-all route asks:

GET /api/public/resolve/{slug}[?host=yourdomain.com]
200 {"data": {
  "slug": "alice",
  "type": "biolink",                       // a registered link type
  "render": "page",                        // "page" | "redirect"
  "page": "biolink",                       // biolink | vcard | event | payment | null
  "data_url": "/api/public/biolinks/alice",// the type's own door, or null
  "handoff_url": "/l/alice",               // the redirect path
  "card_url": "/api/public/cards/alice"
}}
404 — reserved word, unknown, disabled, lapsed or out of schedule

render: "page": draw the page in place from data_url; that fetch runs the gates and records the visit. render: "redirect": location.replace(handoff_url + search). ?host= is carried into every URL it returns. @{slug} stays the card route (/api/public/cards/{slug}). Reserved words: models.ReservedSlugs, the same list as apps/web/src/lib/reservedSlugs.ts; a slug that is a reserved word is refused at create and rename (409 "That address is reserved"). | GET | /api/v1/directory | Public biolink directory (opt-in via directory_is_enabled). Supports ?search=. | | GET | /api/v1/spotlight?q=… | Global search across biolinks + short links + users. Authenticated: its result set names accounts, so an anonymous caller could enumerate them. |

Webhooks

MethodPathDescription
POST/webhook/{gateway}Payment gateway webhook. Gateway implementations: stripe, paypal, razorpay, coinbase, mollie, paddle, paddle_billing, paystack, payu, mercadopago, midtrans, iyzico, flutterwave, klarna, lemonsqueezy, myfatoorah, plisio, plisio_whitelabel, revolut, cryptocom, yookassa.

Each request is:

  1. Signature-verified (HMAC-SHA256 or gateway-specific scheme; see "Webhook signatures" below).
  2. Deduplicated via the webhook_logs table — UNIQUE (gateway, external_id). Replays are rejected with 200.
  3. Logged to webhook_logs with (signature_valid, payload, processed_at, error).
  4. Idempotent at the payment level — a secondary check on the payments table prevents double-credit if a row was already created.

CSRF guard is exempted for /webhook/*.

Observability

Public endpoints, no auth.

MethodPathDescription
GET/healthLightweight liveness — always 200.
GET/readyDB ping. Returns {status: "ok"|"fail", checks: {db: "ok"|"fail"}}. Use for load-balancer readiness probes.
GET/metricsPrometheus text format — requests_total, errors_total, uptime_seconds, goroutines, heap_alloc_bytes.

Admin API

Internal contract — not for external/mobile clients. The /admin-api/v1/* surface is documented here for platform operators only. It is not part of the published client contract (openapi.yaml) and must not be built against by the mobile app or third-party SDK consumers. It is access-gated server-side (type = 1), but its shape may change without the versioning guarantees that apply to the client surface.

/admin-api/v1/* — requires users.type = 1. Every state-changing request is recorded in admin_logs by middleware/admin_audit.go.

Catalog

Resource groupNotes
/statisticsSite-wide stats
/users, /users/{id}, /users/{id}/plan-settings, /users/{id}/one-time-login-codeFull user admin + 70-field plan-settings override (26 limits + 25 boolean flags)
/links, /links/{id}Read-only list + delete
/plans, /plans/{id}Full CRUD
/payments, /payments/{id}/approveList, approve, delete
/codes, /codes/{id}, /codes/{id}/redeemedFull CRUD + redemption list. Supports scheduling + bulk-prefix.
/settings, /settings/{key}Catalog by 14 categories: general, captcha, security, payments, integrations, emails, notifications, ai, plans, branding, broadcasts, push, blog, advanced
/taxes, /taxes/{id}, /taxes-importTax rules + bulk CSV import
/internal-notificationsBatch create
/affiliates-withdrawals, /affiliates-withdrawals/{id}/approveWithdrawal approval
/biolinks-templates, /biolinks-themesTemplate + theme CRUD (typed BiolinkThemeSettings)
/domains, /projects, /pixels, /qr-codes, /splash-pages, /signatures, /teams, /notification-handlers, /dataRead-only + delete
/blog-posts, /blog-categories, /pages, /page-categoriesCMS CRUD
/broadcasts, /broadcasts/segment-count11-dimension segment filter (countries, continents, cities, browsers, languages, OS, browser languages, status, source, plans, newsletter, user IDs) + audience preview
/languagesi18n catalog admin
/push-notifications, /push-subscribersAuthor push notifications, list subscribers, segment filters. Nothing sends them — services/notification.go answers the push_notifications handler type with "not yet implemented", and no VAPID key exists in the server. An owner decision, recorded under ROADMAP.md → DEFERRED (ADR-0014)
/chat-assistants, /ai-templates, /ai-template-categoriesAI prompt library
/documents, /guest-payments, /images, /pwas, /chats, /syntheses, /transcriptions, /biolink-blocksRead-only + delete
/payment-processorsRead-only + delete (user side handles CRUD)
/invoices/{id}, /credit-notes/{id}Admin PDF download
/system-logs, /system-logs/{name}, /system-logs/{name}/downloadApplication log viewer over $UPLOAD_PATH/logs/, where the request logger appends api.log
/feature-flags, /feature-flags/{id}Full CRUD over the feature-flag registry
/pluginsRead-only. The modules compiled into this server, each with status (active / inactive / built_in) resolved from the services the process actually constructed, and the configuration keys it reads — key names and a set boolean, never values. Status reflects the configuration loaded at startup (ADR-0014)

GDPR

Export

curl -X GET https://prod.cardsite.io/api/v1/account/export \
  -H "Authorization: Bearer $TOKEN" \
  -o my-data.zip

Returns a ZIP archive with one JSON file per data category. Currently covers: profile.json, links.json, qr_codes.json, payments.json, activity_logs.json, notification_handlers.json, splash_pages.json, domains.json, pixels.json, projects.json, uploads.json.

Deletion

curl -X DELETE https://prod.cardsite.io/api/v1/account \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -H "X-Requested-With: XMLHttpRequest" \
  -d '{"password": "your-password"}'

password is required for re-authentication. The deletion cascades across all user-owned tables.


Background jobs

Long-running tasks are dispatched to an internal PostgreSQL job queue (job_queue table, migration 000020):

  • Workers: 3 goroutines polling with SELECT … FOR UPDATE SKIP LOCKED LIMIT 1 (multi-replica safe).
  • Retries: exponential back-off (2^attempt minutes), up to max_attempts before the row is marked dead.
  • Reaper: a separate goroutine resets running rows older than 10 minutes (covers worker crashes).
  • Registered handlers: send_email, broadcast_email, ai_image_generate.

There is no public job-status endpoint — jobs are an implementation detail of broadcast emails and async AI image generation. Failed jobs surface to admins via /admin-api/v1/system-logs.


Feature flags

# Authenticated — the flags on for the signed-in user, evaluated against
# their plan. 401 without a session; anonymous callers have no plan, so
# there is nothing to evaluate (ADR-0011).
GET /api/v1/feature-flags/evaluate
→ { "data": ["new_editor", "beta_directory"], "meta": null, "error": null }

Admins manage the registry under /admin-api/v1/feature-flags. Each flag has {key, name, description, enabled, plan_ids} — a flag is "on" for a user when enabled=true AND (plan_ids is blank OR it names the user's users.plan_id). plan_ids is a comma-separated list of numeric plan IDs; the API rejects anything else with 400, because a plan name stored there would list back as targeting and match nobody.

Frontend hook — the key comes from the registry, never a loose string, and scripts/check-entitlement-parity.mjs fails the build on both a key that is not registered and a registered key nothing reads:

import { FEATURE_FLAGS } from '../lib/featureFlags';

const isOn = useFeatureFlag(FEATURE_FLAGS.bioPageUnwiredSettings);

isOn is false while the evaluation is in flight and false if it fails, so a flag must always grant the deviation and never the default (ADR-0011).


Webhook signatures

Every gateway with secret support verifies inbound webhooks. Examples:

GatewayHeader / scheme
StripeStripe-Signature: t=…,v1=… (HMAC-SHA256 of t.payload)
PayPalpaypal-transmission-id + paypal-cert-url (PayPal verification API)
RazorpayX-Razorpay-Signature (HMAC-SHA256)
CoinbaseX-CC-Webhook-Signature (HMAC-SHA256)
Paddle (classic)p_signature field with public-key signature verification
Paddle BillingPaddle-Signature: ts=…;h1=… (HMAC-SHA256)
Plisio / Plisio Whitelabelverify_hash in body
Flutterwaveverif-hash header

If a signature fails, the row is still written to webhook_logs with signature_valid=false and an error is logged. The request returns 400.


Display rules

display_rules is a JSONB column on links and biolinks_blocks. Each dimension is two flat keys — a list and its condition — not a nested object. All keys are optional; an absent or empty list means "allow all".

{
  "countries":  ["US", "CA"],   "countries_condition":  "show",
  "continents": ["NA"],         "continents_condition": "show",
  "cities":     ["New York"],   "cities_condition":     "show",
  "browsers":   ["chrome"],     "browsers_condition":   "show",
  "operating_systems": ["ios"], "operating_systems_condition": "show",
  "device_types":      ["mobile"], "device_types_condition":  "show",
  "languages":         ["en"],  "languages_condition":  "show"
}

A condition defaults to "show". show hides the row when the visitor does not match; hide hides it when they do.

Values are matched whole-string, case-insensitively, against what the server resolved for that visitor — so "en-US" never matches (the language compared is the primary subtag, "en"), and neither does any value the server cannot produce. Get the vocabulary from GET /api/v1/reference/targeting rather than writing literals: it returns one {value, label} list per key above, and the browser, OS and device lists are derived from the parser that names visitors, so they cannot offer an unmatchable value (ADR-0017). cities has no list — it is free text compared against the resolved English city name.

Plus two schedule keys inside the same blob, RFC 3339 strings:

  • scheduled_at — row invisible before this
  • scheduled_end — row invisible after this

(links and biolinks_blocks also carry scheduled_at, scheduled_end and timezone as columns, from migration 000013. The columns and the keys are separate mechanisms; Match reads the keys.)

services/display_rules.go → DisplayRulesService.Match(rules, ctx) is called from the public biolink handler and from the redirect handler, with a VisitorContext derived from the request (GeoIPService + services/useragent.go). A link whose rules exclude the visitor answers the 404 a missing link shows (ADR-0090).

Reference data

MethodPathDescription
GET/api/v1/reference/targetingPublic. The vocabulary a display_rules object may name, keyed by the display_rules key each list populates: continents (7), countries (~250, ISO 3166-1 alpha-2), browsers, operating_systems, device_types, languages (~190, ISO 639-1). Each entry is {value, label}; value is what a rule stores and what the server matches, label is display only.

Plan limits

Every Create handler calls services/plan_limits.go → CheckLinks/Biolinks/QrCodes/Domains/Pixels/Projects/etc. Returns 422 with {limit, current, max} if the user is at quota. Admins can override per-user limits via PUT /admin-api/v1/users/{id}/plan-settings (26 numeric limit fields + 25 boolean feature-flag toggles). The body must be a JSON object — null, an array, a string or a number is refused with 400, and {} is how the overrides are cleared. Registered quota keys are validated there exactly as on the plan form, and it matters more on this path: the override wins over the plan, so a value the enforcement read cannot parse would silently beat a correct number on the plan.


Block types schema

Every biolink block is described by a BlockTypeInfo:

type BlockTypeInfo struct {
    Type   string           // e.g. "link", "heading", "donation"
    Name   string           // human label
    Icon   string           // Lucide icon name
    Group  string           // category in the Bio page editor's block palette
    Fields []BlockFieldSpec
}

type BlockFieldSpec struct {
    Name         string
    Kind         string  // see Kind table below
    Label        string
    Help         string
    DefaultValue any
    Validation   string  // optional regex / rule
    Options      []FieldOption  // for select / multi_select
}
KindFrontend renderer
text, textarea, url, email, phoneInput / Textarea
colorColorPicker
image_upload, file_uploadFileUploader
boolSwitch
intInput type="number"
select, multi_selectSelect / MultiSelect
datetimeDateTimePicker
timezoneTimezonePicker
rich_textRichTextEditor
codeCodeEditor
display_rulesDisplayRulesEditor
notification_handlers_pickerNotificationHandlersPicker
payment_processors_pickerPaymentProcessorsPicker
markers_listMarkersList
times_gridTimesGrid

GET /api/v1/biolink-blocks/types returns the full registry — 85 typed block types covering links, social, media, forms, e-commerce, calendar, custom code, and integrations.


See also

Source: docs/API.md

Library