Skip to main content
POST
/
v1
/
org
/
{org_id}
/
team
/
{team_id}
/
{environment}
/
continuous_query
Create Continuous Query
curl --request POST \
  --url https://api.management.junction.com/v1/org/{org_id}/team/{team_id}/{environment}/continuous_query \
  --header 'Content-Type: application/json' \
  --header 'X-Management-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"
      }
    ]
  },
  "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"
      }
    ]
  },
  "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"
}

Horizon AI Query is in closed beta.Interested in the Horizon AI Query? Get in touch with your Customer Success Manager.
The base URL of this endpoint is https://api.management.junction.com/.The endpoint accepts only Management Key (X-Management-Key). Team API Key is not accepted.

Authorizations

X-Management-Key
string
header
required

Path Parameters

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

Body

application/json
slug
string
required
title
string
required
query
Query · object
required
query_config
QueryConfig · object
scheduling_preferences
ContinuousQuerySchedulingPreferences · object
export_preferences
ContinuousQueryExportPreferences · object

Response

Successful Response

id
string<uuid>
required
status
enum<string>
required
Available options:
active,
archived
slug
string
required
title
string
required
query
Query · object
required
scheduling_preferences
ContinuousQuerySchedulingPreferences · object
required
result_table_schema
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,
device_legacy,
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,
stand_hour,
stand_duration,
sleep_apnea_alert,
sleep_breathing_disturbance,
wheelchair_push,
forced_expiratory_volume_1,
forced_vital_capacity,
peak_expiratory_flow_rate,
inhaler_usage,
fall,
uv_exposure,
daylight_exposure,
handwashing,
basal_body_temperature,
heart_rate_recovery_one_minute,
body_mass_index,
lean_body_mass,
waist_circumference,
workout_distance,
workout_swimming_stroke,
workout_duration,
insulin_injection,
carbohydrates,
note,
sleep_stream,
hypnogram
export_preferences
ContinuousQueryExportPreferences · object
required
team_id
string<uuid> | null
query_config
QueryConfig · object
fhir_observation_mappers
enum<string>[]
Available options:
vital-signs#29463-7#junction-body-weight-1,
vital-signs#8867-4#junction-heart-rate-1,
vital-signs#9279-1#junction-respiration-rate-1