I see that this question has been asked a few time, but the answers were a little general. I was wondering exactly which endpoint will allow me to pull conversions and conversion values for campaigns and flows?
Is there an endpoint that will allow me to pull campaign metrics directly? Or is there a more indirect way of achieving this?
I know there is no direct API for flows, so I would hit the lists API first to get email ID’s associated with each flow and then cross reference with timeline? Which event should I be cross referencing with?
Page 1 / 1
Hello@ppcorp,
Wonderful question!
You can actually utilize Klaviyo’s /export endpoint as part of the Metric’s API while leveraging the ID of your conversion metric within your account to return both your campaign and flow revenue via API.
In the request, you'd also want to specify in the "measurement" parameter that you're specifically looking for the "value", which returns the amount of revenue, and also specify in the "where" filter the campaign ID that the metric is attributed to with "$attributed_message". When calling for a flow’s conversion data, you’ll want to use the flow ID that the metric is attributed to with “$attributed_flow” instead.
Thank you for that explanation, that was a huge help. I now can get the campaign metrics by message ID. What endpoint can I hit to get a list of available flows?
Thanks!
Joe
Hey @ppcorp,
Glad that was helpful!
Although undocumented, you can use the a.klaviyo.com/api/v1/flows?api_key=****** endpoint to return a list of flows in your Klaviyo account. Some other hidden endpoints related to flows that may prove helpful are:
Single flow: https://a.klaviyo.com/api/v1/flow/FLOW_ID?api_key=******
Single flow with actions: https://a.klaviyo.com/api/v1/flow/FLOW_ID/actions?api_key=******
Single action from a flow: https://a.klaviyo.com/api/v1/flow/FLOW_ID/action/ACTION_ID?api_key=******
Email that was used for flow action of sending email: https://a.klaviyo.com/api/v1/flow/FLOW_ID/action/ACTION_ID/email?api_key=******
Have a great day!
David
hi @David To i am trying to use this but even when the call is successfully done the answer is giving me all 0 cero values , even when i know that those flows ids or messages id have values
Technically speaking that value response of [0.0] you are seeing is actually correct. This is because when trying to make a call for the Clicked Email metric, that metric doesn’t record a value as a measurement. Instead, you’ll want to define the measurement as unique or count. Similarly, instead of defining the where parameter as $attributed_flow, you’ll want to use either $flow or $message depending on what your goal was.
Overall, it doesn’t seem like you’ve structured the call correctly to align with the specific metric you were trying to query for but rather kept a number of the parameters the same as the ones used to retrieve conversion (Placed order/revenue) data. I would suggest taking a further look at our Query Event Data and Native Klaviyo Metrics & Attributes references in the Developer’s Portal for a better understanding on how to structure these calls based on individual metrics.
You can also find an example call structure to retrieve the the number of clicks in the Unique Clicks (unique_clicks) section of the How to Export Conversion Data Help Center article previously provided which I’ve also included below:
Although undocumented, you can use the a.klaviyo.com/api/v1/flows?api_key=****** endpoint to return a list of flows in your Klaviyo account. Some other hidden endpoints related to flows that may prove helpful are:
Single flow: https://a.klaviyo.com/api/v1/flow/FLOW_ID?api_key=******
Single flow with actions: https://a.klaviyo.com/api/v1/flow/FLOW_ID/actions?api_key=******
Single action from a flow: https://a.klaviyo.com/api/v1/flow/FLOW_ID/action/ACTION_ID?api_key=******
Email that was used for flow action of sending email: https://a.klaviyo.com/api/v1/flow/FLOW_ID/action/ACTION_ID/email?api_key=******
Have a great day!
David
Hi David,
I’m trying to get a simple dump of flow ids and names… running:
a.klaviyo.com/api/v1/flows?api_key=******
now errors with:
{
"status": 400,
"message": "This request is missing the following required params: \"name\"."
}
other suggestions?
Thanks in advance!
Team Cohley!
GET… not a POST… got it…. now it works!
@David To thanks for sharing the non-documented flow API!
Is there a way to get the email html for flow actions via the API? Some ID I can grab from these Flow APIs and pass to the template API or something else?
Thanks,
Daniel
Hey @daniellanger,
This currently is a limitation pertaining to the undocumented flows V1 endpoint. Since our Product Team is looking for feedback as they actively work to introduce V3 of our API endpoint, I’ll share your use case and details with them! I know that from speaking to that team that improving upon these originally undocumented Flows V1 endpoint was a big focus for them.
If you haven’t already, you can also sign up to be an early beta tester of the V3 API endpoints and uncover some of these new improvements by joining our V3 API Beta List here.