Skip to content

Authentication ​

Create a personal API key under Account → API keys in the Lab0 console. Copy the secret when it is shown and keep it on your server or in your local environment.

bash
export LAB0_API_KEY='lab0_sk_replace_with_your_key'
export LAB0_BASE_URL='https://app.lab0.ai/app'

Send it with every request:

bash
curl --fail-with-body --silent --show-error \
  --header "Authorization: Bearer $LAB0_API_KEY" \
  "$LAB0_BASE_URL/api/knowledge/namespaces"

Choose the right access ​

Key accessAllowed Knowledge API actions
Read-onlyList and fetch files; list namespaces
Read & writeRead, upload, ask questions, delete files and delete namespaces

A key acts as the user who created it. Namespaces and files belong to that user; two users can use the same namespace name without sharing its documents. A namespace is a grouping within one user's data, not a substitute for separate user identities.

Treat the key as a password. Keep it out of client-side code, source control and shared logs. Revoke it in the console if it is exposed.

Browser sessions ​

Signed-in console sessions also work. Uploads and questions authenticated by a session must include X-Lab0-Knowledge: 1. The server-side walkthroughs use bearer keys and do not need this header.

The reference on this docs site is for reading and copying code. It does not send authenticated API requests from your browser.

Authentication errors ​

A missing, invalid or expired key returns 401. A key without the access needed for an action returns 403. Errors have a machine-readable code, a human-readable message, and, when available, a request_id to include when reporting a problem. See the full error reference.

Lab0 developer documentation