Skip to navigation

Algolia search credentials

View as Markdown

Get Algolia search credentials for querying documentation.

Authentication is optional. Without credentials, the returned key searches only public pages, which is how the search widget calls this endpoint. Pass FERN_TOKEN to search with a logged-in user’s roles, or FERN_API_KEY from a server to also search pages that require login, with roles set by the ROLES header. Don’t send FERN_API_KEY from a browser.

Authentication

FERN_API_KEYstring

Fern API key, from fern token.

OR
FERN_TOKENstring
JWT token for this user.

Headers

ROLESstringOptional

Comma-separated list of roles (only with FERN_API_KEY). Sets roles for returned search key if provided, otherwise, roles are empty.

x-fern-hoststringOptional

Documentation domain (required on preview URLs)

X-User-TokenstringOptional
Your own identifier for the end user, used to group search analytics by user. Works with or without credentials.

Response

Successfully retrieved search credentials
appIdstring
Algolia application ID
apiKeystring

Short-lived Algolia search API key

roleslist of stringsOptional

Roles included in the search key (only with FERN_API_KEY auth)

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error