Langbase API

Langbase is an API-first platform delivering exceptional developer experience. Our APIs are simple, intuitive, and designed for seamless integration. With clear documentation, practical code examples, and responsive community support, we help you build quickly and efficiently.


Table of contents


Introduction

You can interact with Langbase APIs using

  1. HTTP requests from any language,
  2. or via our official Langbase SDK (Node.js),
  3. or via BaseAI.dev, our open-source web AI framework.

To install the official Node.js Langbase SDK, run the following command in your Node.js project directory:

Install the SDK

npm i langbase

From here on you can use the Langbase SDK to interact with Langbase APIs.


Authentication

The Langbase API uses API keys for authentication. You can create API keys at a user or org account level. Some API endpoints like when running a pipe allow you to specify a pipe specific API key as well.

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
});
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.


Langbase API Reference

Explore the Langbase API reference to build AI agents with memory.


Next Steps

  • Build something cool with Langbase APIs.
  • Join our Discord community for feedback, requests, and support.