Horizon AI Query DSL
Horizon AI Python SDK
Managing Continuous Query
Continuous Query Task History
Continuous Query Results
Query API
Query API
Query a single user
POST
/
aggregate
/
v1
/
user
/
{user_id}
/
query
Copy
Ask AI
curl --request POST \
--url https://api.tryvital.io/aggregate/v1/user/{user_id}/query \
--header 'Content-Type: application/json' \
--header 'x-vital-api-key: <api-key>' \
--data '{
"timeframe": {
"type": "<string>",
"anchor": "2023-12-25",
"past": {
"value": 2,
"unit": "minute"
}
},
"queries": [
{
"select": [
{
"arg": {
"sleep": "session_start"
},
"func": "mean"
}
],
"group_by": [
{
"date_trunc": {
"value": 2,
"unit": "minute"
},
"arg": {
"index": "sleep"
}
}
]
}
],
"config": {
"provider_priority_overrides": [
"oura"
]
}
}'
Copy
Ask AI
{
"results": [
{
"table": {}
}
]
}
Horizon AI Query is in closed beta.
Interested in the Horizon AI Query? Get in touch with your Customer Success Manager.
JSON is the default output format. Each query instruction outputs one entry containing a dataframe to the $.results
array,
in the declaration order of the query instructions.
Copy
Ask AI
{
"results": [
"table": {
"index": [...],
"min": [...],
"max": [...],
"mean": [...],
"newest": [...]
}
]
}
Specify Accept: application/vnd.vital.tar+gzip+parquet
in your request header.
The response body is a gzipped Tarball of multiple Parquet files, namely 0.parquet
, 1.parquet
, 2.parquet
, etc.
The numbering corresponds to the declaration order of the query instructions.
Authorizations
Vital Team API Key
Headers
Available options:
*/*
, application/json
, application/vnd.vital.tar+gzip+parquet
Path Parameters
Body
application/json
Response
200
application/json
Successful Response
The response is of type object
.
Copy
Ask AI
curl --request POST \
--url https://api.tryvital.io/aggregate/v1/user/{user_id}/query \
--header 'Content-Type: application/json' \
--header 'x-vital-api-key: <api-key>' \
--data '{
"timeframe": {
"type": "<string>",
"anchor": "2023-12-25",
"past": {
"value": 2,
"unit": "minute"
}
},
"queries": [
{
"select": [
{
"arg": {
"sleep": "session_start"
},
"func": "mean"
}
],
"group_by": [
{
"date_trunc": {
"value": 2,
"unit": "minute"
},
"arg": {
"index": "sleep"
}
}
]
}
],
"config": {
"provider_priority_overrides": [
"oura"
]
}
}'
Copy
Ask AI
{
"results": [
{
"table": {}
}
]
}
Assistant
Responses are generated using AI and may contain mistakes.