Getting artifact paths during build

I’m trying to get the path to one of my artifacts during the build to pass it to the next build (using the API).

Since we don’t have any pipelines we can only hope that the artifact has been collected before next build is triggered.

My first approach was to us the api to fetch the path to the new artifact:

GET https://circleci.com/api/v1.1/project/github/:username/:project/38/artifacts?circle-token=xxx

But it isn’t there since they have not been collected. But current solution is to calculate it based on this:

https://:build-number-72849654-gh.circle-artifacts.com/0/:artifact_path/fileIwant.tar.gz so I end up with something like
https://38-72849654-gh.circle-artifacts.com/0/tmp/circle-artifacts.UCDFJAr/fileIwant.tar.gz

Is the id number 72849654 (I guess its the id number anyway) permanent? Or can this fail?

On a side note, the docs seem to be somewhat inconsistent:
-//circleci.com/docs/api/#build-artifacts

Also this fails with curl and wget:
curl https ://circleci.com/gh/:username/:project/:build_num/artifacts/0/:artifact_path/fileIWant.tar.gz?circle-token=xxx