By default, the Actions.getPageUrls API returns the same grouped/directory tree view as the pages report. If you want to get all pages and their URLs from the API, you can add &flat=1 to the API calls, which should then return all levels of the tree view as a flattened report. Every row in the API output will then also include the url value.

If you want to see a flat report in the Matomo Reports, click on the cog-icon below the report and click on “Make it flat”.