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.
Prerequisites
Section titled “Prerequisites”To use the Letta API, you’ll need an API key.
For step-by-step setup instructions, see the quickstart.
Authentication
Section titled “Authentication”All requests to the Letta API must include these headers:
| Header | Value | Required |
|---|---|---|
Authorization | Bearer <your-api-key> | Yes |
Content-Type | application/json | Yes |
If you are using the Client SDKs, the SDK will send these headers automatically.
Client SDKs
Section titled “Client SDKs”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
Python
Section titled “Python”pip install letta-clientfrom 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!")TypeScript
Section titled “TypeScript”npm install @letta-ai/letta-clientimport 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!",});Next steps
Section titled “Next steps” Quickstart Prerequisites, step-by-step tutorial, and examples.
Core concepts Understand agents, memory blocks, and tools.