Atlassian's cloud products have REST APIs, but accessing them with tokens is a major pain - the base URL is different depending on the token type, and confluence API v2 documentation misses the API prefix.
Access tokens created via https://id.atlassian.com/manage-profile/security/api-tokens come in two flavors: scoped and unscoped.
When using an unscoped token, you have to use https://customername.atlassian.net/ as API domain.
Scoped tokens need a different domain and path: https://api.atlassian.com/ex/confluence/<cloudid>/. Cloud ID can be found at https://customername.atlassian.net/_edge/tenant_info.
Source: https://support.atlassian.com/confluence/kb/scoped-api-tokens-in-confluence-cloud
Links:
Documentation for v1 lists the whole path: POST /wiki/rest/api/space. Just use the base URL + the path used here, e.g. https://customername.atlassian.net/wiki/rest/api/space.
Documentation for v2 misses some crucial bits, it only lists GET /spaces. Appending that to the base URL will yield a 404. The solution is to put /wiki/api/v2/ between the base URL and the path given in the docs: https://customername.atlassian.net/wiki/api/v2/spaces.
Passing tokens via HTTP Basic Auth is possible in REST API v1 and v2.