Skip to content
Letta Platform Letta Platform Letta Docs
Sign up
Using the API

API Overview

Introduction to the Letta API including REST endpoints and authentication.

The Letta API is a RESTful API at https://api.letta.com that provides programmatic access to stateful agents with persistent memory.

To use the Letta API, you’ll need an API key.

For step-by-step setup instructions, see the quickstart.

All requests to the Letta API must include these headers:

HeaderValueRequired
AuthorizationBearer <your-api-key>Yes
Content-Typeapplication/jsonYes

If you are using the Client SDKs, the SDK will send these headers automatically.

Letta provides official SDKs for Python and TypeScript that simplify API integration, providing:

  • Automatic header management
  • Type-safe request and response handling
  • Built-in retry logic and error handling
Terminal window
pip install letta-client
from letta_client import Letta
client = Letta(api_key="your-api-key")
agent = client.agents.create(
model="openai/gpt-4.1",
)
response = client.agents.messages.create(
agent_id=agent.id,
input="Hello!"
)
Terminal window
npm install @letta-ai/letta-client
import Letta from "@letta-ai/letta-client";
const client = new Letta({ apiKey: "your-api-key" });
const agent = await client.agents.create({
model: "openai/gpt-4.1",
});
const response = await client.agents.messages.create(agent.id, {
input: "Hello!",
});