Question

V2 API key invalid for Get List and Segment Members but is valid for other requests

  • 23 November 2022
  • 2 replies
  • 11 views

Badge

I have a private API key that I am using to authenticate API calls to the v1-v2 legacy version of the API.

The API key works when I call the following endpoints:
- v1/lists
- v1/metrics
- v1/flows
- v1/campaigns

But, when I call this endpoint: "v2/group/LIST_OR_SEGMENT_ID/members/all" I get a 403 response with a message "The API key specified is invalid." 

How can this API work for all attempted endpoints except when trying to get the members of a list or segment?


2 replies

Userlevel 3
Badge +14

Hi @jjdinho and welcome to the Community!

 

If you are definitely using the same valid Private API Key for this call, there’s a chance that the error could be caused by an invalid List or Segment ID. I would primarily suggest to double-check if the ID is the same as the desired list or segment.

 

I will check with our engineering team to determine if there could be other reasons why this error would appear, but in the meantime, there is a potential workaround mentioned in this thread:

exporting the list(s) and segment(s) in question through a .csv file is another way to retrieve both a subscriber count and all details pertaining to those profiles. Also, keep in mind that only Klaviyo users with the Owner, Admin, or Analyst roles have the ability to export lists and segments.

 

 

 

Thanks for using the Community!

 

- Brian

Badge

Hey Brian,

Thanks for you timely response.

I dug a bit deeper and found some details that could help: I am using a Segment ID. This segment id is the first value return when querying the "v1/lists" endpoint. So the segment definitely exists. But I still get a 403 error code response when using that Segment ID to query the "v2/group/LIST_OR_SEGMENT_ID/members/all" endpoint.

Could it be that the api key has permission to read list data but not segment data? Or that is does not have permission to read member data of lists & segments?

It that was the case, however, I would expect a 401 error response, according to the documentation.

Hope that info helps.

Thanks again.

Jake

Reply