Skip to main content
NeuronSearchLab has three kinds of credential. Pick the one that matches where your code runs.
Never put a client secret, an access token or an nsl_ API key in browser or mobile code. Anyone who can read your page source or app bundle could use it. The publishable key is the only credential designed to be public.
Mobile apps should call your own backend, which holds the credentials and calls NSL. The Swift SDK accepts a static token for trusted runtimes; it does not make a workspace-wide token safe to distribute in a mobile app.

SDK credentials

Create them in Developers → SDK Credentials. See SDK Credentials for the console steps. Create one credential per application and environment, so you can revoke one without affecting the others.

Let the SDK manage tokens

The JavaScript and PHP SDKs exchange the credentials for a token, cache it and refresh it before it expires:
If a token is rejected with 401, the SDK fetches a new one and retries the request once. If you already run your own token service, pass tokenProvider (a function that returns a token) or a static accessToken instead.

Exchange credentials yourself

Without an SDK, call the token endpoint with HTTP Basic authentication:
Then send the token on every Core API call:
Use the returned expires_in value to determine token lifetime. Cache one per credential, compute expires_at = now + expires_in, and fetch a new token a minute or so before it expires. Do not request a token per API call: the token endpoint is rate-limited separately.

Scopes

A token carries both scopes unless you ask for fewer with the scope form field. Treat scope strings as opaque and split them only on spaces.

API keys

Create them in Developers → API Keys, choosing which areas each key can reach. See API keys. Send a key as a bearer token:
API keys are also how AI assistants connect through MCP. See ChatGPT and MCP.

Publishable keys

Created in Developers → Website embed, together with the list of origins allowed to use them. A publishable key can only fetch recommendations and report engagement with what it was shown. It cannot read your catalogue, change configuration or create other credentials. See Website embed.

Good practice

  • Use one credential per application and environment (production, staging).
  • Rotate secrets by creating the new credential, deploying it, then revoking the old one.
  • Revoke credentials as soon as a person or service no longer needs them. Revoking SDK credentials prevents new token issuance; already-issued access tokens may remain valid until expiry.
  • Review Account → Activity to see when credentials were created, changed or revoked.