Skip to main content
Active Contributor II
October 12, 2022
Solved

Where can I get Revenue Data in the API?

  • October 12, 2022
  • 4 replies
  • 886 views

Hi!

I was wondering if it was possible to get Revenue data through the endpoint Query Event Data? https://developers.klaviyo.com/en/reference/metric-export If not, is there another endpoint through which it is available?

I use this endpoint to get data for all other metrics (ex: number of Clicked Emails, Opened Emails, etc).

And when I look at the glossary https://help.klaviyo.com/hc/en-us/articles/360037957832-Analytics-Glossary#r15, there are Revenue metrics that would be interesting to get.

 

Thank you!

    This topic has been closed for replies.
    Best answer by David To

    Hello @Nymesia,

    I would suggest checking out our How to Export Conversion Data Help Center if you haven’t already. Oftentimes, revenue is not actually a metric (unless it was custom coded). Rather, revenue is a calculation based on the value of a specific metric such as a Placed Order event/metric.

    As highlighted in the Revenue subsection; you can calculate revenue based on your desired measurement  of a specific event value using something like the below:

    curl https://a.klaviyo.com/api/v1/metric/PLACEDORDERMETRIC/export -G \
    -d api_key=API_KEY \
    -d unit='week' \
    -d measurement='value' \
    -d where='[["$attributed_message","=",'MESSAGE_ID']]'

    You may also find this Community post which I’ve commented on below helpful:

    David

    4 replies

    David To
    Klaviyo Employee
    David ToAnswer
    Klaviyo Employee
    October 13, 2022

    Hello @Nymesia,

    I would suggest checking out our How to Export Conversion Data Help Center if you haven’t already. Oftentimes, revenue is not actually a metric (unless it was custom coded). Rather, revenue is a calculation based on the value of a specific metric such as a Placed Order event/metric.

    As highlighted in the Revenue subsection; you can calculate revenue based on your desired measurement  of a specific event value using something like the below:

    curl https://a.klaviyo.com/api/v1/metric/PLACEDORDERMETRIC/export -G \
    -d api_key=API_KEY \
    -d unit='week' \
    -d measurement='value' \
    -d where='[["$attributed_message","=",'MESSAGE_ID']]'

    You may also find this Community post which I’ve commented on below helpful:

    David

    NymesiaAuthor
    Active Contributor II
    October 14, 2022

    Hi David,

     

    Thanks a lot for the info! It makes sense to get the revenue from Placed Order (and other similar metrics) actually! And the “measurement=value” API parameter is very helpful: I misread the endpoint documentation and did not know we could do that!

     

    Thanks again and have a great day!

     

    Marie

    Contributor I
    May 30, 2023

    Hi! I am also trying to get the Revenue Data in the API, along with Open Rate and Click rate for campaigns and flows. What’s confusing is that the referenced help center article https://help.klaviyo.com/hc/en-us/articles/360040093732 and the referenced earlier answer refer to API v1. This is not its current version. And then the article refers to “PLACEORDERMETRIC”. Is this the real name or do I need to replace it with the real one? Where do I get the metric IDs or names (to be used in the API requests) and are these unique to an account? I need the metrics Open Rate, Click Rate, the Delivered messages number, and Placed Order Value. Can you please give a comprehensive explanation how to export these from the current API version? 

    Brian Turcotte
    Klaviyo Alum
    June 5, 2023

    Hi @IrinaK!

    I noticed you asked a similar question here, where I’ve left a lengthier response:

     

    As I mentioned in that response, the best way to accomplish this would be to use our V3 Query Metric Aggregates endpoint. Here’s a useful, updated guide on how to use this endpoint:

     

    As for the Metric ID, this can be found in the Klaviyo UI by navigating to Analytics > Metrics > Search for metric > Click on metric. The Metric ID will be located in the URL of this page, like so:

    https://www.klaviyo.com/metric/METRIC_ID/metricname

     

    Best,

    Brian