Before you begin
- A Potpie account
- An API key ,if you don’t have one yet see Generate an API Key
x-api-key header.
Step 1 : Parse a repository
Parsing builds the knowledge graph for your repository. Every subsequent API call like creating conversations, sending messages requires aproject_id from this step.
GitHub repository in
owner/repo format. Required for cloud usage.Absolute path to a local repository. Only works when
isDevelopmentMode=enabled. Use this instead of repo_name for local development.Branch to parse. If omitted, defaults to
null.Specific commit SHA to parse. If omitted, parses the latest commit on the branch.
project_id . You’ll use it in every request from here on.
Step 2 : Wait for parsing to complete
Parsing runs asynchronously. Poll the status endpoint untilstatus is ready before creating a conversation.
submitted → cloned → parsed → processing → inferring → ready
If parsing fails at any stage, status becomes error.
To manage conversations and messages as separate steps, continue to Step 3. To create a conversation and send a message in a single request, jump to create conversation and send message in one call.
Step 3 : Create a conversation
A conversation connects your project to an agent. Choose the agent based on what you want to do.Answers questions about how your codebase works like architecture, logic, dependencies.
Generates and modifies code based on your instructions, with awareness of existing patterns in the repo.
Produces technical specifications from codebase context or a description of what you want to build.
Traces bugs through the codebase and suggests fixes with file paths and line references.
conversation_id. Use it in all subsequent message requests.
Step 4 : Send a message
Send your question or instruction to the conversation. Responses stream by default.stream=true, default)
Chunks are yielded as JSON objects as they arrive:
stream=false)
The full response is returned once the agent finishes:
Create conversation and send message in one call
For quick, one-off queries you can skip managing aconversation_id entirely. This endpoint creates the conversation and sends the first message in a single request. The conversation is hidden from the UI by default.
The project ID returned from parsing.
Whether to hide the conversation from the web UI. Defaults to
true.The message to send.
The agent to use. Defaults to
codebase_qna_agent.Optional array of node context objects to focus the query on specific code elements.

