👋 Welcome to the new Omni docs! We're still migrating, but the old docs are available at docs-legacy.omni.co.
curl --request POST \
--url https://{instance}.omniapp.co/api/v1/ai/generate-query \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"modelId": "123e4567-e89b-12d3-a456-426614174000",
"currentTopicName": "orders",
"prompt": "Show me total revenue by product category for the last quarter"
}
'{
"query": {
"model_job": {
"model_id": "bcf0cffd-ec1b-44d5-945a-a261ebe407fc",
"table": "order_items",
"fields": [
"products.item_name",
"order_items.total_sale_price"
],
"calculations": [],
"filters": {},
"sorts": [
{
"column_name": "order_items.total_sale_price",
"sort_descending": true,
"is_column_sort": false,
"null_sort": "OMNI_DEFAULT"
}
],
"limit": 10,
"pivots": [],
"fill_fields": [],
"column_totals": {},
"row_totals": {},
"column_limit": 50,
"default_group_by": true,
"join_via_map": {},
"join_paths_from_topic_name": "order_items",
"version": 5,
"period_over_period_computations": [],
"query_references": {},
"metadata": {},
"custom_summary_types": {}
}
}
}Generate a structured Omni query from natural language using AI
curl --request POST \
--url https://{instance}.omniapp.co/api/v1/ai/generate-query \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"modelId": "123e4567-e89b-12d3-a456-426614174000",
"currentTopicName": "orders",
"prompt": "Show me total revenue by product category for the last quarter"
}
'{
"query": {
"model_job": {
"model_id": "bcf0cffd-ec1b-44d5-945a-a261ebe407fc",
"table": "order_items",
"fields": [
"products.item_name",
"order_items.total_sale_price"
],
"calculations": [],
"filters": {},
"sorts": [
{
"column_name": "order_items.total_sale_price",
"sort_descending": true,
"is_column_sort": false,
"null_sort": "OMNI_DEFAULT"
}
],
"limit": 10,
"pivots": [],
"fill_fields": [],
"column_totals": {},
"row_totals": {},
"column_limit": 50,
"default_group_by": true,
"join_via_map": {},
"join_paths_from_topic_name": "order_items",
"version": 5,
"period_over_period_computations": [],
"query_references": {},
"metadata": {},
"custom_summary_types": {}
}
}
}Use either an Organization API Key or Personal Access Token (PAT).
Include in the Authorization header as: Bearer YOUR_TOKEN
Successfully generated query
Show child attributes
A structured Omni query object that can be used with the Query run API
Show child attributes
Model identifier
Base table/topic name
Array of field names to include in query
Custom calculations
Filter conditions
Result row limit
Pivot configurations
Fields to fill
Column totals configuration
Row totals configuration
Column limit for pivots
Enable default grouping
Join configuration map
Topic name for join paths
Query version
Period over period calculations
Query references
Query metadata
Custom summary type definitions
Was this page helpful?