Langbase API Keys for users and organizations

The Langbase API uses API keys for authentication. You can create API keys at a user or org account level.


Table of contents


Get your Langbase API key

You can generate API keys from the Langbase studio by following these steps:

  1. Switch to your user or org account.
  2. From the sidebar, click on the Settings menu.
  3. In the developer settings section, click on the Langbase API keys link.
  4. From here you can create a new API key or manage existing ones.

For more details read the docs below.

Important
Treat your API keys like passwords. Keep them secret — use only on the server side.

Remember to keep your API key secret! Your Langbase API key is sever side only. Never share it or expose it in client-side code like browsers or apps. For production requests, route them through your own backend server where you can securely load your API key from an environment variable or key management service.


All API requests should include your API key in an Authorization HTTP header as follows:

Authorization: Bearer LANGBASE_API_KEY

With Langbase SDK, you can set your API key as follows:

import {Langbase} from 'langbase';

const langbase = new Langbase({
	apiKey: process.env.LANGBASE_API_KEY
});

Org API Key

Get an API key for your organization on Langbase.

Step #1 Go to organization settings

Login to your account on Langbase.

  1. Navigate to your organization profile page.
  2. Click on the Settings button and select 'Langbase API Keys'.

Step #2 Org API Keys section

  1. In the Org API Keys section, click on the Generate API Key button.

Step #3 Generate a new API key

  1. Give your org API key a name. Let's call it Org API Key.
  2. Click on Generate API Key button to generate the API key.

Step #4 Copy the API Key

  1. Use the Copy button to copy your org API key.
  2. Click on the Done button to close the modal.
Warning
Make sure to copy your org API key now. You will not be able to view it another time.

User API Key

Get an API key for your user account on Langbase.

Step #1 Go to profile settings

Login to your account on Langbase.

  1. Navigate to your profile Settings page.
  2. Select 'Langbase API Keys'

Step #2 User API Keys section

  1. In the User API Keys section, click on the Generate API Key button.

Step #3 Generate a new API key

  1. Give your user API key a name. Let's call it API Key.
  2. Click on Generate API Key button to generate the API key.

Step #4 Copy the API Key

  1. Use the Copy button to copy your user API key.
  2. Click on the Done button to close the modal.
Warning
Make sure to copy your user API key now. You will not be able to view it another time.

✨ Congrats, you have created your first API key. We're excited to see what you build with it.