Query One
curl --request POST \
--url https://api.us.junction.com/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": 1
}
},
"queries": [
{
"select": [
{
"arg": {}
}
],
"group_by": [
{
"date_trunc": {
"value": 1
},
"arg": {}
}
],
"where": "<string>",
"align": {
"carry": {
"mode": "<string>",
"max_age": {
"value": 1
}
}
}
}
],
"config": {
"provider_priority_overrides": []
}
}
'import requests
url = "https://api.us.junction.com/aggregate/v1/user/{user_id}/query"
payload = {
"timeframe": {
"type": "<string>",
"anchor": "2023-12-25",
"past": { "value": 1 }
},
"queries": [
{
"select": [{ "arg": {} }],
"group_by": [
{
"date_trunc": { "value": 1 },
"arg": {}
}
],
"where": "<string>",
"align": { "carry": {
"mode": "<string>",
"max_age": { "value": 1 }
} }
}
],
"config": { "provider_priority_overrides": [] }
}
headers = {
"x-vital-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-vital-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
timeframe: {type: '<string>', anchor: '2023-12-25', past: {value: 1}},
queries: [
{
select: [{arg: {}}],
group_by: [{date_trunc: {value: 1}, arg: {}}],
where: '<string>',
align: {carry: {mode: '<string>', max_age: {value: 1}}}
}
],
config: {provider_priority_overrides: []}
})
};
fetch('https://api.us.junction.com/aggregate/v1/user/{user_id}/query', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.us.junction.com/aggregate/v1/user/{user_id}/query",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'timeframe' => [
'type' => '<string>',
'anchor' => '2023-12-25',
'past' => [
'value' => 1
]
],
'queries' => [
[
'select' => [
[
'arg' => [
]
]
],
'group_by' => [
[
'date_trunc' => [
'value' => 1
],
'arg' => [
]
]
],
'where' => '<string>',
'align' => [
'carry' => [
'mode' => '<string>',
'max_age' => [
'value' => 1
]
]
]
]
],
'config' => [
'provider_priority_overrides' => [
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-vital-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.us.junction.com/aggregate/v1/user/{user_id}/query"
payload := strings.NewReader("{\n \"timeframe\": {\n \"type\": \"<string>\",\n \"anchor\": \"2023-12-25\",\n \"past\": {\n \"value\": 1\n }\n },\n \"queries\": [\n {\n \"select\": [\n {\n \"arg\": {}\n }\n ],\n \"group_by\": [\n {\n \"date_trunc\": {\n \"value\": 1\n },\n \"arg\": {}\n }\n ],\n \"where\": \"<string>\",\n \"align\": {\n \"carry\": {\n \"mode\": \"<string>\",\n \"max_age\": {\n \"value\": 1\n }\n }\n }\n }\n ],\n \"config\": {\n \"provider_priority_overrides\": []\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-vital-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.us.junction.com/aggregate/v1/user/{user_id}/query")
.header("x-vital-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"timeframe\": {\n \"type\": \"<string>\",\n \"anchor\": \"2023-12-25\",\n \"past\": {\n \"value\": 1\n }\n },\n \"queries\": [\n {\n \"select\": [\n {\n \"arg\": {}\n }\n ],\n \"group_by\": [\n {\n \"date_trunc\": {\n \"value\": 1\n },\n \"arg\": {}\n }\n ],\n \"where\": \"<string>\",\n \"align\": {\n \"carry\": {\n \"mode\": \"<string>\",\n \"max_age\": {\n \"value\": 1\n }\n }\n }\n }\n ],\n \"config\": {\n \"provider_priority_overrides\": []\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.us.junction.com/aggregate/v1/user/{user_id}/query")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-vital-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"timeframe\": {\n \"type\": \"<string>\",\n \"anchor\": \"2023-12-25\",\n \"past\": {\n \"value\": 1\n }\n },\n \"queries\": [\n {\n \"select\": [\n {\n \"arg\": {}\n }\n ],\n \"group_by\": [\n {\n \"date_trunc\": {\n \"value\": 1\n },\n \"arg\": {}\n }\n ],\n \"where\": \"<string>\",\n \"align\": {\n \"carry\": {\n \"mode\": \"<string>\",\n \"max_age\": {\n \"value\": 1\n }\n }\n }\n }\n ],\n \"config\": {\n \"provider_priority_overrides\": []\n }\n}"
response = http.request(request)
puts response.read_body{
"results": [
{
"table": {}
}
]
}{
"detail": "<unknown>"
}Junction API
Query a single user
Post aggregate user query via the Junction API. Requires authentication with your team API key.
POST
/
aggregate
/
v1
/
user
/
{user_id}
/
query
Query One
curl --request POST \
--url https://api.us.junction.com/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": 1
}
},
"queries": [
{
"select": [
{
"arg": {}
}
],
"group_by": [
{
"date_trunc": {
"value": 1
},
"arg": {}
}
],
"where": "<string>",
"align": {
"carry": {
"mode": "<string>",
"max_age": {
"value": 1
}
}
}
}
],
"config": {
"provider_priority_overrides": []
}
}
'import requests
url = "https://api.us.junction.com/aggregate/v1/user/{user_id}/query"
payload = {
"timeframe": {
"type": "<string>",
"anchor": "2023-12-25",
"past": { "value": 1 }
},
"queries": [
{
"select": [{ "arg": {} }],
"group_by": [
{
"date_trunc": { "value": 1 },
"arg": {}
}
],
"where": "<string>",
"align": { "carry": {
"mode": "<string>",
"max_age": { "value": 1 }
} }
}
],
"config": { "provider_priority_overrides": [] }
}
headers = {
"x-vital-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-vital-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
timeframe: {type: '<string>', anchor: '2023-12-25', past: {value: 1}},
queries: [
{
select: [{arg: {}}],
group_by: [{date_trunc: {value: 1}, arg: {}}],
where: '<string>',
align: {carry: {mode: '<string>', max_age: {value: 1}}}
}
],
config: {provider_priority_overrides: []}
})
};
fetch('https://api.us.junction.com/aggregate/v1/user/{user_id}/query', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.us.junction.com/aggregate/v1/user/{user_id}/query",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'timeframe' => [
'type' => '<string>',
'anchor' => '2023-12-25',
'past' => [
'value' => 1
]
],
'queries' => [
[
'select' => [
[
'arg' => [
]
]
],
'group_by' => [
[
'date_trunc' => [
'value' => 1
],
'arg' => [
]
]
],
'where' => '<string>',
'align' => [
'carry' => [
'mode' => '<string>',
'max_age' => [
'value' => 1
]
]
]
]
],
'config' => [
'provider_priority_overrides' => [
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-vital-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.us.junction.com/aggregate/v1/user/{user_id}/query"
payload := strings.NewReader("{\n \"timeframe\": {\n \"type\": \"<string>\",\n \"anchor\": \"2023-12-25\",\n \"past\": {\n \"value\": 1\n }\n },\n \"queries\": [\n {\n \"select\": [\n {\n \"arg\": {}\n }\n ],\n \"group_by\": [\n {\n \"date_trunc\": {\n \"value\": 1\n },\n \"arg\": {}\n }\n ],\n \"where\": \"<string>\",\n \"align\": {\n \"carry\": {\n \"mode\": \"<string>\",\n \"max_age\": {\n \"value\": 1\n }\n }\n }\n }\n ],\n \"config\": {\n \"provider_priority_overrides\": []\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-vital-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.us.junction.com/aggregate/v1/user/{user_id}/query")
.header("x-vital-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"timeframe\": {\n \"type\": \"<string>\",\n \"anchor\": \"2023-12-25\",\n \"past\": {\n \"value\": 1\n }\n },\n \"queries\": [\n {\n \"select\": [\n {\n \"arg\": {}\n }\n ],\n \"group_by\": [\n {\n \"date_trunc\": {\n \"value\": 1\n },\n \"arg\": {}\n }\n ],\n \"where\": \"<string>\",\n \"align\": {\n \"carry\": {\n \"mode\": \"<string>\",\n \"max_age\": {\n \"value\": 1\n }\n }\n }\n }\n ],\n \"config\": {\n \"provider_priority_overrides\": []\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.us.junction.com/aggregate/v1/user/{user_id}/query")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-vital-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"timeframe\": {\n \"type\": \"<string>\",\n \"anchor\": \"2023-12-25\",\n \"past\": {\n \"value\": 1\n }\n },\n \"queries\": [\n {\n \"select\": [\n {\n \"arg\": {}\n }\n ],\n \"group_by\": [\n {\n \"date_trunc\": {\n \"value\": 1\n },\n \"arg\": {}\n }\n ],\n \"where\": \"<string>\",\n \"align\": {\n \"carry\": {\n \"mode\": \"<string>\",\n \"max_age\": {\n \"value\": 1\n }\n }\n }\n }\n ],\n \"config\": {\n \"provider_priority_overrides\": []\n }\n}"
response = http.request(request)
puts response.read_body{
"results": [
{
"table": {}
}
]
}{
"detail": "<unknown>"
}Junction Sense is in closed beta.Interested in Junction Sense? Get in touch with your Customer Success Manager.
Receiving data in JSON
Receiving data in JSON
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.{
"results": [
{
"table": {
"index": [...],
"min": [...],
"max": [...],
"mean": [...],
"newest": [...]
}
}
]
}
Receiving data in Parquet
Receiving data in Parquet
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
Successful Response
Show child attributes
Show child attributes
Was this page helpful?
⌘I