# Getting artifact paths during build

**URL:** <https://discuss.circleci.com/t/getting-artifact-paths-during-build/8248>\
**Category:** Build Environment\
**Tags:** artifacts\
**Created:** [November 23, 2016, 3:54pm UTC](https://discuss.circleci.com/t/getting-artifact-paths-during-build/8248 "2016-11-23T15:54:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fredrikredflag](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/fredrikredflag/32/5660_2.png) [@fredrikredflag](https://discuss.circleci.com/u/fredrikredflag)\
**Post date:** [November 23, 2016, 3:54pm UTC](https://discuss.circleci.com/t/getting-artifact-paths-during-build/8248/1 "2016-11-23T15:54:55Z")

</div>

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](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](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](https://circleci.com/docs/api/#build-artifacts)

- [//circleci.com/docs/build-artifacts/](https://circleci.com/docs/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`

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/circleci/original/3X/5/1/511608acda8e85906e15909b57bd0a46c1dbe291.png) [@system](https://discuss.circleci.com/u/system)\
**Post date:** [June 18, 2018, 11:38am UTC](https://discuss.circleci.com/t/getting-artifact-paths-during-build/8248/2 "2018-06-18T11:38:55Z")

</div>


