curl --request POST \
--url https://app.goosybear.ai/api/v1/tools/analytics.query_metrics \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"metric_keys": [],
"from": "<string>",
"to": "<string>",
"compare": true,
"workspace": "<string>"
}
'import requests
url = "https://app.goosybear.ai/api/v1/tools/analytics.query_metrics"
payload = {
"metric_keys": [],
"from": "<string>",
"to": "<string>",
"compare": True,
"workspace": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
metric_keys: [],
from: '<string>',
to: '<string>',
compare: true,
workspace: '<string>'
})
};
fetch('https://app.goosybear.ai/api/v1/tools/analytics.query_metrics', 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://app.goosybear.ai/api/v1/tools/analytics.query_metrics",
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([
'metric_keys' => [
],
'from' => '<string>',
'to' => '<string>',
'compare' => true,
'workspace' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://app.goosybear.ai/api/v1/tools/analytics.query_metrics"
payload := strings.NewReader("{\n \"metric_keys\": [],\n \"from\": \"<string>\",\n \"to\": \"<string>\",\n \"compare\": true,\n \"workspace\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://app.goosybear.ai/api/v1/tools/analytics.query_metrics")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"metric_keys\": [],\n \"from\": \"<string>\",\n \"to\": \"<string>\",\n \"compare\": true,\n \"workspace\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.goosybear.ai/api/v1/tools/analytics.query_metrics")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"metric_keys\": [],\n \"from\": \"<string>\",\n \"to\": \"<string>\",\n \"compare\": true,\n \"workspace\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"ok": true,
"window": {
"from": "<string>",
"to": "<string>",
"label": "<string>"
},
"previous_window": {
"from": "<string>",
"to": "<string>",
"label": "<string>"
},
"grain": "<string>",
"definition_version": 123,
"min_delta_periods": 123,
"metrics": [
{
"key": "<string>",
"label": "<string>",
"module": "<string>",
"formula": "<string>",
"source": "<string>",
"provenance": "<string>",
"aggregation": "<string>",
"definition_version": 123,
"is_directional": true,
"honesty_note": "<string>",
"floor": {
"kind": "<string>",
"threshold": 123
},
"recompute_required": true,
"current": {
"value": 123,
"display": "<string>",
"row_count": 1,
"currency_code": "<string>",
"store": "metric_rollups",
"suppressed": "<string>"
},
"previous": {
"value": 123,
"display": "<string>",
"row_count": 1,
"currency_code": "<string>",
"store": "metric_rollups",
"suppressed": "<string>"
},
"change": {
"absolute": 123,
"percent": 123
},
"change_unavailable": "<string>",
"state": "reported"
}
],
"all_empty": true,
"answer_note": "<string>",
"workspace": "<string>",
"working_in": {
"label": "<string>",
"note": "<string>",
"workspace": "<string>",
"source": "call-override"
}
}{
"ok": false,
"code": "<string>",
"message": "<string>",
"error": {
"code": "<string>",
"message": "<string>",
"retry_after_seconds": 123
},
"retry_after_seconds": 123
}{
"ok": false,
"code": "<string>",
"message": "<string>",
"error": {
"code": "<string>",
"message": "<string>",
"retry_after_seconds": 123
},
"retry_after_seconds": 123
}{
"ok": false,
"code": "<string>",
"message": "<string>",
"error": {
"code": "<string>",
"message": "<string>",
"retry_after_seconds": 123
},
"retry_after_seconds": 123
}{
"ok": false,
"code": "<string>",
"message": "<string>",
"error": {
"code": "<string>",
"message": "<string>",
"retry_after_seconds": 123
},
"retry_after_seconds": 123
}{
"ok": false,
"code": "<string>",
"message": "<string>",
"error": {
"code": "<string>",
"message": "<string>",
"retry_after_seconds": 123
},
"retry_after_seconds": 123
}Call analytics.query_metrics
‘how many visitors did we get last week?’, ‘what’s our conversion rate?’ — read this workspace’s analytics numbers over a window: the same figures, from the same reads, the analytics pages show. Name dictionary keys (analytics.list_available_metrics lists them) and a preset period or an explicit from/to; set compare to also read the preceding window. Every row carries a state: empty is a final answer, read_failed means nothing is known, and suppressed means a small-count privacy floor withholds the figure. It changes nothing. Not for which metrics exist or report here — that is analytics.list_available_metrics.
Every result names the workspace it ran in. Say which workspace the answer is about. When the account has more than one workspace and none is selected, this tool refuses with workspace_ambiguous and lists the choices — offer them, never pick one.
curl --request POST \
--url https://app.goosybear.ai/api/v1/tools/analytics.query_metrics \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"metric_keys": [],
"from": "<string>",
"to": "<string>",
"compare": true,
"workspace": "<string>"
}
'import requests
url = "https://app.goosybear.ai/api/v1/tools/analytics.query_metrics"
payload = {
"metric_keys": [],
"from": "<string>",
"to": "<string>",
"compare": True,
"workspace": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
metric_keys: [],
from: '<string>',
to: '<string>',
compare: true,
workspace: '<string>'
})
};
fetch('https://app.goosybear.ai/api/v1/tools/analytics.query_metrics', 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://app.goosybear.ai/api/v1/tools/analytics.query_metrics",
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([
'metric_keys' => [
],
'from' => '<string>',
'to' => '<string>',
'compare' => true,
'workspace' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://app.goosybear.ai/api/v1/tools/analytics.query_metrics"
payload := strings.NewReader("{\n \"metric_keys\": [],\n \"from\": \"<string>\",\n \"to\": \"<string>\",\n \"compare\": true,\n \"workspace\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://app.goosybear.ai/api/v1/tools/analytics.query_metrics")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"metric_keys\": [],\n \"from\": \"<string>\",\n \"to\": \"<string>\",\n \"compare\": true,\n \"workspace\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.goosybear.ai/api/v1/tools/analytics.query_metrics")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"metric_keys\": [],\n \"from\": \"<string>\",\n \"to\": \"<string>\",\n \"compare\": true,\n \"workspace\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"ok": true,
"window": {
"from": "<string>",
"to": "<string>",
"label": "<string>"
},
"previous_window": {
"from": "<string>",
"to": "<string>",
"label": "<string>"
},
"grain": "<string>",
"definition_version": 123,
"min_delta_periods": 123,
"metrics": [
{
"key": "<string>",
"label": "<string>",
"module": "<string>",
"formula": "<string>",
"source": "<string>",
"provenance": "<string>",
"aggregation": "<string>",
"definition_version": 123,
"is_directional": true,
"honesty_note": "<string>",
"floor": {
"kind": "<string>",
"threshold": 123
},
"recompute_required": true,
"current": {
"value": 123,
"display": "<string>",
"row_count": 1,
"currency_code": "<string>",
"store": "metric_rollups",
"suppressed": "<string>"
},
"previous": {
"value": 123,
"display": "<string>",
"row_count": 1,
"currency_code": "<string>",
"store": "metric_rollups",
"suppressed": "<string>"
},
"change": {
"absolute": 123,
"percent": 123
},
"change_unavailable": "<string>",
"state": "reported"
}
],
"all_empty": true,
"answer_note": "<string>",
"workspace": "<string>",
"working_in": {
"label": "<string>",
"note": "<string>",
"workspace": "<string>",
"source": "call-override"
}
}{
"ok": false,
"code": "<string>",
"message": "<string>",
"error": {
"code": "<string>",
"message": "<string>",
"retry_after_seconds": 123
},
"retry_after_seconds": 123
}{
"ok": false,
"code": "<string>",
"message": "<string>",
"error": {
"code": "<string>",
"message": "<string>",
"retry_after_seconds": 123
},
"retry_after_seconds": 123
}{
"ok": false,
"code": "<string>",
"message": "<string>",
"error": {
"code": "<string>",
"message": "<string>",
"retry_after_seconds": 123
},
"retry_after_seconds": 123
}{
"ok": false,
"code": "<string>",
"message": "<string>",
"error": {
"code": "<string>",
"message": "<string>",
"retry_after_seconds": 123
},
"retry_after_seconds": 123
}{
"ok": false,
"code": "<string>",
"message": "<string>",
"error": {
"code": "<string>",
"message": "<string>",
"retry_after_seconds": 123
},
"retry_after_seconds": 123
}Authorizations
An API key minted at Settings › API & MCP. Send it as Authorization: Bearer <key>. A key carries its holder's own permissions, resolved on every call — revoking a membership closes the key's reach immediately. Keep it in an environment variable (GOOSY_API_KEY), never in a committed file.
Headers
Your own id for this request, echoed back and recorded on the audit trail. 1–128 characters from A–Z a–z 0–9 . _ : -, starting with a letter or digit; anything else is replaced by a generated id.
128Body
Dictionary metric keys to read. Use analytics.list_available_metrics to discover them.
1 - 12 elementsrev_leads, rev_booked_calls, rev_calls_showed, rev_show_rate, rev_sales_won, rev_revenue_won, rev_revenue_by_source, rev_open_pipeline_value, email_sent, email_delivered, email_delivery_rate, email_opened, email_open_rate, email_clicked, email_click_rate, email_replied, email_complaint_rate, email_bounce_rate, list_size, list_new_subscribers, list_unsubscribe_rate, ads_spend, ads_impressions, ads_clicks, ads_ctr, ads_cpc, ads_cpm, ads_reach, ads_frequency, ads_conversions, ads_cost_per_lead, ads_cost_per_booked_call, ads_attributed_revenue, vid_views, vid_watch_time_minutes, vid_avg_view_duration, vid_impressions, vid_impressions_ctr, vid_subscribers_gained, vid_net_subscribers, vid_breakout_score, soc_posts_published, soc_impressions, soc_engagements, soc_engagement_rate, soc_meta_impressions, soc_meta_engagements, soc_meta_engagement_rate, soc_fb_impressions, soc_fb_engagements, soc_fb_engagement_rate, soc_ig_impressions, soc_ig_reach, soc_ig_engagements, soc_ig_engagement_rate, soc_ig_profile_visits, soc_ig_new_follows, sys_produced, hyros_attributed_revenue, hyros_attributed_leads, web_sessions, web_active_users, web_conversions, web_revenue, web_search_impressions, web_search_clicks, web_search_ctr, web_search_position A preset window of whole COMPLETE periods ending at the start of the current one: 7d = the last 7 complete days (today is excluded), 28d = the last 4 complete weeks, 90d = the last 3 complete calendar months (92 days on a May-Aug read, not 90). Omit when supplying from/to.
7d, 28d, 90d Window start, ISO-8601 date or timestamp. Inclusive. Requires to.
Window end, ISO-8601 date or timestamp. EXCLUSIVE.
Granularity the stored rows are read at. LEAVE THIS UNSET unless you have a specific reason: day is where the analytics store is written, and asking for a coarser grain reads a different set of rows that is usually empty. A window is summed from day rows regardless of how long it is, so a month-long window does NOT need grain=month.
hour, day, week, month, quarter, year, lifetime Also read the immediately preceding window of the same number of COMPLETE periods, for a like-for-like comparison. On a preset that is a calendar step, so the preceding window holds the same number of weeks or months — not necessarily the same number of days.
Which workspace to run in — its slug. Omit to use your default. With more than one reachable workspace and no default, the call is refused and the choices are listed.
1Response
The call was admitted and dispatched. ok says whether the tool succeeded — a refusal the tool itself produced is still a 200, exactly as it is a successful JSON-RPC result over MCP.
- Option 1
- Option 2
The tool ran and answered.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
The slug of the workspace this call ran in.
Which workspace this call ran in, and how that was decided. Present on every workspace-scoped result.
Show child attributes
Show child attributes