close
The Wayback Machine - https://web.archive.org/web/20220422060634/https://docs.github.com/en/enterprise-cloud@latest/rest/actions/artifacts
Skip to main content

Artifacts

The Artifacts API allows you to download, delete, and retrieve information about workflow artifacts.

Artifacts enable you to share data between jobs in a workflow and store data once that workflow has completed. For more information, see "Persisting workflow data using artifacts."

This API is available for authenticated users, OAuth Apps, and GitHub Apps. Access tokens require repo scope for private repositories and public_repo scope for public repositories. GitHub Apps must have the actions permission to use this API.

List artifacts for a repository

Lists all artifacts for a repository. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the repo scope. GitHub Apps must have the actions:read permission to use this endpoint.

get /repos/{owner}/{repo}/actions/artifacts

Parameters

NameTypeInDescription
acceptstringheader

Setting toapplication/vnd.github.v3+json is recommended.

ownerstringpath
repostringpath
per_pageintegerquery

Results per page (max 100)

Default: 30

pageintegerquery

Page number of the results to fetch.

Default: 1

Code samples

Example

Shell
curl \ -H "Accept: application/vnd.github.v3+json" \ https://api.github.com/repos/OWNER/REPO/actions/artifacts
JavaScript @octokit/core.js
await octokit.request('GET /repos/{owner}/{repo}/actions/artifacts', { owner: 'OWNER', repo: 'REPO' })
GitHub CLI gh api
gh api \ -H "Accept: application/vnd.github.v3+json" \ /repos/OWNER/REPO/actions/artifacts

Response

Status: 200
{ "total_count": 2, "artifacts": [ { "id": 11, "node_id": "MDg6QXJ0aWZhY3QxMQ==", "name": "Rails", "size_in_bytes": 556, "url": "https://api.github.com/repos/octo-org/octo-docs/actions/artifacts/11", "archive_download_url": "https://api.github.com/repos/octo-org/octo-docs/actions/artifacts/11/zip", "expired": false, "created_at": "2020-01-10T14:59:22Z", "expires_at": "2020-03-21T14:59:22Z", "updated_at": "2020-02-21T14:59:22Z" }, { "id": 13, "node_id": "MDg6QXJ0aWZhY3QxMw==", "name": "", "size_in_bytes": 453, "url": "https://api.github.com/repos/octo-org/octo-docs/actions/artifacts/13", "archive_download_url": "https://api.github.com/repos/octo-org/octo-docs/actions/artifacts/13/zip", "expired": false, "created_at": "2020-01-10T14:59:22Z", "expires_at": "2020-03-21T14:59:22Z", "updated_at": "2020-02-21T14:59:22Z" } ] }

Status codes

HTTP Status CodeDescription
200

OK

Notes

Get an artifact

Gets a specific artifact for a workflow run. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the repo scope. GitHub Apps must have the actions:read permission to use this endpoint.

get /repos/{owner}/{repo}/actions/artifacts/{artifact_id}

Parameters

NameTypeInDescription
acceptstringheader

Setting toapplication/vnd.github.v3+json is recommended.

ownerstringpath
repostringpath
artifact_idintegerpath

artifact_id parameter

Code samples

Example

Shell
curl \ -H "Accept: application/vnd.github.v3+json" \ https://api.github.com/repos/OWNER/REPO/actions/artifacts/ARTIFACT_ID
JavaScript @octokit/core.js
await octokit.request('GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id}', { owner: 'OWNER', repo: 'REPO', artifact_id: 'ARTIFACT_ID' })
GitHub CLI gh api
gh api \ -H "Accept: application/vnd.github.v3+json" \ /repos/OWNER/REPO/actions/artifacts/ARTIFACT_ID

Response

Status: 200
{ "id": 11, "node_id": "MDg6QXJ0aWZhY3QxMQ==", "name": "Rails", "size_in_bytes": 556, "url": "https://api.github.com/repos/octo-org/octo-docs/actions/artifacts/11", "archive_download_url": "https://api.github.com/repos/octo-org/octo-docs/actions/artifacts/11/zip", "expired": false, "created_at": "2020-01-10T14:59:22Z", "expires_at": "2020-01-21T14:59:22Z", "updated_at": "2020-01-21T14:59:22Z" }

Status codes

HTTP Status CodeDescription
200

OK

Notes

Delete an artifact

Deletes an artifact for a workflow run. You must authenticate using an access token with the repo scope to use this endpoint. GitHub Apps must have the actions:write permission to use this endpoint.

delete /repos/{owner}/{repo}/actions/artifacts/{artifact_id}

Parameters

NameTypeInDescription
acceptstringheader

Setting toapplication/vnd.github.v3+json is recommended.

ownerstringpath
repostringpath
artifact_idintegerpath

artifact_id parameter

Code samples

Example

Shell
curl \ -X DELETE \ -H "Accept: application/vnd.github.v3+json" \ https://api.github.com/repos/OWNER/REPO/actions/artifacts/ARTIFACT_ID
JavaScript @octokit/core.js
await octokit.request('DELETE /repos/{owner}/{repo}/actions/artifacts/{artifact_id}', { owner: 'OWNER', repo: 'REPO', artifact_id: 'ARTIFACT_ID' })
GitHub CLI gh api
gh api \ --method DELETE \ -H "Accept: application/vnd.github.v3+json" \ /repos/OWNER/REPO/actions/artifacts/ARTIFACT_ID

Response

Status: 204

Status codes

HTTP Status CodeDescription
204

No Content

Notes

Download an artifact

Gets a redirect URL to download an archive for a repository. This URL expires after 1 minute. Look for Location: in the response header to find the URL for the download. The :archive_format must be zip. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the repo scope. GitHub Apps must have the actions:read permission to use this endpoint.

get /repos/{owner}/{repo}/actions/artifacts/{artifact_id}/{archive_format}

Parameters

NameTypeInDescription
acceptstringheader

Setting toapplication/vnd.github.v3+json is recommended.

ownerstringpath
repostringpath
artifact_idintegerpath

artifact_id parameter

archive_formatstringpath

Code samples

Example

Shell
curl \ -H "Accept: application/vnd.github.v3+json" \ https://api.github.com/repos/OWNER/REPO/actions/artifacts/ARTIFACT_ID/ARCHIVE_FORMAT
JavaScript @octokit/core.js
await octokit.request('GET /repos/{owner}/{repo}/actions/artifacts/{artifact_id}/{archive_format}', { owner: 'OWNER', repo: 'REPO', artifact_id: 'ARTIFACT_ID', archive_format: 'ARCHIVE_FORMAT' })
GitHub CLI gh api
gh api \ -H "Accept: application/vnd.github.v3+json" \ /repos/OWNER/REPO/actions/artifacts/ARTIFACT_ID/ARCHIVE_FORMAT

Response

Status: 302

Status codes

HTTP Status CodeDescription
302

Found

Notes

List workflow run artifacts

Lists artifacts for a workflow run. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the repo scope. GitHub Apps must have the actions:read permission to use this endpoint.

get /repos/{owner}/{repo}/actions/runs/{run_id}/artifacts

Parameters

NameTypeInDescription
acceptstringheader

Setting toapplication/vnd.github.v3+json is recommended.

ownerstringpath
repostringpath
run_idintegerpath

The id of the workflow run.

per_pageintegerquery

Results per page (max 100)

Default: 30

pageintegerquery

Page number of the results to fetch.

Default: 1

Code samples

Example

Shell
curl \ -H "Accept: application/vnd.github.v3+json" \ https://api.github.com/repos/OWNER/REPO/actions/runs/RUN_ID/artifacts
JavaScript @octokit/core.js
await octokit.request('GET /repos/{owner}/{repo}/actions/runs/{run_id}/artifacts', { owner: 'OWNER', repo: 'REPO', run_id: 'RUN_ID' })
GitHub CLI gh api
gh api \ -H "Accept: application/vnd.github.v3+json" \ /repos/OWNER/REPO/actions/runs/RUN_ID/artifacts

Response

Status: 200
{ "total_count": 2, "artifacts": [ { "id": 11, "node_id": "MDg6QXJ0aWZhY3QxMQ==", "name": "Rails", "size_in_bytes": 556, "url": "https://api.github.com/repos/octo-org/octo-docs/actions/artifacts/11", "archive_download_url": "https://api.github.com/repos/octo-org/octo-docs/actions/artifacts/11/zip", "expired": false, "created_at": "2020-01-10T14:59:22Z", "expires_at": "2020-03-21T14:59:22Z", "updated_at": "2020-02-21T14:59:22Z" }, { "id": 13, "node_id": "MDg6QXJ0aWZhY3QxMw==", "name": "", "size_in_bytes": 453, "url": "https://api.github.com/repos/octo-org/octo-docs/actions/artifacts/13", "archive_download_url": "https://api.github.com/repos/octo-org/octo-docs/actions/artifacts/13/zip", "expired": false, "created_at": "2020-01-10T14:59:22Z", "expires_at": "2020-03-21T14:59:22Z", "updated_at": "2020-02-21T14:59:22Z" } ] }

Status codes

HTTP Status CodeDescription
200

OK

Notes