Skip to main content
POST

Use Cases

  • Ask questions about your codebase
  • Request debugging assistance
  • Get explanations of code functionality
  • Ask for code improvements or refactoring suggestions
  • Inquire about code relationships and dependencies

Authentication

This endpoint requires API key authentication via the x-api-key header.
NodeContext Object Structure:
Request Form Data Example:

Node Context

Providing node_ids helps the agent focus on specific parts of your codebase. Because the endpoint uses multipart/form-data, pass node_ids as a JSON-encoded string in the form field:
You can find node IDs by using the Search Codebase endpoint or through the Potpie UI.

Error Responses

The endpoint validates that message content is not empty.
Causes:
  • Empty string provided in content field
  • Whitespace-only content
  • Missing content field entirely
Solution: Provide non-empty message content:
The endpoint requires a valid API key for authentication.
Causes:
  • Missing x-api-key header
  • Invalid or expired API key
Solution: Include a valid API key in the request header.
The endpoint returns this error when you have exceeded your plan’s usage limits.
Causes:
  • Message limit exceeded for your current plan
  • Subscription has expired
Solution: Upgrade your subscription plan or wait for limits to reset.
The endpoint returns this error when the conversation doesn’t exist or you lack access.
Causes:
  • Invalid conversation_id in URL path
  • Conversation was deleted
  • You don’t have access to this conversation
Solution: Verify the conversation ID and ensure you have proper access permissions.
The endpoint returns this error when unexpected exceptions occur during message processing.
Causes:
  • Celery worker unavailable for message processing
  • Database connection failures
  • Invalid node IDs or attachment IDs
Solution: Retry the request after a brief delay. Verify all node IDs and attachment IDs are valid.

Complete Workflow

Message Types

Different message patterns for different tasks:

Question & Answer

Debugging

Code Review

Response Streaming

When stream=true (the default), the endpoint returns a streaming response via Server-Sent Events. Each event chunk contains a partial or complete agent response. When stream=false, the endpoint returns a single JSON object with the complete response:

Authorizations

x-api-key
string
header
required

API key authentication. Get your key from potpie settings page

Path Parameters

conversation_id
string
required

The conversation ID to send the message to

Query Parameters

stream
boolean
default:true

Whether to stream the response

Body

multipart/form-data
content
string
required

Your message or question. Cannot be empty or whitespace-only.

Minimum string length: 1
node_ids
string

JSON-encoded array of NodeContext objects to reference specific code nodes. Example: [{"node_id":"node_123","name":"AuthService"}]

tunnel_url
string

VS Code extension tunnel URL for local server routing

images
file[]

Image attachments to include with your message

Response

Message sent successfully and response received

message
string

AI agent's response content

citations
string[]

Source code references used in the response

tool_calls
any[]

Tool invocations made by the agent during response generation