Take this generic document query URL:
Each project has its own private host-name, which is always
<projectId>.api.sanity.io for requests and
<projectId>.apicdn.sanity.io for the API CDN (cache) endpoint. The path (what comes after the hostname) always starts with the API-version (you can set the present ISO date,
YYYY-MM-DD for the latest version) then the path to the API-endpoint. So, to sum it up, these are the URL prefixes:
- API CDN:
In the rest of this document we will generally only refer to the <path>-part of the url.
Caveat: The API CDN only supports the /data/query-endpoint, its only purpose being caching query-results across the globe for the benefit of your end-users.
In a configured studio, you find the project ID in the
sanity.json file at the root of your project. Otherwise, you can always find it by locating your project on https://manage.sanity.io.
For clarity, we have opted to write URLs with their component in cleartext. In actual use they will all have to be encoded (using encodeURIComponent or equivalent) so that this:
https://zp7mbokg.api.sanity.io/v2021-06-07/data/query/production?query=*[_id == $id]&$id="myId"