How to get a custom dimension out of the API?

I use this to get Page URLs out of the API:

https://analytics.babasprojects.com/?module=API&method=Actions.getPageUrls&idSite=2&date=today&period=week&format=json&filter_limit=20&token_auth={{my token}}

I have a custom dimension that I call like so:

_paq.push(['setCustomDimension', 1, window.location.href]);

How do I get what is recorded for this custom dimension out of the API like I do Actions.getPageUrls in the example above?

Hey @MastaBaba, did you ever figure this out? I need this as well.

No, I don’t think I did.

Hi @JiveDig, @MastaBaba
I think you can’t cross dimensions by default in APIs.
The only ways I know are:

Use the dimension API

CustomDimensions.getCustomDimension (idDimension, idSite, period, date, segment = ‘’, expanded = ‘’, flat = ‘’, idSubtable = ‘’)
Something like https://matomo.cm-cic.fr/index.php?date=2023-03-28&expanded=1&filter_limit=10&format=XML&idDimension=33&idSite=1&method=CustomDimensions.getCustomDimension&module=API&period=day&reportUniqueId=CustomDimensions_getCustomDimension_idDimension--33&segment=&token_auth=ENTER_YOUR_TOKEN_AUTH_HERE
https://developer.matomo.org/api-reference/reporting-api#CustomDimensions

Use the raw log API

Live.getLastVisitsDetails (idSite, period = ‘’, date = ‘’, segment = ‘’, countVisitorsToFetch = ‘’, minTimestamp = ‘’, flat = ‘’, doNotFetchActions = ‘’, enhanced = ‘’)
Something like https://matomo.cm-cic.fr/index.php?date=2023-03-28&expanded=1&filter_limit=5&format=XML&idSite=1&method=Live.getLastVisitsDetails&module=API&period=day&segment=&token_auth=ENTER_YOUR_TOKEN_AUTH_HERE
https://developer.matomo.org/api-reference/reporting-api#Live

Use the custom report plugin + API

CustomReports.getCustomReport (idSite, period, date, idCustomReport, segment = ‘’, expanded = ‘’, flat = ‘’, idSubtable = ‘’, columns = ‘’)
Something like https://matomo/index.php?module=API&format=XML&idSite=1&period=day&date=yesterday&method=CustomReports.getCustomReport&idCustomReport=2&reportUniqueId=CustomReports_getCustomReport_idCustomReport--2&expanded=1&token_auth=ENTER_YOUR_TOKEN_AUTH_HERE&filter_limit=10
https://developer.matomo.org/api-reference/reporting-api#CustomReports

Access the raw data direct from database

https://developer.matomo.org/guides/database-schema