Skip to main content
POST
/
v1
/
query
/
run
Run query
curl --request POST \
  --url https://{instance}.omniapp.co/api/v1/query/run \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "query": {
    "modelId": "123e4567-e89b-12d3-a456-426614174000",
    "table": "orders",
    "fields": [
      "order_id",
      "total_amount"
    ],
    "limit": 100
  }
}
'
{
  "jobs_submitted": {},
  "job_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "status": "<string>",
  "client_result_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "summary": {},
  "cache_metadata": {},
  "query": {},
  "result": "<string>",
  "stream_stats": {
    "server_stream": 123
  }
}
Reach out to Omni support to have this feature enabled.

Authorizations

Authorization
string
header
required

Can be either an Organization API Key or Personal Access Token (PAT).

Include in the Authorization header as: Bearer YOUR_TOKEN

Body

application/json
query
object
required
userId
string<uuid>

Executes the query as the specified user. If not provided, the API uses the user associated with the API token. The userId must belong to a user in your organization.

cache
enum<string>
default:SkipRequery

Optional cache policy to control how query caching behaves. Must be one of:

  • Standard - Uses standard caching behavior
  • SkipRequery - Uses cached results if available, but does not requery if not found
  • SkipCache - Bypasses cache and always executes a fresh query
Available options:
Standard,
SkipRequery,
SkipCache
resultType
enum<string>

Cannot be used with planOnly. Specifies the format of query results exported by the API.

If omitted, the API will return results in a base-64 encoded format.

Available options:
csv,
json,
xlsx
planOnly
boolean

Cannot be used with resultType. If true, the API will return the query execution plan without running the query. The response will include the generated SQL and query metadata.

formatResults
boolean
default:true

Applicable only if resultType is specified. If true, formatting will be applied to numeric and currency values in the form of currency symbols and thousand separators.

Response

Successful responses will contain the following:

  • An object with a jobs_submitted property
  • An object containing details about the job, such as job_id, status, and the provided query. Note: If planOny: true was included in the request body, the status will be PLANNED.
  • The job details object will also contain a result property, which contains the query results as a base64 encoded Apache Arrow table. At this point, you can use something like Omni Python SDK to decode and validate the results.
jobs_submitted
object
job_id
string<uuid>
status
string
client_result_id
string<uuid>
summary
object
cache_metadata
object
query
object
result
string
stream_stats
object