How It Works
Your bot runs inside a FastAPI server managed by the Pipecat Cloud base image. When you define custom endpoints using theapp object from pipecatcloud_system, they become reachable through the Session API.
Requests are proxied through Pipecat Cloud to the specific bot instance handling your session:

1
Start a session
Start a session with your
agent and capture the
sessionId from the response.2
Define endpoints in your bot
Add custom routes to the
app object from pipecatcloud_system in your
bot.py.3
Send requests to your session
Make HTTP requests to the session endpoint. Pipecat Cloud routes them to the
bot instance for that session.
Endpoint Format
Supported Methods
GET, POST, PUT, PATCH, DELETE, OPTIONS, HEAD
Authentication
Include your Pipecat Cloud public API key in theAuthorization header:
Setting Up Your Bot
Define endpoints in yourbot.py using the app object from pipecatcloud_system. This is the same FastAPI application that serves your bot, so your custom routes run alongside the built-in ones.
Requires base image version
0.1.2 or later.Connecting Endpoints to Your Pipeline
Most Session API use cases require your endpoint to interact with the running pipeline. The pattern is:- Store a reference to your
PipelineWorkerin a module-level variable - Access it from your endpoint handler to queue frames into the pipeline
Examples
Update Conversation Context
UseLLMMessagesAppendFrame to add messages to the LLM’s conversation context from an HTTP request. Setting run_llm=True tells the pipeline to immediately send the updated context to the LLM for a response.
Trigger the Bot to Speak
UseTTSSpeakFrame to make the bot say something on demand:
Get Session Status
Endpoints don’t have to interact with the pipeline. You can also use them to expose any state your bot tracks:Important Notes
- Startup latency: If you call the Session API before your bot finishes initializing, the request may take longer while waiting for the bot to become available.
- Session scope: Each request is routed to the specific bot instance identified by
session_id. Different sessions are separate pods and don’t share state. - Error handling: If a session has ended or the session ID is invalid, you’ll receive an error response.
- Reserved paths: The base image uses
/bot,/ws,/api/offer,/whatsapp,/readyz, and/livez. Don’t define endpoints at these paths.