POST
/
v1
/
org
/
{org_id}
/
team
/
{team_id}
/
{environment}
/
continuous_query
curl --request POST \
  --url https://api.tryvital.io/management/v1/org/{org_id}/team/{team_id}/{environment}/continuous_query \
  --header 'Content-Type: application/json' \
  --header 'X-Vital-Org-Key: <api-key>' \
  --data '{
  "export_preferences": {
    "data_events": {
      "enabled": true
    }
  },
  "query": {
    "group_by": [
      {
        "arg": {
          "index": "sleep"
        },
        "date_trunc": {
          "unit": "month",
          "value": 1
        }
      }
    ],
    "select": [
      {
        "group_key": "*"
      },
      {
        "arg": {
          "value_macro": "sleep_score",
          "version": "automatic"
        },
        "func": "mean"
      }
    ],
    "split_by_source": false
  },
  "query_config": {
    "provider_priority_overrides": [
      "oura"
    ]
  },
  "scheduling_preferences": {
    "minimum_gap_duration_second": 3600
  },
  "slug": "weekly_mean_sleep_score",
  "title": "Weekly Mean Sleep Score"
}'
{
  "export_preferences": {
    "data_events": {
      "enabled": true
    }
  },
  "id": "d25f4472-c679-4e7a-9442-2bce8c12afb1",
  "query": {
    "group_by": [
      {
        "arg": {
          "index": "sleep"
        },
        "date_trunc": {
          "unit": "month",
          "value": 1
        }
      }
    ],
    "select": [
      {
        "group_key": "*"
      },
      {
        "arg": {
          "value_macro": "sleep_score",
          "version": "automatic"
        },
        "func": "mean"
      }
    ],
    "split_by_source": false
  },
  "query_config": {
    "provider_priority_overrides": [
      "oura"
    ]
  },
  "resource_dependencies": [
    "sleep"
  ],
  "result_table_schema": {
    "group_key.0": "string",
    "sleep_score": "int64"
  },
  "scheduling_preferences": {
    "minimum_gap_duration_second": 3600
  },
  "slug": "weekly_mean_sleep_score",
  "title": "Weekly Mean Sleep Score"
}

Org Management API is available for the Scale plan.

The base URL of this endpoint is https://api.tryvital.io/management/.

The endpoint accepts only Org Key (X-Vital-Org-Key). Team API Key is not applicable.

Continuous Query is currently in closed beta. The query schema and the behaviour is subject to change based on beta feedback.

Authorizations

X-Vital-Org-Key
string
header
required

Path Parameters

org_id
string
required
team_id
string
required
environment
enum<string>
required
Available options:
production,
sandbox

Body

application/json
slug
string
required
title
string
required
query
object
required
query_config
object
scheduling_preferences
object
export_preferences
object
fhir_observation_mappers
enum<string>[]
Available options:
vital-signs#40443-4#junction-heart-rate-resting-1,
placeholder

Response

200
application/json
Successful Response
id
string
required
slug
string
required
title
string
required
query
object
required
scheduling_preferences
object
required
export_preferences
object
required
result_table_schema
object
required
resource_dependencies
enum<string>[]
required
Available options:
profile,
activity,
sleep,
body,
workouts,
workout_stream,
connection,
order,
result,
appointment,
glucose,
heartrate,
hrv,
hrv,
ige,
igg,
blood_oxygen,
blood_pressure,
cholesterol,
device,
weight,
fat,
body_temperature,
body_temperature_delta,
meal,
water,
caffeine,
mindfulness_minutes,
steps,
calories_active,
distance,
floors_climbed,
respiratory_rate,
vo2_max,
calories_basal,
stress_level,
menstrual_cycle,
sleep_cycle,
electrocardiogram,
electrocardiogram_voltage,
afib_burden,
heart_rate_alert,
workout_duration,
insulin_injection,
carbohydrates,
note,
sleep_stream,
hypnogram
query_config
object
fhir_observation_mappers
enum<string>[]
Available options:
vital-signs#40443-4#junction-heart-rate-resting-1,
placeholder