{"openapi":"3.1.0","info":{"title":"C1K REST API","version":"1.0.0","summary":"Organization-scoped short links, analytics, import and export, members and a change feed for c1k.me.","description":"Every path is relative to one organization: `https://c1k.me/api/v1/orgs/{org_id}`.\nA key binds to exactly one organization; a request for another organization,\nobject, cursor or bulk item answers 404 without details (API-02).\n\n**Authentication.** Send a REST key from the organization's Integrations page as\n`Authorization: Bearer c1k_rest_...`. Keys in a URL, query parameter or cookie are\nnever accepted, and browser sessions do not authenticate API calls (API-01,\nAUTH-03). Each key carries explicit scopes; an operation outside them answers 403.\n\n**Format.** Requests and responses are UTF-8 JSON. Bodies are limited to 65,536\nbytes and 16 levels of nesting (API-03). Successful responses carry `data` and\n`meta` (with `request_id`); errors carry `error` with a stable `code` (API-04).\nTimes are RFC 3339 in UTC with Z. Integers above 2^53-1 are sent as decimal strings.\n\n**Safe retries.** Creating links, bulk changes and import apply accept an\n`Idempotency-Key`; an identical retry returns the first result, or a compact form of it with the same identifiers when the full result did not fit the stored budget (API-06). Edits and\ndeletions need `If-Match` with the current version (API-07).\n\n**Rate limits** (API-08): 60 requests per minute per key, 300 per minute per\norganization and 10 mutations per minute per key. A 429 carries Retry-After.\n\n**AI assistants** use the MCP endpoint `https://c1k.me/mcp/{org_id}` with an MCP\ntoken or OAuth instead of this API; see https://c1k.me/developers/mcp.\n","contact":{"name":"C1K developers","url":"https://c1k.me/developers"},"license":{"name":"Proprietary. All rights reserved.","identifier":"LicenseRef-C1K-Proprietary"}},"servers":[{"url":"https://c1k.me/api/v1/orgs/{org_id}","variables":{"org_id":{"default":"org_REPLACEWITHYOURID0","description":"The organization ID shown on the Integrations page."}}}],"security":[{"bearerKey":[]}],"tags":[{"name":"Account","description":"The calling key, its organization, capabilities and quotas."},{"name":"Links","description":"Create, read, edit, pause, archive and delete short links, one at a time or up to 25 per request."},{"name":"Analytics","description":"Recorded requests per day and dimension, with coverage and estimate labels. Counts are served redirects, not people."},{"name":"Events","description":"A bounded change feed for keeping another system in sync."},{"name":"Import and export","description":"Chunked link import with validation receipts, and streamed exports of links and analytics."},{"name":"Members","description":"Invitation links, roles and removal of organization members."},{"name":"Integrations","description":"Service accounts and their REST and MCP keys."}],"paths":{"/me":{"get":{"tags":["Account"],"operationId":"getMe","summary":"Identity, organization, capabilities and quotas of the calling key","description":"Answers for any valid key, whatever its scopes. A good first call to check a new key.","responses":{"200":{"description":"The calling key and its organization.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Envelope"},{"properties":{"data":{"$ref":"#/components/schemas/Me"}}}]}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/links":{"get":{"tags":["Links"],"operationId":"listLinks","summary":"List links with filters and a cursor","description":"Requires links:read. Stable order by creation time and ID unless another supported sort is chosen (API-05). Pass `meta.next_cursor` back as `cursor` for the next page.","parameters":[{"name":"q","in":"query","schema":{"type":"string","maxLength":200},"description":"Search in slug, title and destination.","example":"launch"},{"name":"state","in":"query","schema":{"type":"string","enum":["active","paused","archived"]}},{"name":"tag","in":"query","schema":{"type":"string","maxLength":24},"example":"launch"},{"name":"campaign","in":"query","schema":{"type":"string","maxLength":64}},{"name":"created_from","in":"query","schema":{"type":"string"},"description":"RFC 3339 time or YYYY-MM-DD, inclusive."},{"name":"created_to","in":"query","schema":{"type":"string"},"description":"RFC 3339 time or YYYY-MM-DD, exclusive."},{"name":"sort","in":"query","schema":{"type":"string","enum":["created_at","-created_at","updated_at","-updated_at"],"default":"-created_at"}},{"$ref":"#/components/parameters/Limit"},{"$ref":"#/components/parameters/Cursor"}],"responses":{"200":{"description":"One page of links.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Envelope"},{"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Link"}},"meta":{"$ref":"#/components/schemas/PageMeta"}}}]}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Links"],"operationId":"createLink","summary":"Create one link","description":"Requires links:write. Only destination_url is required. Omitted fields take their defaults, which are a random seven-character slug, no metadata, no schedule, no password, the primary domain and no query forwarding (API-10).","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LinkCreate"},"example":{"destination_url":"https://venture.example/launch","slug":"launch26","title":"Launch page","tags":["launch"],"utm":{"source":"newsletter","medium":"email","campaign":"launch26"}}}}},"responses":{"201":{"description":"Created. Location names the new link and ETag carries its version.","headers":{"Location":{"schema":{"type":"string"}},"ETag":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Envelope"},{"properties":{"data":{"$ref":"#/components/schemas/Link"}}}]}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"415":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"},"507":{"$ref":"#/components/responses/Error"}}}},"/links/bulk":{"post":{"tags":["Links"],"operationId":"bulkLinks","summary":"Create or change up to 25 links with a result per item","description":"Each item is applied on its own and never partially (LNK-11). Requires the scope of the operation. `create` items take the fields of Create one link; `pause`, `activate` and `archive` items take `id` and `expected_version`; `tag` items also take `tags` and `mode` (add, remove or replace).","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkRequest"},"example":{"operation":"pause","items":[{"id":"lnk_4fQ2mVxT9kLpR7sA1b","expected_version":3},{"id":"lnk_9Hn3cZq8Wb2Ld5Rk7T","expected_version":1}]}}}},"responses":{"200":{"description":"Per-item results with stable indexes.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Envelope"},{"properties":{"data":{"$ref":"#/components/schemas/BulkResult"}}}]}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"415":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/links/{id}":{"parameters":[{"$ref":"#/components/parameters/LinkId"}],"get":{"tags":["Links"],"operationId":"getLink","summary":"Read one link","description":"Requires links:read. Never includes the password or its hash; `password_protected` says whether one is set.","responses":{"200":{"description":"The link. ETag carries its version for If-Match.","headers":{"ETag":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Envelope"},{"properties":{"data":{"$ref":"#/components/schemas/Link"}}}]}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}},"patch":{"tags":["Links"],"operationId":"updateLink","summary":"Edit mutable fields or the lifecycle state","description":"Requires links:write and If-Match with the current version (API-07). Omitted fields are kept, null clears a nullable field and arrays replace the whole array. The slug and short URL never change.","parameters":[{"$ref":"#/components/parameters/IfMatch"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LinkPatch"},"example":{"destination_url":"https://venture.example/launch-v2","title":"Launch page (v2)"}}}},"responses":{"200":{"description":"The updated link with its new version.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Envelope"},{"properties":{"data":{"$ref":"#/components/schemas/Link"}}}]}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"412":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"415":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"428":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"tags":["Links"],"operationId":"deleteLink","summary":"Erase the link and keep its short key reserved","description":"Requires links:delete and If-Match. The link and its analytics are erased; the slug can never be reused (LNK-05).","parameters":[{"$ref":"#/components/parameters/IfMatch"}],"responses":{"200":{"description":"The erased link's identifiers.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"412":{"$ref":"#/components/responses/Error"},"428":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/links/{id}/qr":{"parameters":[{"$ref":"#/components/parameters/LinkId"}],"get":{"tags":["Links"],"operationId":"getLinkQr","summary":"SVG QR code of the short URL","description":"Requires links:read. Error correction level M with a four-module quiet zone (LNK-10). The SVG contains only the code.","responses":{"200":{"description":"SVG image.","content":{"image/svg+xml":{"schema":{"type":"string"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/links/{id}/analytics":{"parameters":[{"$ref":"#/components/parameters/LinkId"}],"get":{"tags":["Analytics"],"operationId":"getLinkAnalytics","summary":"Daily and lifetime recorded requests of one link","description":"Requires analytics:read. Link daily figures are kept for seven UTC days; lifetime totals until the analytics are purged or the link is deleted.","parameters":[{"$ref":"#/components/parameters/From"},{"$ref":"#/components/parameters/To"}],"responses":{"200":{"description":"Link analytics with interval, retained interval, coverage and unique estimate labels (ANA-08).","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Envelope"},{"properties":{"data":{"$ref":"#/components/schemas/Analytics"}}}]}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/Error"}}}},"/analytics":{"get":{"tags":["Analytics"],"operationId":"getAnalytics","summary":"Organization daily totals and dimensions","description":"Requires analytics:read. The same figures as the Analytics page for equal filters (ANA-09). Without from and to it covers the last seven UTC days.","parameters":[{"$ref":"#/components/parameters/From"},{"$ref":"#/components/parameters/To"}],"responses":{"200":{"description":"Organization analytics.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Envelope"},{"properties":{"data":{"$ref":"#/components/schemas/Analytics"}}}]}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/Error"}}},"delete":{"tags":["Analytics"],"operationId":"purgeAnalytics","summary":"Purge all or selected-link analytics","description":"Requires analytics:delete. Cannot be undone (ANA-10). Removes counters, sketches and dimensions in bounded batches. When the answer has done false, send the same request with the returned started_at until done is true. Link IDs outside the organization answer 404.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["confirm"],"properties":{"confirm":{"type":"boolean","const":true,"description":"Must be the literal true."},"link_ids":{"type":"array","minItems":1,"maxItems":25,"items":{"type":"string","pattern":"^lnk_[0-9A-Za-z]{18}$"},"description":"Omit to purge the whole organization."},"started_at":{"type":"integer","description":"From the previous response of an unfinished purge."}}},"example":{"confirm":true,"link_ids":["lnk_4fQ2mVxT9kLpR7sA1b"]}}}},"responses":{"200":{"description":"Progress of the purge.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Envelope"},{"properties":{"data":{"type":"object","properties":{"done":{"type":"boolean"},"started_at":{"type":"integer"},"link_ids":{"type":["array","null"],"items":{"type":"string"}}}}}}]}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"415":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/Error"}}}},"/events":{"get":{"tags":["Events"],"operationId":"listEvents","summary":"Poll the change feed after a cursor","description":"Requires events:read. Events come in increasing ID order, at most 100 per page.\nThe feed keeps at most 100 events per organization and seven days. A cursor\nolder than the retained history answers 410 cursor_expired; take a fresh\nsnapshot and poll again without a cursor. Deduplicate by event ID (EVT-02).\n","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":100}},{"$ref":"#/components/parameters/Cursor"}],"responses":{"200":{"description":"One page of events and the cursor to poll with next.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Envelope"},{"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Event"}},"meta":{"type":"object","properties":{"request_id":{"type":"string"},"next_cursor":{"type":"string"},"has_more":{"type":"boolean"}}}}}]}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Error"},"410":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/imports/validate":{"post":{"tags":["Import and export"],"operationId":"validateImport","summary":"Check one import chunk without writing anything","description":"Requires links:write. At most 25 rows and 65,536 bytes (IO-02). Returns every row as ok or with its error, and a receipt valid for ten minutes that is bound to the organization, the caller and the SHA-256 of the rows. Fields other than the listed ones, including password, fail their row.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["rows"],"properties":{"rows":{"$ref":"#/components/schemas/ImportRows"}}},"example":{"rows":[{"row":1,"destination_url":"https://venture.example/spring","slug":"spring26","tags":["campaign"]},{"row":2,"destination_url":"https://venture.example/summer","title":"Summer offer"}]}}}},"responses":{"200":{"description":"Row results and the receipt.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Envelope"},{"properties":{"data":{"type":"object","properties":{"rows":{"type":"array","items":{"type":"object"}},"valid":{"type":"integer"},"invalid":{"type":"integer"},"receipt":{"type":"string"},"receipt_expires_at":{"type":"string","format":"date-time"}}}}}]}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"415":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/imports/apply":{"post":{"tags":["Import and export"],"operationId":"applyImport","summary":"Create the rows of a validated chunk","description":"Requires links:write and an Idempotency-Key. Send the validated rows unchanged with their receipt (IO-03). Each row is created in its own transaction with authorization, quota, capacity and slug checked again; existing links are never changed. A retry with the same key returns the first result. An expired or mismatched receipt answers 409; validate the chunk again.","parameters":[{"$ref":"#/components/parameters/IdempotencyKey"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["rows","receipt"],"properties":{"rows":{"$ref":"#/components/schemas/ImportRows"},"receipt":{"type":"string","description":"From the validate response of exactly these rows."}}},"example":{"rows":[{"row":1,"destination_url":"https://venture.example/spring","slug":"spring26","tags":["campaign"]}],"receipt":"eyJ2IjoxLCJvcmciOiJvcmdfLi4uIn0.SIGNATURE"}}}},"responses":{"200":{"description":"Created and failed rows by row number.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Envelope"},{"properties":{"data":{"type":"object","properties":{"rows":{"type":"array","items":{"type":"object"}},"created":{"type":"integer"},"failed":{"type":"integer"}}}}}]}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"415":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/exports/links":{"get":{"tags":["Import and export"],"operationId":"exportLinks","summary":"Stream the link configuration as CSV or versioned JSON","description":"Requires exports:read. Read in batches and streamed; no copy stays on the server and no password material is included (IO-01). CSV cells that begin with =, +, -, @, a tab or a carriage return get one leading apostrophe, removed again on import. The last CSV record is \"#end\" with the record count.","parameters":[{"$ref":"#/components/parameters/ExportFormat"}],"responses":{"200":{"description":"The export as a download named in Content-Disposition.","headers":{"Content-Disposition":{"schema":{"type":"string"}}},"content":{"text/csv":{"schema":{"type":"string"}},"application/json":{"schema":{"type":"object"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/exports/analytics":{"get":{"tags":["Import and export"],"operationId":"exportAnalytics","summary":"Stream retained analytics as CSV or versioned JSON","description":"Requires exports:read and analytics:read. Daily totals, per-link days, dimension buckets, lifetime totals, collection gaps and coverage notes, streamed (IO-01).","parameters":[{"$ref":"#/components/parameters/ExportFormat"}],"responses":{"200":{"description":"The export as a download named in Content-Disposition.","headers":{"Content-Disposition":{"schema":{"type":"string"}}},"content":{"text/csv":{"schema":{"type":"string"}},"application/json":{"schema":{"type":"object"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"},"503":{"$ref":"#/components/responses/Error"}}}},"/members":{"get":{"tags":["Members"],"operationId":"listMembers","summary":"Active members, owners first, with pending invitations in meta","description":"Requires members:manage. Invitation links are never listed again.","responses":{"200":{"description":"Members; meta.pending_invitations lists open invitations without their links.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Envelope"},{"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Member"}}}}]}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Members"],"operationId":"inviteMember","summary":"Create a single-use invitation link for a new member","description":"Requires members:manage. People join only by opening an invitation link (TEN-04); C1K sends no mail. The link is returned once and works for 72 hours. A key acts as an administrator, so it cannot invite an owner. An optional email binds the invitation to that account.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["role"],"properties":{"role":{"type":"string","enum":["viewer","editor","admin","owner"]},"email":{"type":"string","format":"email"}}},"example":{"role":"editor","email":"new.colleague@venture.example"}}}},"responses":{"201":{"description":"The invitation with its link, shown only now.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Envelope"},{"properties":{"data":{"type":"object","properties":{"invitation":{"type":"object","properties":{"id":{"type":"string"},"url":{"type":"string","format":"uri"},"role":{"type":"string"},"expires_at":{"type":"string","format":"date-time"}}}}}}}]}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"415":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/members/{user_id}":{"parameters":[{"$ref":"#/components/parameters/UserId"}],"patch":{"tags":["Members"],"operationId":"changeMemberRole","summary":"Change a member's role within the caller's authority","description":"Requires members:manage. Administrators and keys cannot change owners or assign the owner role.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["role"],"properties":{"role":{"type":"string","enum":["viewer","editor","admin","owner"]}}},"example":{"role":"admin"}}}},"responses":{"200":{"description":"The member after the change.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Envelope"},{"properties":{"data":{"$ref":"#/components/schemas/Member"}}}]}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"415":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}},"delete":{"tags":["Members"],"operationId":"removeMember","summary":"End a membership","description":"Requires members:manage. The member's sessions and delegated access end on their next request. The last owner cannot be removed (409), and keys cannot remove owners.","responses":{"200":{"description":"The membership is revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/service-accounts":{"get":{"tags":["Integrations"],"operationId":"listServiceAccounts","summary":"Service accounts of the organization","description":"Requires integrations:manage.","responses":{"200":{"description":"Service accounts.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Envelope"},{"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/ServiceAccount"}}}}]}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Integrations"],"operationId":"createServiceAccount","summary":"Create a service account","description":"Requires integrations:manage. At most two active service accounts per organization.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["name"],"properties":{"name":{"type":"string","minLength":1,"maxLength":80}}},"example":{"name":"website backend"}}}},"responses":{"201":{"description":"Created.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Envelope"},{"properties":{"data":{"$ref":"#/components/schemas/ServiceAccount"}}}]}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"415":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/service-accounts/{id}":{"parameters":[{"$ref":"#/components/parameters/ServiceAccountId"}],"delete":{"tags":["Integrations"],"operationId":"revokeServiceAccount","summary":"Revoke a service account and every key it holds","description":"Requires integrations:manage. Its keys stop working on their next request.","responses":{"200":{"description":"Revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/credentials":{"get":{"tags":["Integrations"],"operationId":"listCredentials","summary":"Keys of the organization without their secrets","description":"Requires integrations:manage.","responses":{"200":{"description":"Keys with name, audience, scopes, last use, expiry and status.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Envelope"},{"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Credential"}}}}]}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}},"post":{"tags":["Integrations"],"operationId":"createCredential","summary":"Create a key; the secret is returned once","description":"Requires integrations:manage. A key may create keys only with a subset of its own scopes; an owner can grant more on the Integrations page. At most four live keys per organization. Audience rest makes a REST key, audience mcp an MCP token.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["service_account_id","name","audience","scopes"],"properties":{"service_account_id":{"type":"string","pattern":"^sva_[0-9A-Za-z]{18}$"},"name":{"type":"string","minLength":1,"maxLength":80},"audience":{"type":"string","enum":["rest","mcp"]},"scopes":{"type":"array","minItems":1,"items":{"$ref":"#/components/schemas/Scope"}},"expires_in_days":{"type":["integer","null"],"minimum":1,"maximum":3650}}},"example":{"service_account_id":"sva_REPLACEWITHACCTID0","name":"reporting job","audience":"rest","scopes":["links:read","analytics:read"],"expires_in_days":90}}}},"responses":{"201":{"description":"Created. `data.token` is shown only in this response.","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Envelope"},{"properties":{"data":{"allOf":[{"$ref":"#/components/schemas/Credential"},{"properties":{"token":{"type":"string","pattern":"^c1k_(rest|mcp)_[A-Za-z0-9_-]{43}$"}}}]}}}]}}}},"400":{"$ref":"#/components/responses/Error"},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"409":{"$ref":"#/components/responses/Error"},"413":{"$ref":"#/components/responses/Error"},"415":{"$ref":"#/components/responses/Error"},"422":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}},"/credentials/{id}":{"parameters":[{"$ref":"#/components/parameters/CredentialId"}],"delete":{"tags":["Integrations"],"operationId":"revokeCredential","summary":"Revoke a key immediately","description":"Requires integrations:manage. The key stops working on its next request.","responses":{"200":{"description":"Revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Envelope"}}}},"401":{"$ref":"#/components/responses/Unauthenticated"},"403":{"$ref":"#/components/responses/Error"},"404":{"$ref":"#/components/responses/Error"},"429":{"$ref":"#/components/responses/RateLimited"}}}}},"components":{"securitySchemes":{"bearerKey":{"type":"http","scheme":"bearer","description":"A REST key (c1k_rest_...) from the Integrations page."}},"parameters":{"LinkId":{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^lnk_[0-9A-Za-z]{18}$"},"example":"lnk_4fQ2mVxT9kLpR7sA1b"},"UserId":{"name":"user_id","in":"path","required":true,"schema":{"type":"string","pattern":"^usr_[0-9A-Za-z]{18}$"},"example":"usr_REPLACEWITHUSERID0"},"ServiceAccountId":{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^sva_[0-9A-Za-z]{18}$"},"example":"sva_REPLACEWITHACCTID0"},"CredentialId":{"name":"id","in":"path","required":true,"schema":{"type":"string","pattern":"^crd_[0-9A-Za-z]{18}$"},"example":"crd_REPLACEWITHKEYID00"},"Limit":{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100,"default":25}},"Cursor":{"name":"cursor","in":"query","description":"Opaque next_cursor from the previous page. Bound to the organization and filters, valid for 24 hours.","schema":{"type":"string","maxLength":512}},"From":{"name":"from","in":"query","description":"ISO 8601 UTC date, inclusive. With `to` at most 30 days apart; both omitted select the last seven days.","schema":{"type":"string","format":"date"},"example":"2026-09-01"},"To":{"name":"to","in":"query","description":"ISO 8601 UTC date, exclusive.","schema":{"type":"string","format":"date"},"example":"2026-09-08"},"ExportFormat":{"name":"format","in":"query","description":"csv (the default) or json.","schema":{"type":"string","enum":["csv","json"],"default":"csv"}},"IdempotencyKey":{"name":"Idempotency-Key","in":"header","description":"16 to 128 visible ASCII characters, unique per intended change. An identical retry within 24 hours returns the original result, or a compact form of it with the same identifiers when the full result did not fit the stored budget; a changed payload answers 409 (API-06). At most 20 unexpired keys per organization.","schema":{"type":"string","minLength":16,"maxLength":128},"example":"launch26-20260911-0001"},"IfMatch":{"name":"If-Match","in":"header","required":true,"description":"The current integer version, for example \"3\", as returned in ETag. Missing answers 428, stale answers 412 (API-07).","schema":{"type":"string"},"example":"\"1\""}},"responses":{"Error":{"description":"Error envelope with a stable code.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"example":{"error":{"code":"invalid_input","message":"Some fields are not valid.","fields":[{"field":"colour","code":"unknown_field","message":"This field is not accepted here."}],"request_id":"req_8Kd2PqWz5xRt1LmN3a"}}}}},"Unauthenticated":{"description":"Missing, invalid, expired or revoked key.","headers":{"WWW-Authenticate":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"},"example":{"error":{"code":"unauthenticated","message":"A valid API key is required in the Authorization header as Bearer.","request_id":"req_8Kd2PqWz5xRt1LmN3a"}}}}},"RateLimited":{"description":"Too many requests. Wait the number of seconds in Retry-After.","headers":{"Retry-After":{"schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"schemas":{"Envelope":{"type":"object","required":["data","meta"],"properties":{"data":{},"meta":{"type":"object","required":["request_id"],"properties":{"request_id":{"type":"string"},"idempotent_replay":{"type":"boolean"}}}}},"PageMeta":{"type":"object","properties":{"request_id":{"type":"string"},"next_cursor":{"type":["string","null"]},"limit":{"type":"integer"},"sort":{"type":"string"}}},"ErrorEnvelope":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message","request_id"],"properties":{"code":{"type":"string","enum":["invalid_input","unauthenticated","forbidden","not_found","conflict","version_conflict","quota_exceeded","rate_limited","storage_unavailable","cursor_expired","malformed_json","payload_too_large","unsupported_media_type","method_not_allowed","precondition_required","misdirected_request","internal_error"]},"message":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"code":{"type":"string"},"message":{"type":"string"}}}},"request_id":{"type":"string"}}}}},"Scope":{"type":"string","enum":["links:read","links:write","links:delete","analytics:read","analytics:delete","exports:read","events:read","members:manage","integrations:manage"]},"Me":{"type":"object","properties":{"organization":{"type":"object","properties":{"id":{"type":"string"},"handle":{"type":"string"},"name":{"type":"string"},"state":{"type":"string","enum":["active","suspended","deleting"]}}},"credential":{"type":"object","properties":{"type":{"type":"string","const":"service_account"},"service_account_id":{"type":"string"},"audience":{"type":"string","const":"rest"},"scopes":{"type":"array","items":{"$ref":"#/components/schemas/Scope"}}}},"capabilities":{"type":"array","items":{"type":"string"}},"quotas":{"type":"object"}}},"Utm":{"type":"object","additionalProperties":false,"properties":{"source":{"type":"string","maxLength":128},"medium":{"type":"string","maxLength":128},"campaign":{"type":"string","maxLength":128},"term":{"type":"string","maxLength":128},"content":{"type":"string","maxLength":128}}},"LinkCreate":{"type":"object","additionalProperties":false,"required":["destination_url"],"properties":{"destination_url":{"type":"string","maxLength":2048,"description":"Absolute http or https URL."},"slug":{"type":"string","pattern":"^[A-Za-z0-9_-]{3,48}$","description":"Case-sensitive; omitted means seven random base62 characters."},"title":{"type":"string","maxLength":120},"tags":{"type":"array","maxItems":5,"items":{"type":"string","minLength":1,"maxLength":24}},"campaign":{"type":"string","maxLength":64},"utm":{"$ref":"#/components/schemas/Utm"},"starts_at":{"type":"string","format":"date-time","description":"Inclusive."},"expires_at":{"type":"string","format":"date-time","description":"Exclusive; later than starts_at."},"password":{"type":"string","minLength":12,"maxLength":64,"description":"12 to 64 UTF-8 bytes. Visitors must enter it before the redirect."},"domain_id":{"type":"string"},"forward_query_keys":{"type":"array","maxItems":10,"items":{"type":"string","maxLength":64},"description":"Query keys of the short URL request that are passed on to the destination."}}},"LinkPatch":{"type":"object","additionalProperties":false,"properties":{"destination_url":{"type":"string","maxLength":2048},"title":{"type":["string","null"],"maxLength":120},"tags":{"type":"array","maxItems":5,"items":{"type":"string"}},"campaign":{"type":["string","null"],"maxLength":64},"utm":{"oneOf":[{"$ref":"#/components/schemas/Utm"},{"type":"null"}]},"starts_at":{"type":["string","null"],"format":"date-time"},"expires_at":{"type":["string","null"],"format":"date-time"},"password":{"type":["string","null"]},"forward_query_keys":{"type":"array","items":{"type":"string"}},"state":{"type":"string","enum":["active","paused","archived"]}}},"Link":{"type":"object","properties":{"id":{"type":"string"},"org_id":{"type":"string"},"short_url":{"type":"string","format":"uri"},"slug":{"type":"string"},"domain_id":{"type":"string"},"domain":{"type":"string"},"destination_url":{"type":["string","null"]},"state":{"type":"string","enum":["active","paused","archived"]},"effective_state":{"type":"string","description":"The state visitors see now, taking the schedule into account."},"title":{"type":["string","null"]},"tags":{"type":"array","items":{"type":"string"}},"campaign":{"type":["string","null"]},"utm":{"type":"object"},"starts_at":{"type":["string","null"],"format":"date-time"},"expires_at":{"type":["string","null"],"format":"date-time"},"password_protected":{"type":"boolean"},"forward_query_keys":{"type":"array","items":{"type":"string"}},"version":{"type":"integer"},"created_by":{"type":"object","properties":{"type":{"type":"string"},"id":{"type":"string"}}},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"example":{"id":"lnk_4fQ2mVxT9kLpR7sA1b","org_id":"org_REPLACEWITHYOURID0","short_url":"https://c1k.me/launch26","slug":"launch26","domain_id":"dom_REPLACEWITHDOMID0","domain":"c1k.me","destination_url":"https://venture.example/launch?utm_source=newsletter&utm_medium=email","state":"active","effective_state":"active","title":"Launch page","tags":["launch"],"campaign":null,"utm":{"source":"newsletter","medium":"email"},"starts_at":null,"expires_at":null,"password_protected":false,"forward_query_keys":[],"version":1,"created_by":{"type":"service_account","id":"sva_REPLACEWITHACCTID0"},"created_at":"2026-09-11T08:00:00Z","updated_at":"2026-09-11T08:00:00Z"}},"BulkRequest":{"type":"object","additionalProperties":false,"required":["operation","items"],"properties":{"operation":{"type":"string","enum":["create","pause","activate","archive","tag"]},"items":{"type":"array","minItems":1,"maxItems":25,"items":{"type":"object"}}}},"BulkResult":{"type":"object","properties":{"operation":{"type":"string"},"succeeded":{"type":"integer"},"failed":{"type":"integer"},"results":{"type":"array","items":{"type":"object"}}}},"ImportRows":{"type":"array","minItems":1,"maxItems":25,"items":{"type":"object","required":["row","destination_url"],"properties":{"row":{"type":"integer","minimum":1,"maximum":1000000,"description":"Number of the row in the file; results use it."},"destination_url":{"type":"string","format":"uri"},"slug":{"type":"string","pattern":"^[A-Za-z0-9_-]{3,48}$"},"title":{"type":"string","maxLength":120},"tags":{"type":"array","maxItems":5,"items":{"type":"string","minLength":1,"maxLength":24}},"campaign":{"type":"string","maxLength":64},"starts_at":{"type":"string","format":"date-time"},"expires_at":{"type":"string","format":"date-time"}}}},"Analytics":{"type":"object","description":"See ANA-08. Missing data is null with a reason and never a manufactured zero.","properties":{"interval":{"type":"object","properties":{"from":{"type":"string"},"to":{"type":"string"}}},"retained_interval":{"type":"object"},"generated_at":{"type":"string","format":"date-time"},"collection":{"type":"string"},"coverage":{"type":"object"},"series":{"type":"array","items":{"type":"object","properties":{"date":{"type":"string","format":"date"},"state":{"type":"string","enum":["measured","not_retained","collection_disabled","unavailable"]},"total":{"type":["integer","null"]},"bot":{"type":["integer","null"]},"unclassified":{"type":["integer","null"]},"unique_estimate":{"type":["integer","null"]}}}},"totals":{"type":"object","properties":{"total":{"type":"integer"},"bot":{"type":"integer"},"unclassified":{"type":"integer"}}},"unique_method":{"type":"object"},"unique_estimate":{"type":"object","properties":{"value":{"type":["integer","null"]},"label":{"type":"string"}}},"dimensions":{"type":"object"},"lifetime":{"type":"object"},"classification":{"type":"object"}}},"Event":{"type":"object","properties":{"id":{"type":"integer"},"time":{"type":"string","format":"date-time"},"actor":{"type":"object","properties":{"type":{"type":"string"},"id":{"type":["string","null"]}}},"surface":{"type":"string","enum":["gui","api","mcp","platform","system"]},"action":{"type":"string"},"target":{"type":"object","properties":{"type":{"type":"string"},"id":{"type":"string"}}},"request_id":{"type":"string"},"changed_fields":{"type":"array","items":{"type":"string"}}}},"Member":{"type":"object","properties":{"user_id":{"type":"string"},"email":{"type":"string"},"role":{"type":"string","enum":["viewer","editor","admin","owner"]},"joined_at":{"type":"string","format":"date-time"}}},"ServiceAccount":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"state":{"type":"string","enum":["active","revoked"]},"created_at":{"type":"integer"},"revoked_at":{"type":["integer","null"]}}},"Credential":{"type":"object","properties":{"id":{"type":"string"},"service_account_id":{"type":"string"},"audience":{"type":"string","enum":["rest","mcp"]},"name":{"type":"string"},"token_hint":{"type":"string"},"scopes":{"type":"array","items":{"$ref":"#/components/schemas/Scope"}},"created_at":{"type":"integer"},"expires_at":{"type":["integer","null"]},"last_used_at":{"type":["integer","null"]},"status":{"type":"string","enum":["active","expired","revoked"]}}}}}}