Deploy AI Workflows as APIs
Turn your Pipecat workflows into production-ready REST and websocket APIs instantly.
Deploying AI Workflows as APIs
Once you've built your AI agent, you can easily deploy it as a production-ready REST API. This allows you to integrate Pipecat's powerful LLM routing and tool-execution capabilities directly into your own applications, backend systems, or automated scripts.
After you have created your agent (if you haven't, check out Build Your First AI Agent), click on the Publish button in your Canvas tab. After you have published it, your workflow instantly becomes an executable API endpoint.
Invoking Your Workflow
You can trigger a workflow run using a simple POST request. Ensure you authenticate by providing your Pipecat API key in the X-API-Key header.
Endpoint:
POST https://api.pipecat.in/invoke/{workflow_id}/invoke
X-API-Key: your-pipecat-api-key
Request Body:
{
"input": "Your query or prompt goes here"
}
Successful Response
If the run is successful, the API returns a JSON response containing the final output and a trace of any tools that were executed during the process.
{
"run_id": "123e4567-e89b-12d3-a456-426614174000",
"status": "success",
"output": "The current weather in Tokyo is 22°C and sunny.",
"tool_calls": [
{
"node_id": "llm_node_1",
"tool": "get_weather",
"input": {
"location": "Tokyo"
},
"result": "{\"temperature\": 22, \"condition\": \"Sunny\"}"
}
]
}
[!NOTE] If your workflow uses Structured Output, the
outputfield will automatically be parsed into a JSON object instead of a raw string!
Error Codes
If something goes wrong with the request itself, you might receive one of the following HTTP errors:
| Status Code | Description |
|---|---|
| 404 Not Found | The workflow_id does not exist, or you do not have permission to access it. |
| 429 Too Many Requests | You have reached the monthly run limit for your current subscription plan. You will need to upgrade to continue executing workflows. |
Monitoring and Logs
When you expose your workflows as APIs, monitoring becomes critical. Pipecat automatically tracks every single API invocation.
You can check your workflow logs in the Dashboard.
For highly detailed execution traces:
- Go to Workflows in the sidebar.
- Select your desired workflow.
- Click on the Stats button on the right-hand side.
After clicking Stats, you can see a complete history of all runs—whether they were successful or unsuccessful. Pipecat breaks down the exact time taken by each individual step (node) of the flow, allowing you to debug latency issues or optimize your prompt chains easily!