Question: Circle Ci 2.0 artifacts can be accessed with the following url

`https://{BUILD_NUMBER}-{UNKNOWN_NUMBER}-gh.circle-artifacts.com/0`

What does the number after CI build number represent.

Answer: 
If, like me, you were looking for a way to programmatically reference CircleCI (2.0) artifacts, the following url structure works for me:

```
https://circleci.com/api/v1.1/project/:vcs-type/:username/:project/:build_num/artifacts/0/:path-to-artifact?circle-token=:token&branch=:branch

```

For example:

<https://circleci.com/api/v1.1/project/github/circleci/circleci-docs/latest/artifacts/0/run-results/build-results.txt?branch=realitycheck&filter=successful>

resolves to the `build-results.txt` artifact on the latest, successful build of the circleci-docs project's realitycheck branch.

Constructing the `:path-to-artifact` can be done by inspecting your CircleCI artifacts directory structure:

[![enter image description here](https://i.stack.imgur.com/paF8u.png)](https://i.stack.imgur.com/paF8u.png)

From the above, the `:path-to-artifact` is `0/run-results/build-results.txt`.

Reference:

* <https://circleci.com/docs/api/v1-reference/#build-artifacts>
The `{UNKNOWN_NUMBER}` represents the Github id of the repository.

If you run the snippet below you can get the id you want for any organisation and repository as provided by the [github rest API](https://developer.github.com/v3/)

```js
function query_gh(){
  var org = document.getElementById("org").value;
  var repo = document.getElementById("repo").value;

  async function query(org, repo) {
    const response = await fetch("https://api.github.com/orgs/"+org+"/repos");
    const outJson = await response.json();

    for (var i = 0; i < outJson.length; i++){
      var repository = outJson[i];
      if (repository.name == repo) {
        id = repository.id;
        output.innerHTML = org +"/"+ repo + " has ID: " + id;
        return true;
      }
    }
  }
  query(org, repo);
  return true;
}
```

```html
<!DOCTYPE html>
<html>
<body>

<p>Enter names of the GH organisation and repository</p>
<form onsubmit="query_gh(); return false;">
 <label for="org">Organisation</label>
 <input type="text" id="org" required="">
 <br>
 <label for="repo">Repository</label>
 <input type="text" id="repo" required="">
 <br>
 <button type="submit">Query</button>

</form>

<div id="output">
 <span id="output_text">...</span>
</div>

</body>
</html>
```