Managing build artifacts

If you add the Deploy to bitrise.io step to your Workflow, once the build has run, you can access the build artifacts in the APPS & ARTIFACTS tab.

You can also manage the generated artifacts with the Bitrise API.

Table 1. Endpoints related to managing build artifacts with the API

Listing build artifacts

To be able to use build artifact endpoints, you have to first list all artifacts that belong to an app’s build. The response will list all artifacts along with their slug which you will need later.

The required parameters are:

  • app slug

  • build slug

You can use the generated build artifact slug/s from the response output with other build artifact endpoints where the build artifact slug is a required parameter.

Example 1. Listing the artifacts of an app

Request:

curl -X GET "https://api.bitrise.io/v0.1/apps/87a5991e180d91a9/builds/b234f959745082e0/artifacts" -H "accept: application/json" -H "Authorization: THE-ACCESS-TOKEN"

Response:

{
  "data": [
    {
      "title": "another_app-debug.apk",
      "artifact_type": "android-apk",
      "is_public_page_enabled": true,
      "slug": "92e0b6ecae87b832",
      "file_size_bytes": 1574799
    },
    {
      "title": "app-debug.apk",
      "artifact_type": "android-apk",
      "is_public_page_enabled": true,
      "slug": "54ae701761c4f956",
      "file_size_bytes": 1574793
    }
  ],
  "paging": {
    "total_item_count": 2,
    "page_item_limit": 50
  }
}

Retrieving a specific build artifact's data

You can retrieve detailed data of a specific build's artifacts with the artifacts endpoint. The response shows the filename, the artifact type, the download URL, and the file size.

The required parameters are:

  • app slug

  • build slug

  • artifact slug

Example 1. Retrieving the data of a specific artifact

Request:

curl -X GET "https://api.bitrise.io/v0.1/apps/87a5991e180d91a9/builds/b234f959745082e0/artifacts/92e0b6ecae87b832" -H "accept: application/json" -H "Authorization: THE-ACCESS-TOKEN"

Response:

{
  "data": {
    "title": "another_app-debug.apk",
    "artifact_type": "android-apk",
    "expiring_download_url": "https://bitrise-prod-build-storage.s3.amazonaws.com/builds/b234f959745082e0/artifacts/7626902/another_app-debug.apk?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAIV2YZWMVCNWNR2HA%2F20190426%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20190426T131627Z&X-Amz-Expires=600&X-Amz-SignedHeaders=host&X-Amz-Signature=9f1af26787f34b5cf0cbc18b2372313607b1e3c0203a9ce7e42da884a6ddf70f",
    "is_public_page_enabled": true,
    "slug": "92e0b6ecae87b832",
    "public_install_page_url": "https://www.bitrise.io/artifact/7626902/p/8e5b2c62abe28fecef09b271de767920",
    "file_size_bytes": 1574799
  }
}

By default, the value of the is_public_page_enabled input is set to true. This way the public_install_page_url becomes available and you can view some basic information about the artifact via this URL. You can also download the artifact using the download URL from the response output.


Disabling the public install page of an artifact

You can update the is_public_page_enabled parameter of your APK and IPA files. Please note this parameter’s value is set to true by default so you can only disable it with this endpoint.

The required parameters are:

  • app slug

  • build slug

  • artifact slug

Example 1. Disabling the public install page for an APK file

Request:

curl -X PATCH "https://api.bitrise.io/v0.1/apps/87a5991e180d91a9/builds/b234f959745082e0/artifacts/54ae701761c4f956" -H "accept: application/json" -H "Authorization: THE-ACCESS-TOKEN" -H "Content-Type: application/json" -d "{ \"is_public_page_enabled\": false}"

Response:

{
  "data": {
    "title": "app-debug.apk",
    "artifact_type": "android-apk",
    "expiring_download_url": "https://bitrise-prod-build-storage.s3.amazonaws.com/builds/b234f959745082e0/artifacts/7626904/app-debug.apk?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAIV2YZWMVCNWNR2HA%2F20190503%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20190503T082800Z&X-Amz-Expires=600&X-Amz-SignedHeaders=host&X-Amz-Signature=7251fcbc0574ffac60b3f1d4a8c398658e49f0b86fb3cfec1500bde125738abc",
    "is_public_page_enabled": false,
    "slug": "54ae701761c4f956",
    "public_install_page_url": "",
    "file_size_bytes": 1574793
  }
}

If you check the build’s APPS & ARTIFACTS tab, you will see that the Public install page toggle is disabled.


Deleting a build artifact

You can delete an app’s specific build artifact.

The required parameters are:

  • app slug

  • build slug

  • artifact slug

Example 1. Deleting an APK file

Request:

curl -X DELETE "https://api.bitrise.io/v0.1/apps/87a5991e180d91a9/builds/b234f959745082e0/artifacts/54ae701761c4f956" -H "accept: application/json" -H "Authorization: THE-ACCESS-TOKEN"

Response:

{
  "data": {
    "title": "app-debug.apk",
    "artifact_type": "android-apk",
    "expiring_download_url": null,
    "is_public_page_enabled": true,
    "slug": "54ae701761c4f956",
    "public_install_page_url": "",
    "file_size_bytes": 1574793
  }
}