Skip to main content

Query API

The Query API provides access to epilot's business analytics capabilities, enabling teams to query entity operations, workflow executions, and automation data stored in the epilot data lake.

Quick Startโ€‹

# List available operations
epilot query

# Call an operation
epilot query getAllViews

Common Flagsโ€‹

FlagDescription
-p key=valueSet a named parameter
-d '{...}'Request body JSON
-H 'Key: Value'Custom header
-t, --token <token>Bearer token for authentication
--profile <name>Use a named profile
-s, --server <url>Override server base URL
-i, --includeInclude response headers in output
--jsonOutput raw JSON (no formatting)
-v, --verboseVerbose output (show request details)
--jsonata <expr>JSONata expression to transform response
--definition <file>Override OpenAPI spec file/URL
--guidedPrompt for all parameters interactively
--no-interactiveDisable interactive prompts

Operationsโ€‹

Datalake V2

  • getAllViews โ€” Retrieve all materialized data lake views configured for the organization.
  • createOrUpdateView โ€” Create or update a materialized SQL view in the epilot data lake.
  • getView โ€” Retrieve the definition and attributes of a specific data lake view by its slug.
  • getAllRelationships โ€” Retrieve all table relationships configured for the organization's data lake.
  • createOrUpdateRelationship โ€” Define or update a relationship between two tables in the data lake.

Datasets

Query

V1

CredentialsV2

  • generateCredentialsV2 โ€” Generate credentials for the epilot datalake for connecting other BI tools with ClickHouse
  • listCredentialsV2 โ€” List all the credentialof Clickhouse for the organization here
  • revokeCredentialsV2 โ€” Revoke credentials for the epilot datalake for connecting other BI tools with Clickhouse

V2

getAllViewsโ€‹

Retrieve all materialized data lake views configured for the organization.

GET /datalake/views

Sample Call

epilot query getAllViews

With JSONata filter:

epilot query getAllViews --jsonata 'views'
Sample Response
{
"views": [
{
"view_name": "some_view",
"source_dataset": "current_entities",
"view_slug": "some_view",
"attributes": [
{
"name": "some_attribute",
"type": "string",
"description": "some description"
}
]
},
{
"view_name": "another_view",
"source_dataset": "taxonomies",
"view_slug": "another_view",
"attributes": [
{
"name": "taxonomy_attribute",
"type": "string",
"description": "taxonomy attribute description"
}
]
}
]
}

createOrUpdateViewโ€‹

Create or update a materialized SQL view in the epilot data lake.

POST /datalake/views

Request Body (required)

Sample Call

epilot query createOrUpdateView

With request body:

epilot query createOrUpdateView \
-d '{
"view_name": "some_view",
"source_dataset": "current_entities",
"config": {
"schema": "some_schema",
"include_purpose_view": true,
"include_label_view": true,
"include_relation_view": true,
"relationship_attribute": ["some_relationship_attribute"]
}
}'

Using stdin pipe:

cat body.json | epilot query createOrUpdateView

With JSONata filter:

epilot query createOrUpdateView --jsonata 'view_name'
Sample Response
{
"view_name": "some_view",
"source_dataset": "current_entities",
"attributes": [
{
"name": "some_attribute",
"type": "string",
"description": "some description"
}
]
}

getViewโ€‹

Retrieve the definition and attributes of a specific data lake view by its slug.

GET /datalake/views/{view_slug}

Parameters

NameInTypeRequiredDescription
view_slugpathstringYesThe URL-safe slug identifier of the view

Sample Call

epilot query getView \
-p view_slug=some_view

Using positional args for path parameters:

epilot query getView some_view

With JSONata filter:

epilot query getView -p view_slug=some_view --jsonata 'view_name'
Sample Response
{
"view_name": "some_view",
"source_dataset": "current_entities",
"attributes": [
{
"name": "some_attribute",
"type": "string",
"description": "some description"
}
]
}

getAllRelationshipsโ€‹

Retrieve all table relationships configured for the organization's data lake.

GET /datalake/relationships

Sample Call

epilot query getAllRelationships

With JSONata filter:

epilot query getAllRelationships --jsonata 'relationships'
Sample Response
{
"relationships": [
{
"relationship_name": "some_relationship",
"from_table": "some_table",
"to_table": "some_table",
"from_column": "some_column",
"to_column": "some_column",
"type": "one_to_many"
},
{
"relationship_name": "another_relationship",
"from_table": "table_a",
"to_table": "table_b",
"from_column": "column_a",
"to_column": "column_b",
"type": "many_to_many"
}
]
}

createOrUpdateRelationshipโ€‹

Define or update a relationship between two tables in the data lake.

POST /datalake/relationships

Request Body (required)

Sample Call

epilot query createOrUpdateRelationship

With request body:

epilot query createOrUpdateRelationship \
-d '{
"relationship_name": "some_relationship",
"from_table": "some_table",
"to_table": "some_table",
"from_column": "some_column",
"to_column": "some_column",
"type": "one_to_many"
}'

Using stdin pipe:

cat body.json | epilot query createOrUpdateRelationship

With JSONata filter:

epilot query createOrUpdateRelationship --jsonata 'relationship_name'
Sample Response
{
"relationship_name": "some_relationship",
"from_table": "some_table",
"to_table": "some_table",
"from_column": "some_column",
"to_column": "some_column",
"type": "one_to_many"
}

listAvailableDatasetsV2โ€‹

Lists all available datasets grouped by domain

GET /v2/query/datasets

Sample Call

epilot query listAvailableDatasetsV2

With JSONata filter:

epilot query listAvailableDatasetsV2 --jsonata 'results[0]'
Sample Response
{
"results": [
{
"domain": "entities",
"dataset": "entity_operations",
"endpoint": "/v2/query/domain/entities:execute"
},
{
"domain": "workflows",
"dataset": "workflow_execution_time_series",
"endpoint": "/v2/query/domain/workflows:execute"
}
]
}

executeEntitiesQueryโ€‹

Execute queries against entities datasets.

POST /v2/query/domain/entities:execute

Parameters

NameInTypeRequiredDescription
cache_expirationquerystring (timestamp)No
no_cachequerybooleanNo

Request Body

Sample Call

epilot query executeEntitiesQuery \
-d '{"query":{}}'

Using stdin pipe:

cat body.json | epilot query executeEntitiesQuery

With JSONata filter:

epilot query executeEntitiesQuery --jsonata 'results[0]'
Sample Response
{
"status": "FINISHED",
"timestamp": "1715621496068",
"results": [
{}
]
}

executeWorkflowsQueryโ€‹

Query Workflow Analytics Datasets.

POST /v2/query/domain/workflows:execute

Parameters

NameInTypeRequiredDescription
mockquerybooleanNo
cache_expirationquerystring (timestamp)No
no_cachequerybooleanNo

Request Body

Sample Call

epilot query executeWorkflowsQuery

With request body:

epilot query executeWorkflowsQuery \
-d '{
"dataset": "total_count_of_workflow_executions",
"workflow_definition_ids": ["string"],
"entity_schemas": ["string"],
"states": ["string"],
"group_time_by": "M",
"relative_time_range": "string",
"time_range_from": "string",
"time_range_to": "string",
"duration_threshold": 0
}'

Using stdin pipe:

cat body.json | epilot query executeWorkflowsQuery

With JSONata filter:

epilot query executeWorkflowsQuery --jsonata 'data'
Sample Response
{
"data": [0, 1],
"labels": ["label1", "label2"],
"timestamp": "1715621496068"
}

executeAutomationQueryโ€‹

Query Automation Analytics Datasets.

POST /v2/query/domain/automations:execute

Parameters

NameInTypeRequiredDescription
fromquerynumberNo
sizequerynumberNo

Request Body

Sample Call

epilot query executeAutomationQuery

With request body:

epilot query executeAutomationQuery \
-d '{
"dataset": "automation_executions_overview",
"flow_ids": ["string"],
"execution_states": ["success", "failed", "scheduled"],
"relative_time_range": "all_time",
"time_range_from": "string",
"time_range_to": "string"
}'

Using stdin pipe:

cat body.json | epilot query executeAutomationQuery

With JSONata filter:

epilot query executeAutomationQuery --jsonata '$'
Sample Response
{
"hits": 100,
"results": [
{
"flow_id": "1234567890",
"flow_name": "flow_name",
"execution_id": "execution_id",
"execution_status": "execution_status",
"entity_schema": "opportunity",
"entity_id": "entity_id",
"created_at": "execution_created_at",
"updated_at": "execution_updated_at",
"error": {
"message": "error_message",
"error_code": "error_code"
},
"trigger_event": {
"type": "EntityOperation",
"trigger_type": "createEntity"
}
}
]
}

listWorkflowPhasesByDefinitionIdโ€‹

Retrieves the workflow phases associated with a given workflow definition ID.

GET /v2/query/domain/workflows/definitions/{workflowDefinitionId}/phases

Parameters

NameInTypeRequiredDescription
workflowDefinitionIdpathstringYesThe ID of the workflow definition to retrieve phases for.

Sample Call

epilot query listWorkflowPhasesByDefinitionId \
-p workflowDefinitionId=123e4567-e89b-12d3-a456-426614174000

Using positional args for path parameters:

epilot query listWorkflowPhasesByDefinitionId 123e4567-e89b-12d3-a456-426614174000

With JSONata filter:

epilot query listWorkflowPhasesByDefinitionId -p workflowDefinitionId=123e4567-e89b-12d3-a456-426614174000 --jsonata '$'
Sample Response
[
{
"id": "y0UdVCOI",
"name": "Initial Phase"
}
]

listWorkflowDefinitionsโ€‹

Lists available worflow definitions with their ids, names and start times

GET /v2/query/domain/workflows/definitions

Parameters

NameInTypeRequiredDescription
mockquerybooleanNo

Sample Call

epilot query listWorkflowDefinitions

With JSONata filter:

epilot query listWorkflowDefinitions --jsonata 'results[0]'
Sample Response
{
"results": [
{
"id": "y0UdVCOI",
"name": "PV Kauf",
"max_date": "2023-05-31T00:00:00.000Z",
"min_date": "2023-01-00T00:00:00.000Z"
}
]
}

listPhaseNamesโ€‹

Lists phase names of an org.

GET /v2/query/domain/workflows/phases

Parameters

NameInTypeRequiredDescription
org_idquerystringNo

Sample Call

epilot query listPhaseNames

With JSONata filter:

epilot query listPhaseNames --jsonata 'results[0]'
Sample Response
{
"results": [
{
"id": "y0UdVCOI",
"name": "PV Kauf",
"max_date": "2023-05-31T00:00:00.000Z",
"min_date": "2023-01-00T00:00:00.000Z"
}
]
}

listDatasetsโ€‹

Get list of available datasets

GET /v1/query/datasets

Sample Call

epilot query listDatasets

With JSONata filter:

epilot query listDatasets --jsonata 'results[0]'
Sample Response
{
"results": [
{
"dataset": "entity_operations"
},
{
"dataset": "entities_timemachine"
}
]
}

executeQueryโ€‹

Execute queries against datasets.

POST /v1/query:execute

Parameters

NameInTypeRequiredDescription
cache_expirationquerystring (timestamp)No
no_cachequerybooleanNo

Request Body

Sample Call

epilot query executeQuery \
-d '{"query":{}}'

Using stdin pipe:

cat body.json | epilot query executeQuery

With JSONata filter:

epilot query executeQuery --jsonata 'results[0]'
Sample Response
{
"status": "FINISHED",
"timestamp": "1715621496068",
"results": [
{}
]
}

generateCredentialsV2โ€‹

Generate credentials for the epilot datalake for connecting other BI tools with ClickHouse

POST /v2/query/credentials:generate

Sample Call

epilot query generateCredentialsV2

With JSONata filter:

epilot query generateCredentialsV2 --jsonata 'username'
Sample Response
{
"username": "datalakeuser_sfsdfs_66",
"password": "***",
"endpoints": {
"host": "qjjcxsy87t.eu-central-1.aws.clickhouse.cloud",
"port": 8443
},
"database": "datawarehouse"
}

listCredentialsV2โ€‹

List all the credentialof Clickhouse for the organization here

GET /v2/query/credentials:list

Sample Call

epilot query listCredentialsV2

With JSONata filter:

epilot query listCredentialsV2 --jsonata 'users'
Sample Response
{
"users": [
{
"user_id": "string"
}
]
}

revokeCredentialsV2โ€‹

Revoke credentials for the epilot datalake for connecting other BI tools with Clickhouse

POST /v2/query/credentials:revoke

Parameters

NameInTypeRequiredDescription
user_idquerystringNo

Sample Call

epilot query revokeCredentialsV2

With JSONata filter:

epilot query revokeCredentialsV2 --jsonata 'success'
Sample Response
{
"success": true
}

executeQueryV2โ€‹

Execute queries against datasets.

POST /v2/query:execute

Request Body

Sample Call

epilot query executeQueryV2 \
-d '{}'

Using stdin pipe:

cat body.json | epilot query executeQueryV2

With JSONata filter:

epilot query executeQueryV2 --jsonata 'results[0]'
Sample Response
{
"status": "FINISHED",
"timestamp": "1715621496068",
"results": [
{}
]
}

getSemanticModelโ€‹

Get the semantic model for agent/tool consumption.

GET /v2/query/semantic-model

Sample Call

epilot query getSemanticModel

With JSONata filter:

epilot query getSemanticModel --jsonata 'entities'
Sample Response
{
"entities": [
{
"name": "current_contacts",
"displayName": "Contacts",
"schema": "entity"
}
],
"relationships": [
{
"from": "current_contacts",
"to": "opportunity_account_contact_relation",
"relationship": "hasMany",
"displayName": "Contact has many Opportunities"
}
],
"capabilities": {
"aggregations": ["count", "count_distinct", "sum", "average", "min", "max", "median"],
"calculationTypes": [
{
"type": "string",
"description": "string",
"parameters": {}
}
],
"granularities": ["day", "week", "month", "quarter", "year"],
"filterOperators": [
{
"operator": "string",
"description": "string"
}
]
}
}

autocompleteโ€‹

Generic autocomplete endpoint for querying distinct values across datasets.

GET /v2/query/autocomplete

Parameters

NameInTypeRequiredDescription
datasetquery"workflows" | "purposes" | "sharing_configs" | "partners"YesThe dataset category to autocomplete against
inputquerystringNoInput text to autocomplete
attributequerystringYesAttribute to autocomplete in table.column format (e.g., current_purposes.name)
sizequerynumberNoMaximum number of results to return

Sample Call

epilot query autocomplete \
-p dataset=example \
-p attribute=current_purposes.name

With JSONata filter:

epilot query autocomplete -p dataset=example -p attribute=current_purposes.name --jsonata 'results[0]'
Sample Response
{
"results": ["value"]
}

workflowsAutocompleteโ€‹

Autocomplete Workflows data

GET /v2/query/workflows:autocomplete

Parameters

NameInTypeRequiredDescription
inputquerystringNoInput to autocomplete
attributequerystringYesAutocomplete attribute
sizequerynumberNoMaximum number of results to return

Sample Call

epilot query workflowsAutocomplete \
-p attribute=name

With JSONata filter:

epilot query workflowsAutocomplete -p attribute=name --jsonata 'results[0]'
Sample Response
{
"results": ["value"]
}