Setup

Create a key, keep it out of your repository, and construct the client once.

  1. 1

    Install

    bash
    npm install @tigerbase/server
  2. 2

    Create a key

    Open API keys in the dashboard sidebar. Give the key a name you will recognise in a log, and only the scopes it needs. The key is shown once and cannot be read back — if you lose it, revoke it and make another.

  3. 3

    Put it in the environment

    .env.local
    TIGERBASE_KEY=tb_live_…

    Not in the repository, and not in anything your build sends to a browser. In Next.js that means not a NEXT_PUBLIC_ variable — that prefix is an instruction to put the value in the bundle.

  4. 4

    Construct it once

    lib/tigerbase.ts
    import { TigerbaseServer } from "@tigerbase/server";
    
    /**
     * One instance for the process.
     *
     * Constructing per request re-reads the key every time and, more to the
     * point, spreads the import across files — which is how it eventually
     * lands in one that ships to a browser.
     */
    export const tigerbase = new TigerbaseServer({
      apiKey: process.env.TIGERBASE_KEY!,
    });
  5. 5

    Check it works

    bash
    curl https://api.tigerbase.cloud/v1/agents \
      -H "Authorization: Bearer $TIGERBASE_KEY"

    A list of your agents means the key and its read scope are good. A 401 means the key itself is wrong; a 403 means it is valid but was not given read.

Creating a key asks who you are

A server key is standing access: it keeps working long after the session that made it has ended. So the dashboard treats minting one as a sensitive change, and two rules apply.

You confirm it is you

Before the key is created you are asked for your password, or a two-factor code if you have it switched on. An open laptop or a borrowed session is not enough to walk away with a key.

A key can do no more than you can

read, chatYou need permission to view agents.
writeYou need permission to edit agents.
handoffYou need permission to reply in the inbox.

Ask for a scope beyond your own role and the request is refused. A member who cannot read the inbox should not be able to mint a key that can.

TipOne key, one App

A key belongs to the App it was created in. It sees that App's agents, conversations, usage and handoff queue — and nothing from your other Apps, even on the same account. An integration that spans two Apps uses two keys.

Options

apiKeyRequired. The secret key, starting tb_live_.
apiUrlOptional. Where the API lives. Defaults to https://api.tigerbase.cloud — set it for a self-hosted install or local development.

What it does the moment you construct it

Two checks, both before any network call, so a misconfiguration fails where you can see it rather than on the first request in production.

A missing keyThrows invalid_key immediately, instead of making a request that was always going to be refused.
A browserThrows secret_key_in_browser. If you see this in a framework that renders on both sides, the import has reached a client component.

WarningIf you hit secret_key_in_browser in Next.js

The file importing it is being bundled for the client. Move the call into a server component, a route handler or a server action — and keep the import in the server-only module, not in the component.

TipBoth packages, one app

A Next.js app can install both: @tigerbase/server in your route handlers and server components, @tigerbase/client in the components that render the chat. Different keys, different packages, no overlap.