For the root account (top of the sub-account hierarchy) you can use the special value of `self` which is documented on the IDs page (the top account normally has an ID of 1 but not always), so the URL would be `/api/v1/accounts/self/courses`. This API endpoint has paging enabled, so you will need to make multiple requests and page through the results. If you use the sub-account tool in an account you can browse to other accounts and the ID will end up in the URL.
However if you are wanting to process all courses in your Canvas deployment you are much better off running a Provisioning Report which is outlined in the standard canvas reports. There is an API to run reports if you want to automate it, or you can manually run these reports, download the file and the process it. Reports can also be run at a sub-account which allows you to process a subset of courses easily if you have a well designed sub-account hierarchy.