This version of GitHub Enterprise Server was discontinued on 2024-01-04. No patch releases will be made, even for critical security issues. For better performance, improved security, and new features, upgrade to the latest version of GitHub Enterprise Server. For help with the upgrade, contact GitHub Enterprise support.
GitHub Actions Artifacts
Use the REST API to interact with artifacts in GitHub Actions.
About artifacts in GitHub Actions
You can use the REST API to download, delete, and retrieve information about workflow artifacts in GitHub Actions. Artifacts enable you to share data between jobs in a workflow and store data once that workflow has completed. For more information, see "Storing workflow data as artifacts."
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.
Parameters for "List artifacts for a repository"
Name, Type, Description |
---|
accept string Setting to |
Name, Type, Description |
---|
owner string RequiredThe account owner of the repository. The name is not case sensitive. |
repo string RequiredThe name of the repository without the |
Name, Type, Description |
---|
per_page integer The number of results per page (max 100). Default: |
page integer Page number of the results to fetch. Default: |
HTTP response status codes for "List artifacts for a repository"
Status code | Description |
---|---|
200 | OK |
Code samples for "List artifacts for a repository"
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/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://HOSTNAME/repos/octo-org/octo-docs/actions/artifacts/11",
"archive_download_url": "https://HOSTNAME/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",
"workflow_run": {
"id": 2332938,
"repository_id": 1296269,
"head_repository_id": 1296269,
"head_branch": "main",
"head_sha": "328faa0536e6fef19753d9d91dc96a9931694ce3"
}
},
{
"id": 13,
"node_id": "MDg6QXJ0aWZhY3QxMw==",
"name": "Test output",
"size_in_bytes": 453,
"url": "https://HOSTNAME/repos/octo-org/octo-docs/actions/artifacts/13",
"archive_download_url": "https://HOSTNAME/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",
"workflow_run": {
"id": 2332942,
"repository_id": 1296269,
"head_repository_id": 1296269,
"head_branch": "main",
"head_sha": "178f4f6090b3fccad4a65b3e83d076a622d59652"
}
}
]
}
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.
Parameters for "Get an artifact"
Name, Type, Description |
---|
accept string Setting to |
Name, Type, Description |
---|
owner string RequiredThe account owner of the repository. The name is not case sensitive. |
repo string RequiredThe name of the repository without the |
artifact_id integer RequiredThe unique identifier of the artifact. |
HTTP response status codes for "Get an artifact"
Status code | Description |
---|---|
200 | OK |
Code samples for "Get an artifact"
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/actions/artifacts/ARTIFACT_ID
Response
Status: 200
{
"id": 11,
"node_id": "MDg6QXJ0aWZhY3QxMQ==",
"name": "Rails",
"size_in_bytes": 556,
"url": "https://HOSTNAME/repos/octo-org/octo-docs/actions/artifacts/11",
"archive_download_url": "https://HOSTNAME/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",
"workflow_run": {
"id": 2332938,
"repository_id": 1296269,
"head_repository_id": 1296269,
"head_branch": "main",
"head_sha": "328faa0536e6fef19753d9d91dc96a9931694ce3"
}
}
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.
Parameters for "Delete an artifact"
Name, Type, Description |
---|
accept string Setting to |
Name, Type, Description |
---|
owner string RequiredThe account owner of the repository. The name is not case sensitive. |
repo string RequiredThe name of the repository without the |
artifact_id integer RequiredThe unique identifier of the artifact. |
HTTP response status codes for "Delete an artifact"
Status code | Description |
---|---|
204 | No Content |
Code samples for "Delete an artifact"
curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/actions/artifacts/ARTIFACT_ID
Response
Status: 204
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
.
You must authenticate using an access token with the repo
scope to use this endpoint.
GitHub Apps must have the actions:read
permission to use this endpoint.
Parameters for "Download an artifact"
Name, Type, Description |
---|
accept string Setting to |
Name, Type, Description |
---|
owner string RequiredThe account owner of the repository. The name is not case sensitive. |
repo string RequiredThe name of the repository without the |
artifact_id integer RequiredThe unique identifier of the artifact. |
archive_format string Required |
HTTP response status codes for "Download an artifact"
Status code | Description |
---|---|
302 | Found |
410 | Gone |
Code samples for "Download an artifact"
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/repos/OWNER/REPO/actions/artifacts/ARTIFACT_ID/ARCHIVE_FORMAT
Response
Status: 302
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.
Parameters for "List workflow run artifacts"
Name, Type, Description |
---|
accept string Setting to |
Name, Type, Description |
---|
owner string RequiredThe account owner of the repository. The name is not case sensitive. |
repo string RequiredThe name of the repository without the |
run_id integer RequiredThe unique identifier of the workflow run. |
Name, Type, Description |
---|
per_page integer The number of results per page (max 100). Default: |
page integer Page number of the results to fetch. Default: |
name string The name field of an artifact. When specified, only artifacts with this name will be returned. |
HTTP response status codes for "List workflow run artifacts"
Status code | Description |
---|---|
200 | OK |
Code samples for "List workflow run artifacts"
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/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://HOSTNAME/repos/octo-org/octo-docs/actions/artifacts/11",
"archive_download_url": "https://HOSTNAME/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",
"workflow_run": {
"id": 2332938,
"repository_id": 1296269,
"head_repository_id": 1296269,
"head_branch": "main",
"head_sha": "328faa0536e6fef19753d9d91dc96a9931694ce3"
}
},
{
"id": 13,
"node_id": "MDg6QXJ0aWZhY3QxMw==",
"name": "Test output",
"size_in_bytes": 453,
"url": "https://HOSTNAME/repos/octo-org/octo-docs/actions/artifacts/13",
"archive_download_url": "https://HOSTNAME/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",
"workflow_run": {
"id": 2332942,
"repository_id": 1296269,
"head_repository_id": 1296269,
"head_branch": "main",
"head_sha": "178f4f6090b3fccad4a65b3e83d076a622d59652"
}
}
]
}