Getting Segment data directly from API

We used below API to get metrics for various segments but it is asking for segments to be created first in the Matomo… Can anyone help us with API which will helps us getting segment data directly from API without creating it programmatically -

Absolutely! While there isn’t a direct API call to grab segment data without prior creation, you can leverage the segment ID in your existing API call. Just define your segments beforehand and reference them by ID in the segment parameter. Makes things a bit smoother!

As far as I know, in Matomo segments usually need to be defined first before you can use them with the API. However, you might be able to pass the segment parameter directly in the API request instead of creating it in the UI. It may be worth checking the Matomo API documentation to see the supported segment query options.