Execute query
Execute an analytics query against a client's data. Supports aggregations, filters, grouping, and time-series analysis. Requires admin authentication.
curl -X POST "https://api.mythic-analytics.com/api/v1/query" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"client_id": "acme-retail",
"metric": "page_views",
"dimensions": [
"day",
"country"
],
"filters": {
"url_contains": "/products",
"country": "US"
},
"period": "24h",
"from": "2024-12-25T10:00:00Z",
"to": "2024-12-25T10:00:00Z",
"limit": 42
}'
import requests
import json
url = "https://api.mythic-analytics.com/api/v1/query"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN"
}
data = {
"client_id": "acme-retail",
"metric": "page_views",
"dimensions": [
"day",
"country"
],
"filters": {
"url_contains": "/products",
"country": "US"
},
"period": "24h",
"from": "2024-12-25T10:00:00Z",
"to": "2024-12-25T10:00:00Z",
"limit": 42
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://api.mythic-analytics.com/api/v1/query", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN"
},
body: JSON.stringify({
"client_id": "acme-retail",
"metric": "page_views",
"dimensions": [
"day",
"country"
],
"filters": {
"url_contains": "/products",
"country": "US"
},
"period": "24h",
"from": "2024-12-25T10:00:00Z",
"to": "2024-12-25T10:00:00Z",
"limit": 42
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"client_id": "acme-retail",
"metric": "page_views",
"dimensions": [
"day",
"country"
],
"filters": {
"url_contains": "/products",
"country": "US"
},
"period": "24h",
"from": "2024-12-25T10:00:00Z",
"to": "2024-12-25T10:00:00Z",
"limit": 42
}`)
req, err := http.NewRequest("POST", "https://api.mythic-analytics.com/api/v1/query", bytes.NewBuffer(data))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer YOUR_API_TOKEN")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
require 'net/http'
require 'json'
uri = URI('https://api.mythic-analytics.com/api/v1/query')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Content-Type'] = 'application/json'
request['Authorization'] = 'Bearer YOUR_API_TOKEN'
request.body = '{
"client_id": "acme-retail",
"metric": "page_views",
"dimensions": [
"day",
"country"
],
"filters": {
"url_contains": "/products",
"country": "US"
},
"period": "24h",
"from": "2024-12-25T10:00:00Z",
"to": "2024-12-25T10:00:00Z",
"limit": 42
}'
response = http.request(request)
puts response.body
{
"success": true,
"data": {
"columns": [
"day",
"page_views"
],
"rows": [
[
"2024-06-15",
1420
],
[
"2024-06-16",
1385
]
],
"total": 30
}
}
{
"error": "Bad Request",
"message": "The request contains invalid parameters or malformed data",
"code": 400,
"details": [
{
"field": "email",
"message": "Invalid email format"
}
]
}
{
"error": "Unauthorized",
"message": "Authentication required. Please provide a valid API token",
"code": 401
}
/query
Admin API key as bearer token. Format: Bearer YOUR_ADMIN_KEY
Bearer YOUR_ADMIN_KEYAlternative to the Authorization header for server-to-server scenarios.
The media type of the request body
Client identifier to query data for.
Metric to aggregate (e.g., page_views, unique_visitors, events).
Dimensions to group results by.
Key-value filters to narrow query scope.
Time period. Default: 30d.
Custom period start (required when period is custom).
Custom period end (required when period is custom).
Maximum number of result rows. Default 1000.
Request Preview
Response
Response will appear here after sending the request
Authentication
Bearer token. Admin API key as bearer token. Format: Bearer YOUR_ADMIN_KEY
API Key for authentication. Alternative to the Authorization header for server-to-server scenarios.
Body
Client identifier to query data for.
Metric to aggregate (e.g., page_views, unique_visitors, events).
Dimensions to group results by.
Key-value filters to narrow query scope.
Custom period start (required when period is custom).
Custom period end (required when period is custom).
Maximum number of result rows. Default 1000.
Responses
Column names in the result set.
Result rows as arrays of values.
Total rows matching the query (before limit).
Last updated Feb 26, 2026
Built with Documentation.AI