Welcome to Potpie API
The Potpie API enables you to integrate AI-powered codebase intelligence into your applications, tools, and workflows. Our REST API provides programmatic access to all of Potpie’s core features including parsing, conversations, search, and agent interactions.Quick Start
Get up and running in minutes
Authentication
Learn how to authenticate your requests
Code Examples
Copy-paste ready examples in multiple languages
API Endpoints
Browse all 10 available endpoints
Getting Started
Base URL
All API requests should be made to:API Key
Get your API key from the Potpie Dashboard.Making Your First Request
Authentication
All API endpoints require authentication using Bearer tokens. Include your API key in theAuthorization header of every request:
Example Authentication
Security Best Practices
- Store API keys in environment variables
- Use different keys for development and production
- Rotate keys periodically
- Never log or print API keys
- Implement proper error handling to avoid exposing keys
Available Endpoints
Parsing & Projects
Parse Directory
POST /api/v1/parse - Analyze a repository to build the knowledge graph
Get Parsing Status
GET /api/v1/parsing-status/:project_id - Check parsing progress
Get Parsing Status By Repo
POST /api/v1/parsing-status - Check status using repo name and branch
List Projects
GET /api/v1/projects/list - Retrieve all your parsed projects
Search Codebase
POST /api/v1/search - Perform semantic search across your code
Conversations & Agents
Create Conversation
POST /api/v2/conversations/ - Start a new conversation with AI agents
Post Message
POST /api/v1/conversations/:id/message/ - Send messages to a conversation
Create Conversation And Message
POST /api/v2/project/:project_id/message/ - Quick single-call message flow
List Agents
GET /api/v1/list-available-agents/ - Get all available AI agents
Integrations
Typical Workflow
Here’s a common workflow for using the Potpie API:Step-by-Step Integration
Parse Your Repository
Use the Parse Directory endpoint to analyze your codebase and build the knowledge graph
Monitor Parsing
Poll the Get Parsing Status endpoint until parsing is complete
Select an Agent
Use List Agents to see available AI agents and choose the right one for your task
Create Conversation
Start a conversation with Create Conversation by providing project IDs and agent IDs
Interact
Send messages using Post Message and receive AI-powered responses about your codebase
Code Examples
Complete Integration Example
Rate Limits
To ensure fair usage and system stability:| Resource | Limit |
|---|---|
| API Requests | 1000 requests per hour |
| Parsing Jobs | 5 concurrent parsings |
| Message Rate | 10 messages per minute per conversation |
| Search Queries | 100 searches per minute |
Rate limits are subject to your plan. Contact sales@potpie.ai for higher limits.
Error Handling
The API uses standard HTTP status codes:| Status Code | Description |
|---|---|
| 200 | Success |
| 400 | Bad Request - Invalid parameters |
| 401 | Unauthorized - Invalid or missing API key |
| 403 | Forbidden - Insufficient permissions |
| 404 | Not Found - Resource doesn’t exist |
| 422 | Validation Error - Request body validation failed |
| 429 | Too Many Requests - Rate limit exceeded |
| 500 | Internal Server Error - Something went wrong |
Error Response Format
Handling Errors
Best Practices
API Usage
- Polling: When checking parsing status, use exponential backoff to reduce unnecessary requests
- Caching: Cache project lists and agent information to minimize API calls
- Error Handling: Implement retry logic with exponential backoff for transient errors
- Timeouts: Set appropriate timeouts for long-running operations
- Pagination: Use pagination parameters when available to handle large result sets
Security
- API Keys: Store API keys securely in environment variables or secret management systems
- HTTPS: Always use HTTPS for API requests
- Key Rotation: Rotate API keys regularly
- Access Control: Use different API keys for different environments (dev, staging, prod)
Performance
- Batch Operations: Group related operations when possible
- Parallel Requests: Make independent API calls in parallel
- Response Caching: Cache responses when data doesn’t change frequently
- Connection Pooling: Reuse HTTP connections for multiple requests
SDKs and Libraries
Official SDKs (Coming Soon)
We’re working on official SDKs for:- TypeScript/JavaScript
- Python
- Go
- Ruby
Community Libraries
Check out community-contributed libraries on GitHub.Webhooks (Coming Soon)
Subscribe to events in your codebase:- Parsing ready
- New conversation created
- Message response ready
- Code changes detected
Support
Need help?Documentation
Browse comprehensive guides
Discord Community
Join our developer community
GitHub Issues
Report bugs and request features
Email Support
Contact our support team
API Changelog
Stay updated with the latest API changes:2024-02-09
- Comprehensive API documentation for 10 core endpoints
- Enhanced OpenAPI 3.1 specification with detailed examples
- Improved authentication and error handling documentation
- Added complete integration examples in TypeScript and Python
- Rate limiting and best practices guidelines
- Added integrations endpoint for external service configuration
- Streamlined conversation creation with direct message endpoint
Subscribe to our API changelog for updates.

