How to share build artifacts between separate pipelines using Codemagic API

Last updated: July 27, 2026

If you use separate workflows for building and testing your iOS app, you can use the Codemagic API to download build artifacts from your build workflow and reuse them in your test workflow. This allows you to run scheduled or on-demand tests without rebuilding the app each time.

Setting up artifact sharing

To retrieve and download build artifacts from another workflow, use the Codemagic Builds API in your test workflow.

Step 1: Get the artifact download URL

Add the following script to your test workflow to retrieve the download URL for the latest IPA artifact:

scripts:
- name: Get artifact download URL
script: |
URL=$(curl -H "x-auth-token: <Token>" \
"https://codemagic.io/api/v3/teams/<Team_ID>/builds?app_id=<App_ID>" \
| jq -r '.data[0].artifacts[] | select(.type=="ipa") | .short_lived_download_url' \
| head -n 1)

Step 2: Download the artifact

Use the download URL to retrieve the artifact and save it to your preferred location:

scripts:
- name: Download artifact
script: |
curl -L --fail --progress-bar "$URL" -o <your_path>/app.ipa

Note: The short_lived_download_url is temporary and should be used immediately after it is retrieved.

Configuration requirements

Replace the following placeholders with your own values:

  • <Token> – Your Codemagic Personal API token with access to the team and application.

  • <Team_ID> – Your Codemagic team ID.

  • <App_ID> – Your Codemagic app ID.

  • <your_path> – The directory where you want to save the downloaded artifact.

How it works

This approach uses the Codemagic Builds API to retrieve a build artifact generated by another workflow.

The workflow:

  1. Calls the Codemagic Builds API to retrieve builds for your application.

  2. Selects the IPA artifact from the returned build.

  3. Extracts the artifact's temporary download URL.

  4. Downloads the artifact to the specified location.

This allows you to keep your build and test workflows independent while ensuring your tests run against an existing build artifact instead of rebuilding the application.

Additional notes

  • The example above retrieves an IPA artifact. You can replace ipa with another artifact type, such as apk or aab, depending on your workflow.

  • The download URL is temporary and expires after a short period, so it should be used immediately after it is generated.

  • The URL variable is available only within the same workflow execution. If you split these steps across different workflows, you'll need to retrieve the download URL again.

For more information about the Codemagic API, visit the API documentation.