Skip to content

Quickstart

Who can do this: integrators.

This walks an impersonating client — a server application searching for your users — from a token to a document. Replace acme with your tenant’s address name.

A user admin registers an impersonating client, creates a secret and relates the client to the users or groups it may act for; see Client applications. You get a Client ID and a secret.

Terminal window
curl -s https://acme.contentsurface.io/oauth/token \
-u "$CLIENT_ID:$CLIENT_SECRET" \
-d grant_type=urn:ietf:params:oauth:grant-type:token-exchange \
-d subject_token=usr_… \
-d subject_token_type=urn:contentsurface:token-type:user-id \
-d scope=cs.content

The answer holds an access_token for 15 minutes. It reads exactly what that user may read.

Terminal window
curl -s https://api.contentsurface.io/v1/search \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{ "text": "invoices March", "filters": { "type": ["File"] }, "passages": 1 }'

Each item has an id, name, path, attributes, and the matching passages.

For your own server, stream the content:

Terminal window
curl -s https://api.contentsurface.io/v1/nodes/nod_…/content \
-H "Authorization: Bearer $TOKEN" -o result.pdf

To let the user’s browser download it without a token, ask for a content link and hand it over; it works for a few minutes and is checked again on use:

Terminal window
curl -s https://api.contentsurface.io/v1/nodes/nod_…/content-link \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-d '{ "expiresInMinutes": 5 }'

In the API

The Portal does this through these calls; an integration can make them directly.

OperationCall
Token endpoint: authorization_code, refresh_token and token exchange (RFC 8693).POST /oauth/token
Filtered queries and folder browsing without text; keyword, semantic and hybrid search with it.POST /v1/search
A node's details: standard fields, type and returned attributes. `root` is the tenant's root folder.GET /v1/nodes/{id}
A short-lived link to the content endpoint, for browser downloads and handing to end users.POST /v1/nodes/{id}/content-link
The node's content, streamed from the source; with representation=text, its stored text. The single retrieval endpoint.GET /v1/nodes/{id}/content