Skip to main content
POST

Overview

Create a new conversation and send the first message in a single API call. This streamlined endpoint is perfect for quick interactions where you want to ask a question about your codebase without managing conversation state.

Key Benefits

  • Simplified Workflow: Combine conversation creation and messaging in one request
  • Auto-hidden Conversations: Conversations are automatically hidden from the UI (configurable)
  • Default Agent: Uses the Q&A agent by default for codebase queries
  • Immediate Response: Get AI responses without managing conversation IDs

Use Cases

  • Quick codebase queries without managing conversations
  • Automated analysis scripts
  • CI/CD integration for code insights
  • Stateless API integrations
  • One-off questions about specific projects

Authentication

This endpoint requires API key authentication via the x-api-key header.

Error Responses

The endpoint validates that message content is not empty.
Causes:
  • Empty string provided in content field
  • Whitespace-only content
  • Missing content field
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 unexpected exceptions occur.
Causes:
  • Invalid project ID
  • Project not yet ready (still parsing)
  • Database connection failures
  • Invalid agent ID
Solution: Verify project ID is valid and project has completed parsing. Retry after a brief delay.

Complete Workflow

Advanced Usage

With Node Context

Focus the query on specific code elements:

Make Visible in UI

Create a conversation that appears in the web interface:

Complete Integration Example

Comparison with Standard Flow

Troubleshooting

Problem: Error occurs even with valid project ID.Solution:
  • Check the project’s parsing status using the Get Parsing Status endpoint
  • Wait for parsing to complete before sending messages
  • Ensure the project status is “ready” before querying
Problem: Request times out or takes very long.Solution:
  • Complex queries may take longer to process
  • Implement appropriate timeout values (30-60 seconds recommended)
  • Consider breaking complex questions into simpler ones
  • Check if the project is very large

When to Use Standard vs. Direct Flow

Use This Endpoint When:
  • Making quick, one-off queries
  • Building stateless integrations
  • Automating codebase analysis
  • Don’t need conversation history
Use Standard Flow When:
  • Building interactive chat experiences
  • Need multi-turn conversations
  • Managing conversation history
  • Require fine-grained control over conversation state

Authorizations

x-api-key
string
header
required

API key authentication. Get your key from potpie settings page

Path Parameters

project_id
string
required

The project ID to query about

Query Parameters

hidden
boolean
default:true

Whether to hide this conversation from the web UI

Body

application/json
content
string
required

Your question about the codebase

agent_id
string
default:codebase_qna_agent

Agent to use (defaults to codebase_qna_agent)

node_ids
object[]

Optional node context

Response

Message sent 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