sdk-v2

Sdk V2 Query

Natural language to SQL via agentic loop with tool calling.

DEPRECATED: SDK v2 is superseded by SDK v3 (POST /v3/sdk/step). This endpoint keeps working and returns Deprecation/Link headers; it will be removed in a future release.

post/v2/sdk/query

Request

  • Base URL: https://api.pandas-ai.com (the document declares no server; this is the origin it was published from)
  • URL: https://api.pandas-ai.com/v2/sdk/query
  • Auth: none declared

Request body

questionstring required

Natural language query

dialectstring

Target SQL dialect

conversation_historyobject[]

Previous conversation turns for multi-turn support

general_contextstring nullable

Additional context or instructions for the AI

languagestring nullable

Response language code (e.g., 'en', 'it', 'es')

constraintsobject nullable

Per-table filter constraints injected into the SQL programmatically. Dict mapping table names to lists of constraint conditions. Example: {"sales": [{"column": "tenant_id", "operator": "equals", "value": 42}]}

tagsstring[] nullable

Optional semantic-layer selection filter. When provided, only tables/columns/metrics carrying ALL of these tags are used (AND match); untagged entries are excluded. Omit to use the full layer.

versionstring nullable

Optional named semantic-layer version to serve (a frozen snapshot). Omit to serve the editable Current layer. Unknown name → error.

Response

Successful Response

successboolean
reasonstring nullable

Machine-readable reason code when success is false

sqlstring nullable
visualizationstring
column_display_namesobject nullable
titlestring nullable
messagestring nullable
conversation_turnobject[] nullable

Messages from this turn to append to conversation history

Changes

No recorded changes to this operation across all 1 revision of this API.