returnsAnalytics
Requires an authenticated session.
Returns analytics for a date range: the return rate, total return value, breakdowns by reason and by product, and the credit note value. The range is required and limited to 400 days.
Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.
Example:
- GraphQL
- cURL
query ReturnsAnalytics($range: AnalyticsRangeInput!) {
returnsAnalytics(range: $range) {
creditNoteValue
returnRatePct
totalReturnValue
byProduct {
productName
count
value
}
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "query ReturnsAnalytics($range: AnalyticsRangeInput!) {\n returnsAnalytics(range: $range) {\n creditNoteValue\n returnRatePct\n totalReturnValue\n byProduct {\n productName\n count\n value\n }\n }\n}",
"variables": {
"range": {
"from": "2025-01-15T00:00:00Z",
"to": "2025-01-15T00:00:00Z"
}
}
}
EOF
Variables:
{
"range": {
"from": "2025-01-15T00:00:00Z",
"to": "2025-01-15T00:00:00Z"
}
}
Response:
{
"data": {
"returnsAnalytics": {
"creditNoteValue": 0,
"returnRatePct": 0,
"totalReturnValue": 0,
"byProduct": [
{
"productName": "string",
"count": 0,
"value": 0
}
]
}
}
}
returnsAnalytics(
range: AnalyticsRangeInput!
): ReturnsAnalytics!
Arguments
returnsAnalytics.range ● AnalyticsRangeInput! non-null input
The date range to report on.
Type
ReturnsAnalytics object
How many goods came back.