Invalid parameters for GET Metrics endpoint.
Hey devs! I am using this SDK for educational purposes, and I realized that one of the endpoints named GET metrics doesn't have the correct set of parameters listed in the README. After making an API request using Python and PowerShell, I received errors as responses.
For Python
The error
openapi_client.exceptions.BadRequestException: (400)
Reason: Bad Request
HTTP response headers: HTTPHeaderDict({'Date': 'Sat, 08 Mar 2025 07:47:33 GMT', 'Content-Type': 'application/vnd.api+json', 'Content-Length': '276', 'Connection': 'keep-alive', 'Allow': 'GET, POST, HEAD, OPTIONS', 'CID': 'UUM8uE', 'Content-Language': 'en-us', 'Content-Security-Policy': "base-uri 'none'; object-src 'none'; frame-ancestors 'self' login.bigcommerce.com *.mybigcommerce.com admin.shopify.com klaviyo.file.force.com klaviyo.lightning.force.com klaviyo.my.salesforce.com; script-src 'report-sample' 'strict-dynamic' 'unsafe-eval'; report-uri /csp/", 'RateLimit-Limit': '10, 10;w=1, 150;w=60', 'RateLimit-Remaining': '9', 'RateLimit-Reset': '0', 'Vary': 'Accept, Accept-Language, Cookie', 'X-Klaviyo-API-Revision': '2025-01-15', 'X-Robots-Tag': 'noindex, nofollow', 'cf-cache-status': 'DYNAMIC', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains; preload', 'X-Content-Type-Options': 'nosniff', 'Server': 'cloudflare', 'CF-RAY': '91d0b9a5d9e34226-BOM'})
HTTP response body: errors=[GetAccounts4XXResponseErrorsInner(id='4d7b12e5-c4f3-4fa4-b1d3-3a05dc958d04', code='invalid', title='Invalid input.', detail="'flow' is not an allowed field family for this resource. Allowed field families are flow, metric.", source=GetAccounts4XXResponseErrorsInnerSource(pointer=None, parameter='fields'))]
For Powershell
The Request
$headers=@{}
>> $headers.Add("accept", "application/vnd.api+json")
>> $headers.Add("revision", "2025-01-15")
>> $headers.Add("Authorization", "Klaviyo-API-Key ")
>> $response = Invoke-WebRequest -Uri "https://a.klaviyo.com/api/metrics?fields[flow]=name" -Method GET -Headers $headers
Invoke-WebRequest:
Line |
5 | $response = Invoke-WebRequest -Uri "https://a.klaviyo.com/api/metrics …
The Error
{"errors":[{"id":"1e858826-ba42-451e-ab05-03516de02e4d","status":400,"code":"invalid","title":"Invalid input.","detail":"'flow' is not an allowed field family for this resource. Allowed field families are flow, metric.","source":{"parameter":"fields"},"links":{},"meta":{}}]}
The response says that flow is the parameter to be used inplace of fields_flow but if you make a request using flow then too it shows that the parameter is invalid. Which parameter should I pass on fields_flow or flow?. Please do look into this.
Hi there, thank you for reaching out, we will investigate this.
IMPORTANT: Please regenerate the private key in your post, and update your post to redact it.