Artifact URL - How can we retrieve the project ID programatically

The following URL would allow us to retrieve artifacts for a build - https://circleci.com/docs/api/#download-an-artifact-file

https://:build_num-:projectId-gh.circle-artifacts.com/0/<pathToArtifact>?circle-token=:token

I have noted that the :projectId is always the same for each project, but I cannot find this projectId via Circle env vars, or exposed as a single key/value pair in any of the circleCI api calls. The only way I can work out how to retrieve it, is from the url value in the list of all artifacts of a build

Is there any way that we can expose this per project ID via the API, or add as a CIRCLE env var.

The reason I mainly ask, is that I have built a slack reporter for cypress, which will build up the URL’s for circleci artifacts dynamically and inject these into the slack message. I will now have to ask users to either add in the projectId as a env var themselves, or ask them to provide their circleToken, and strip the url value in order to pull out the unique project id, which is less preferable.