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" in the GitHub Help documentation.

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

GitHub Actions is available with GitHub Free, GitHub Pro, GitHub Free for organizations, GitHub Team, GitHub Enterprise Cloud, and GitHub One. GitHub Actions is not available for private repositories owned by accounts using legacy per-repository plans. For more information, see GitHub's products in the GitHub Help documentation.

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

Response

Status: 200 OK
Link: <https://api.github.com/resource?page=2>; rel="next",
      <https://api.github.com/resource?page=5>; rel="last"
{
  "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-01-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-01-21T14:59:22Z"
    }
  ]
}

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

Response

Status: 200 OK
Link: <https://api.github.com/resource?page=2>; rel="next",
      <https://api.github.com/resource?page=5>; rel="last"
{
  "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-01-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-01-21T14:59:22Z"
    }
  ]
}

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

Response

Status: 200 OK
{
  "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"
}

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

Example

Call this endpoint using the -v flag, which enables verbose output and allows you to see the download URL in the header. To download the file into the current working directory, specify the filename using the -o flag.

curl -v -L -u octocat:$token -o Rails.zip /
"https://api.github.com/repos/octo-org/octo-repo/actions/artifacts/30209828/zip"

Response

Status: 302 Found
Location: https://pipelines.actions.githubusercontent.com/OhgS4QRKqmgx7bKC27GKU83jnQjyeqG8oIMTge8eqtheppcmw8/_apis/pipelines/1/runs/176/signedlogcontent?urlExpires=2020-01-24T18%3A10%3A31.5729946Z&urlSigningMethod=HMACV1&urlSignature=agG73JakPYkHrh06seAkvmH7rBR4Ji4c2%2B6a2ejYh3E%3D

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

Response

Status: 204 No Content