Skip to main content
Solved

How do you create a new metric with the API?


Forum|alt.badge.img

Hi - There doesn’t seem to be a dedicated create metric endpoint. From what I can decipher from the documentation is that the “event” endpoint (https://a.klaviyo.com/api/events) is what is used to create a metric by passing the name at `data.attributes.metric.data.attributes.name`

From second hand info I believe this worked on our company’s main account, however my personal/test account doesn’t seem to be showing this new metric (or even event on the profile for that matter despite getting a 202 response)

Is this because it’s a free account or am I missing a something to get a custom metric recognized?

Best answer by coldaussie

For anyone else that lands on this, my issue here was that I was using a “@example.com” email which is apparently quietly ignored in klaviyo (even for creating metrics) despite getting a 202/Success response

View original
Did this topic or the replies in the thread help you find an answer to your question?

6 replies

JACKSON_12
Problem Solver II
Forum|alt.badge.img+1
  • Problem Solver II
  • 8 replies
  • May 18, 2024

According to Klaviyo's documentation, you're correct that you can use the "event" endpoint to create a custom metric by passing the name in the data.attributes.metric.data.attributes.name parameter.

However, it seems that there might be some limitations when it comes to using custom metrics on a free account. According to Klaviyo's pricing page, custom metrics are only available on their paid plans.


Forum|alt.badge.img+7
  • Klaviyo Employee
  • 169 replies
  • May 20, 2024

Free plans don’t have any limitations on custom metrics, except for the limitation that applies to all accounts, you can have up to 200 metrics (not events, but up to 200 differently named metrics).

Are you sure you’re using the correct private key for the test account?

Do you see the API call in the logs? https://developers.klaviyo.com/en/docs/monitor_api_usage


Forum|alt.badge.img
  • Author
  • Problem Solver I
  • 3 replies
  • May 21, 2024

Are you sure you’re using the correct private key for the test account?


I’m using the correct keys and have no auth related errors and see the endpoints in the logs as you suggested.
 

Free plans don’t have any limitations on custom metrics


So without any limitations on custom metrics in my free account and with 202/Success api response is there another issue preventing metrics and events from appearing in my account? Maybe a bug on klaviyo’s end?


Forum|alt.badge.img
  • Author
  • Problem Solver I
  • 3 replies
  • May 22, 2024

Also - is there a better avenue to ask these questions? Something I can initiate through our company’s account?


EDIT: @saulblum has dm’d me earlier


Forum|alt.badge.img+7
  • Klaviyo Employee
  • 169 replies
  • May 22, 2024

Yes, go through support at help.klaviyo.com


Forum|alt.badge.img
  • Author
  • Problem Solver I
  • 3 replies
  • Answer
  • May 23, 2024

For anyone else that lands on this, my issue here was that I was using a “@example.com” email which is apparently quietly ignored in klaviyo (even for creating metrics) despite getting a 202/Success response