tanqoryExtAnalyticsSales
- Query
- Apps and platform
Sales of the store's orders processed in [since, until), and of [compareSince, compareUntil) as previous when both are given. Test and cancelled orders are left out. series buckets the period by granularity (default DAY) in the store's time zone, empty buckets included. Amounts are in the store currency.
Arguments
| Argument | Type | Required | Default |
|---|---|---|---|
compareSince | DateTime | Optional | |
compareUntil | DateTime | Optional | |
currencyCode | String | Optional | |
granularity | TanqoryExtAnalyticsGranularity | Optional | |
since | DateTime! | Required | |
until | DateTime! | Required |
Returns
| Field | Type | Description |
|---|---|---|
currencyCode | CurrencyCode! | The currency of the amounts: the argument, or the store currency when there is no exchange rate for it. |
current | TanqoryExtAnalyticsPeriod! | |
exchangeRate | String | The rate the amounts were converted at (store currency to currencyCode). Null when they are in the store currency. |
granularity | TanqoryExtAnalyticsGranularity! | |
previous | TanqoryExtAnalyticsPeriod | |
timezone | String! | The store's IANA time zone the buckets are cut in. |
Example request
A starting point: required arguments as variables and a few fields of the result. Replace the placeholders.
Set STORE_ID and TANQORY_ACCESS_TOKEN in your environment first (Make your first API call).
curl -X POST "https://api.tanqory.com/admin/2026-10/stores/$STORE_ID/graphql" \
-H "Authorization: Bearer $TANQORY_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
--data '{"query":"query TanqoryExtAnalyticsSales($since: DateTime!, $until: DateTime!) {\n tanqoryExtAnalyticsSales(since: $since, until: $until) {\n currencyCode\n exchangeRate\n granularity\n timezone\n }\n}","variables":{"since":"","until":""}}'// Node.js 18 or later (fetch is built in). Save as request.mjs and run: node request.mjs
const query = `query TanqoryExtAnalyticsSales(\$since: DateTime!, \$until: DateTime!) {
tanqoryExtAnalyticsSales(since: \$since, until: \$until) {
currencyCode
exchangeRate
granularity
timezone
}
}`;
const variables = {
"since": "",
"until": ""
};
const res = await fetch(`https://api.tanqory.com/admin/2026-10/stores/${process.env.STORE_ID}/graphql`, {
method: 'POST',
headers: {
'Authorization': 'Bearer ' + process.env.TANQORY_ACCESS_TOKEN,
'Content-Type': 'application/json',
},
body: JSON.stringify({ query, variables }),
});
console.log(res.status, JSON.stringify(await res.json(), null, 2));# Python 3, standard library only. Save as request.py and run: python3 request.py
import json, os, urllib.request
query = """query TanqoryExtAnalyticsSales($since: DateTime!, $until: DateTime!) {
tanqoryExtAnalyticsSales(since: $since, until: $until) {
currencyCode
exchangeRate
granularity
timezone
}
}"""
variables = json.loads("""{
"since": "",
"until": ""
}""")
req = urllib.request.Request(
"https://api.tanqory.com/admin/2026-10/stores/" + os.environ["STORE_ID"] + "/graphql",
data=json.dumps({"query": query, "variables": variables}).encode(),
headers={
"Authorization": "Bearer " + os.environ["TANQORY_ACCESS_TOKEN"],
"Content-Type": "application/json",
},
)
with urllib.request.urlopen(req) as res:
print(res.status, json.dumps(json.load(res), indent=2))