Admin API
Automate every Kliq link and attribution workflow with the stable v1 API.
The Kliq Admin API is a public, versioned HTTP API for trusted services and agents authorized by a Kliq organization. Every request is scoped to the organization attached to its API key or OAuth token, so an organization identifier is never accepted from the client.
Base URL
https://kliq.sh/api/v1The complete machine-readable contract is available without authentication:
https://kliq.sh/api/v1/openapi.jsonAn agent-ready operational guide is also available at /api/v1/agent-skill.
The unified tool catalog is available at /api/v1/tools, and the MCP endpoint
is https://kliq.sh/api/mcp. Setup: Configure AI Agents.
Catalog: Agent Tools.
Authentication
Create a revocable organization API key in Settings → API keys, then send it as a bearer token:
Authorization: Bearer nsk_••••••••The x-api-key header is accepted for compatibility. Never put a key in a URL,
browser bundle, log, prompt, or source-control repository.
MCP clients can also use OAuth 2.1 discovery. Kliq dynamically registers the
client, asks an owner or admin to choose an organization, and issues a token
with explicit Kliq scopes. The protected-resource document lives at
/.well-known/oauth-protected-resource/api/mcp.
MCP and unified tools
Kliq exposes 26 tools across account, members, domains, links, analytics,
customers, events, and imports. MCP, GET/POST /api/v1/tools, and pnpm tools
all use the same registry and execute the existing Admin API logic. See
Configure AI Agents and Agent Tools.
First request
curl https://kliq.sh/api/v1/me \
-H "Authorization: Bearer $KLIQ_API_KEY"Use /me during setup to confirm which organization the key controls.
Resources
| Resource | Operations |
|---|---|
/me | Confirm the organization attached to the credential |
/members | List members (members:read, not on default keys) |
/members/{id} | Read one member |
/domains | List, register, read, and update short-link domains |
/links | List and create canonical parent links |
/links/{id} | Read, update, or archive any link |
/links/{id}/sublinks | List and create placement sublinks |
/analytics | Read organization totals, daily series, and top links |
/links/{id}/analytics | Read parent, sublink, and imported statistics |
/customers | List attributed customers and filter by link |
/customers/{externalId} | Read a customer and their event journey |
/events | List events or ingest a trusted server event/conversion |
/track/lead | Bind a click to a customer, by user ID or email alone |
/track/sale | Record revenue for a customer that already has a lead |
/imports | Inspect migration batches and row-level results |
/tools | List the 26-tool adapter, inspect a schema, execute |
Pagination
List endpoints accept limit from 1 to 100 and an opaque cursor. Pass the
returned cursor unchanged on the next request:
{
"data": [],
"pagination": {
"cursor": "opaque-cursor-or-null",
"isDone": false
}
}Idempotent writes
Creating a parent, creating a sublink, and ingesting an event or lead require an
idempotencyKey. Repeating the same request with the same key returns the
existing result. Reusing that key for different data returns 409.
POST /track/sale accepts invoiceId in place of an explicit key, so a
redelivered billing webhook cannot double-count revenue. Only the business
identity of the event matters — a retry that carries a later timestamp is still
the same event.
Use a stable business identifier such as campaign-launch-parent-v1, not a new
random value on every retry.
Errors
API errors have a stable shape:
{
"error": {
"code": "validation_error",
"message": "destinationUrl must be a valid HTTP or HTTPS URL"
}
}| Status | Meaning |
|---|---|
401 | Key missing, invalid, expired, or revoked |
404 | Resource absent or outside the key's organization |
409 | Slug, domain, or idempotency conflict |
413 | JSON request exceeds 64 KB |
422 | Validation failed |
429 | API-key rate limit exceeded |
500 | Unexpected server failure; retry with backoff |
503 | A required Kliq integration is unavailable |
Reliability conventions
- Timestamps are Unix milliseconds.
- Revenue uses integer minor units and a three-letter currency code.
- Analytics ranges are inclusive UTC days and cannot exceed 367 days.
- Cursors are opaque and must not be decoded or modified.
DELETE /links/{id}archives the URL; published links are never physically deleted.- A sublink inherits its parent's destination and social metadata.
- Links are active by default; an unverified domain prevents redirects until it is verified.
Agent usage
Connect MCP, install the skill, and follow the operational rules in
Configure AI Agents. Agents should fetch OpenAPI and
/api/v1/tools at startup, keep credentials in secret storage, reuse
idempotency keys on retries, follow every pagination cursor, and back off after
429 or transient 500 responses.