v4
latestOpenAPI 3.1.02026-08-01207318738.7 KBGenerate query from natural language
Generate an Omni semantic query from a natural language prompt. Optionally executes the generated query and returns results. The AI analyzes the prompt, selects appropriate fields and filters from the model, and constructs a query. Requires the querier role on the target model. The effective user's per-connector AI toggles (set in the chat + menu) govern which integration tools the agent may use.
Request body
Example request
{
"branchId": "550e8400-e29b-41d4-a716-446655440000",
"currentTopicName": "order_items",
"modelId": "770e8400-e29b-41d4-a716-446655440002",
"prompt": "Show me total revenue by month for the last year",
"runQuery": true,
"userId": "990e8400-e29b-41d4-a716-446655440004"
}Response
Query generated successfully. If runQuery is true (default), includes execution results. Check the error field — a 200 response may still contain a partial error if the query was generated but execution failed. When the organization is over its AI downgrade threshold the response also carries downgradedModelTier naming the cheaper tier the query was generated with.
Example response
{
"downgradedModelTier": "haiku",
"error": {
"detail": "The AI was unable to generate a query for this prompt. Try rephrasing your question to be more specific about the data you want to retrieve.",
"message": "No query generated"
},
"query": {
"fields": [
"products.name",
"order_items.total_revenue"
],
"limit": 500,
"sorts": [
{
"column_name": "order_items.total_revenue",
"sort_descending": true
}
],
"table": "order_items"
},
"topic": "order_items",
"workbookUrl": "https://myorg.omni.co/w/abc123/1"
}