API essentials
Who can do this: integrators; every call is made for a user and allowed what that user is allowed.
Everything the Portal does goes through the public API, and an integration can make the same calls. The API reference describes every operation with examples; this page covers what they have in common.
Addresses
Section titled “Addresses”- API:
https://api.contentsurface.io, every route under/v1. - Sign-in and tokens: your tenant’s address,
https://{slug}.contentsurface.io—/oauth/authorize,/oauth/tokenand the metadata at/.well-known/oauth-authorization-server.
The tenant is taken from the access token, never from a parameter.
Tokens and scopes
Section titled “Tokens and scopes”Every call except content links sends an access token:
Authorization: Bearer {token}. Tokens always name a user — an
application is never a user of its own — and last 15 minutes.
| Scope | Reaches | Who gets it |
|---|---|---|
cs.content |
Search, browse, node details, relations, content | Every token |
cs.admin |
/v1/admin/… |
Users with an admin role, signing in through a client with admin access (the Portal) |
How to obtain tokens: OAuth and tokens.
IDs are type-prefixed strings — nod_… for nodes, usr_… users, grp_…
groups, alb_… access labels, cli_… client applications, cnx_…
connections, mnt_… mount points, agt_… agents, att_… attributes,
dty_… document types, rld_… relation definitions. A wrong prefix answers
400. root names the root folder wherever a node ID is taken. Keep IDs, not
paths: paths change when folders are renamed.
Paging
Section titled “Paging”Lists are keyset-paged: pass limit (1–200, default 50) and, for the next
page, the nextCursor of the previous one as cursor. nextCursor is null
on the last page. There are no offsets and no total counts. Search pages with
page.size and page.cursor in its body.
Versions and If-Match
Section titled “Versions and If-Match”Administrative objects carry a version, sent as the ETag header. Every
update and delete must send it back as If-Match:
- 412
version-mismatch— someone changed the object since you read it; read it again and repeat. - 428
if-match-required— the header is missing.
Relation changes (PATCH …/members, …/labels, …/clients, …/agents)
need no If-Match.
Reasons
Section titled “Reasons”Changes take a reason, kept in the audit log — in the
body, or as a query parameter on deletes. Where it is required, a missing one
answers 400.
Confirmations
Section titled “Confirmations”A change that would remove or hide access, delete content or lower plan
limits answers 409 confirmation-required the first time, with an
impact — what it would affect — and an impactToken. Show the impact to
the person, and to go ahead repeat the same call with
?confirm={impactToken}. The token is tied to the impact: if the situation
changed meanwhile, you get a new 409.
Errors
Section titled “Errors”Errors are RFC 9457 problem details (application/problem+json). Branch on
code, which is stable; title and detail are for people and may change.
validation-failed names the request field. A node or object the caller
may not see answers 404, exactly like one that does not exist. See
Error codes.
Limits
Section titled “Limits”- 429
too-many-requestsis load protection — too many calls, searches or downloads at once for the tenant. It is transient, never a quota: waitRetry-Afterseconds and retry. - 429
retrieval-allowance-exhaustedon a download means the month’s retrieval is used up; do not retry beforeresetsAt. - Search, browsing and admin calls are never limited by the plan’s quotas; results are never trimmed by them.
Swagger UI
Section titled “Swagger UI”The API serves the same reference as Swagger UI, where calls can be tried
after signing in, at your tenant address under /swagger.