Get started

Authentication

Every call except the price list carries a bearer credential in the Authorization header. Your code uses an API key; an AI assistant connecting over MCP signs in with OAuth or uses an API key.

API keys

Header
Authorization: Bearer sk_live_3f9a...

Sandbox keys

A sandbox key starts with sk_test_. It reaches the same routes as a live key but gets deterministic synthetic data, never your organisation's or a partner's, and it is never charged. Every response carries the header X-Sandbox: true and "sandbox": true in its JSON body.

Create a sandbox key
curl -sS "$TRIVDA_URL/api/v1/api-keys" \
  -H "Authorization: Bearer $TRIVDA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "local development", "sandbox": true}'

Scopes

A key can be narrowed when it is created. Scopes are a list of strings; an empty list means everything the organisation may do.

ScopeAllows
<index name>Searches that run against that index. Find the names with GET /api/v1/search/collections.
use_case:<name>Searches with that use_case, for example use_case:rag.
Create a key that may only run RAG searches
curl -sS "$TRIVDA_URL/api/v1/api-keys" \
  -H "Authorization: Bearer $TRIVDA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "chatbot backend", "scopes": ["use_case:rag"]}'

Rules that keep scopes safe:

OAuth for MCP clients

Assistants such as Claude and ChatGPT connect to https://13-63-0-55.sslip.io/connector/mcp and sign in with OAuth 2.1. You do not configure anything: the client discovers what it needs from the server.

  1. The client calls the connector without a token and gets 401 with a WWW-Authenticate header pointing at /.well-known/oauth-protected-resource/connector/mcp.
  2. That metadata names the authorisation server, which is TRIVDA itself (/.well-known/oauth-authorization-server).
  3. The client registers itself (dynamic client registration) and sends you to a TRIVDA consent page with PKCE. You sign in and approve.
  4. The client receives an access token that lasts 1 hour and, if it asked for one, a refresh token. Refresh tokens are single-use and rotate; reusing an old one revokes the whole chain.

Clients that let you set a header can skip OAuth and send an API key instead: Authorization: Bearer sk_live_.... The MCP page shows both for each client.

Machine-to-machine tokens

For a service that should not hold a long-lived key, TRIVDA can issue an OAuth 2.0 client (a client_id and client_secret) that is exchanged for a short-lived bearer token with the client_credentials grant. These clients are issued on request; ask TRIVDA if you need one. The token is used exactly like an API key.

When authentication fails

StatusMeaning
401No Authorization: Bearer header, an empty token, an unknown or revoked key, or an expired token.
403The credential is valid but not allowed this: outside its scopes, or the organisation is suspended.