Codemagic

App · 24 actions

Start and cancel Codemagic builds, read their steps and artifacts, share artifacts by link, manage apps, variable groups and caches, and follow new, successful and failed builds.

Actions

ActionWhat it does
Add appAdd a Git repository to Codemagic as an app, optionally in a team.
Add variablesAdd environment variables to a variable group, optionally as secure (hidden) values.
Cancel buildCancel a build that hasn't finished.
Create artifact public linkMake a download link for a build artifact that anyone can open until it expires.
Create variable groupCreate a group of environment variables for an app's builds.
Delete cacheDelete one of an app's build caches, so the workflow's next build starts without it.
Delete variableDelete one variable from a variable group.
Delete variable groupDelete a variable group and all its variables.
Get appGet an app's name, branches and Workflow Editor workflows.
Get buildGet a build's status, workflow, commit, artifacts and timing.
Get current userGet the Codemagic user the API token belongs to.
Get variable groupGet a variable group's name.
List appsList the apps you can reach, optionally by name.
List build stepsList a build's steps, such as fetching, testing and publishing, with how each ended.
List buildsList a team's builds, newest first, by app, workflow, branch, tag, label or status.
List cachesList an app's stored build caches, by workflow, with their size and last use.
List team appsList a team's apps with their repository and project type.
List team membersList a team's members with their team roles and app access.
List teamsList your personal account and the teams you belong to.
List variable groupsList an app's groups of environment variables.
List variablesList a variable group's variables.
List workflowsList an app's workflows, from the Workflow Editor or codemagic.yaml.
Start buildQueue a build of an app's workflow on a branch or tag, with extra variables, labels or machine.
Update variableChange a variable's name, value or whether it is secure.

Add app

Add a Git repository to Codemagic as an app, optionally in a team.

Inputs

Repository URLrepository_urltextRequired
The repository's SSH or HTTPS clone URL, such as git@github.com:acme/app.git.
Teamteamtext
The team to add it to. You must be an admin of it. Leave empty for your personal account.

Outputs

dataobject
The response from Codemagic.
Example output
{
  "data": {
    "_id": "example",
    "appName": "example"
  }
}

Add variables

Add environment variables to a variable group, optionally as secure (hidden) values.

Inputs

Variable group IDvariable_group_idtextRequired
The variable group's ID, as Create variable group or List variable groups gives it.
VariablesvariablesobjectRequired
The variables to add, as name and value pairs, such as API_URL.
Securesecuretrue/false
Store the values encrypted, so nobody can read them back. Leave off for readable values.

Outputs

dataobject
The response from Codemagic.
Example output
{
  "data": {
    "added": [
      "example"
    ],
    "secure": true
  }
}

Cancel build

Cancel a build that hasn't finished. A finished build is left as it is.

Inputs

Build IDbuild_idtextRequired
The build's ID, as Start build or List builds gives it.

Outputs

dataobject
The response from Codemagic.
Example output
{
  "data": {}
}

Make a download link for a build artifact that anyone can open until it expires.

Inputs

Artifact linkartifact_urltextRequired
The artifact's link in Codemagic, which starts with https://api.codemagic.io/artifacts/.
Expires atexpires_atdate and timeRequired
When the public link stops working.

Outputs

dataobject
The response from Codemagic.
Example output
{
  "data": {
    "expiresAt": "example",
    "url": "example"
  }
}

Create variable group

Create a group of environment variables for an app's builds.

Inputs

Appapp_idtextRequired
The Codemagic app.
NamenametextRequired
The group's name, such as production. It can't contain . or $.

Outputs

dataobject
The response from Codemagic.
Example output
{
  "data": {
    "data": {
      "id": "example",
      "name": "example"
    }
  }
}

Delete cache

Delete one of an app's build caches, so the workflow's next build starts without it.

Inputs

Appapp_idtextRequired
The Codemagic app.
Cachecache_idtextRequired
The cache.

Outputs

dataobject
The response from Codemagic.
Example output
{
  "data": {
    "caches": [
      "example"
    ],
    "message": "example"
  }
}

Delete variable

Delete one variable from a variable group.

Inputs

Variable group IDvariable_group_idtextRequired
The variable group's ID, as Create variable group or List variable groups gives it.
Variablevariable_idtextRequired
The variable.

Outputs

dataobject
The response from Codemagic.
Example output
{
  "data": {}
}

Delete variable group

Delete a variable group and all its variables. This can't be undone.

Inputs

Variable group IDvariable_group_idtextRequired
The variable group's ID, as Create variable group or List variable groups gives it.

Outputs

dataobject
The response from Codemagic.
Example output
{
  "data": {}
}

Get app

Get an app's name, branches and Workflow Editor workflows.

Inputs

Appapp_idtextRequired
The Codemagic app.

Outputs

dataobject
The response from Codemagic.
Example output
{
  "data": {
    "application": {
      "_id": "example",
      "appName": "example",
      "branches": [
        "example"
      ],
      "workflowIds": [
        "example"
      ],
      "workflows": {}
    }
  }
}

Get build

Get a build's status, workflow, commit, artifacts and timing.

Inputs

Build IDbuild_idtextRequired
The build's ID, as Start build or List builds gives it.

Outputs

dataobject
The response from Codemagic.
Example output
{
  "data": {
    "data": {
      "app_id": "example",
      "artifacts": [
        {
          "name": "example",
          "short_lived_download_url": "example",
          "size_in_bytes": 1,
          "type": "example",
          "version_code": "example",
          "version_name": "example"
        }
      ],
      "branch": "example",
      "build_inputs": {},
      "commit": {
        "author_email": "example",
        "author_name": "example",
        "hash": "example",
        "message": "example",
        "url": "example"
      },
      "config": {
        "flutter_mode": "example",
        "flutter_version": "example",
        "platforms": [
          "example"
        ],
        "xcode_version": "example"
      },
      "created_at": "example",
      "finished_at": "example",
      "id": "example",
      "index": 1,
      "instance_type": "example",
      "labels": [
        "example"
      ],
      "priority": 1,
      "pull_request": {
        "destination_branch": "example",
        "number": 1,
        "source_branch": "example"
      },
      "remote_access_enabled": true,
      "started_at": "example",
      "status": "example",
      "tag": "example",
      "workflow": {
        "id": "example",
        "name": "example",
        "source": "example"
      }
    }
  }
}

Get current user

Get the Codemagic user the API token belongs to.

Inputs

None.

Outputs

dataobject
The response from Codemagic.
Example output
{
  "data": {
    "data": {
      "avatar_url": "example",
      "email": "example",
      "id": "example",
      "name": "example"
    }
  }
}

Get variable group

Get a variable group's name.

Inputs

Variable group IDvariable_group_idtextRequired
The variable group's ID, as Create variable group or List variable groups gives it.

Outputs

dataobject
The response from Codemagic.
Example output
{
  "data": {
    "data": {
      "id": "example",
      "name": "example"
    }
  }
}

List apps

List the apps you can reach, optionally by name.

Inputs

Namenametext
Only apps whose name contains every word of this.
Pagepagenumber
Which page of apps to read, starting at 1.At least 1.
Per pagepage_sizenumber
How many apps to return on a page, up to 100. Codemagic's default is 30.From 1 to 100.

Outputs

dataobject
The response from Codemagic.
Example output
{
  "data": {
    "current_page": 1,
    "data": [
      {
        "archived": true,
        "icon_url": "example",
        "id": "example",
        "last_build_id": "example",
        "name": "example"
      }
    ],
    "page_size": 1,
    "total_pages": 1
  }
}

List build steps

List a build's steps, such as fetching, testing and publishing, with how each ended.

Inputs

Build IDbuild_idtextRequired
The build's ID, as Start build or List builds gives it.
Pagepagenumber
Which page of steps to read, starting at 1.At least 1.
Per pagepage_sizenumber
How many steps to return on a page, up to 100. Codemagic's default is 30.From 1 to 100.

Outputs

dataobject
The response from Codemagic.
Example output
{
  "data": {
    "current_page": 1,
    "data": [
      {
        "finished_at": "example",
        "has_test_results": true,
        "id": "example",
        "name": "example",
        "script": "example",
        "started_at": "example",
        "status": "example",
        "type": "example"
      }
    ],
    "page_size": 1,
    "total_pages": 1
  }
}

List builds

List a team's builds, newest first, by app, workflow, branch, tag, label or status.

Inputs

TeamteamtextRequired
The Codemagic team. Your personal account is listed as a team too.
Appapp_idtext
Only builds of this app.
Workflowworkflowtext
Only builds of this workflow.
Branchbranchtext
Only builds of this branch.
Tagtagtext
Only builds of this tag.
Labelslabellist
Only builds with these labels.
Statusstatustext
Only builds with this status. In progress covers every build that hasn't ended.One of: queued, waiting, building (In progress), finished (Finished successfully), failed, canceled, timeout (Timed out), skipped.
Cursorcursortext
The cursor from the last answer, to read the next page.
Per pagepage_sizenumber
How many builds to return, up to 100. Codemagic's default is 30.From 1 to 100.

Outputs

dataobject
The response from Codemagic.
Example output
{
  "data": {
    "cursor": "example",
    "data": [
      {
        "app_id": "example",
        "artifacts": [
          {
            "name": "example",
            "short_lived_download_url": "example",
            "size_in_bytes": 1,
            "type": "example",
            "version_code": "example",
            "version_name": "example"
          }
        ],
        "branch": "example",
        "commit": {
          "author_email": "example",
          "author_name": "example",
          "hash": "example",
          "message": "example",
          "url": "example"
        },
        "created_at": "example",
        "finished_at": "example",
        "id": "example",
        "index": 1,
        "labels": [
          "example"
        ],
        "priority": 1,
        "pull_request": {
          "destination_branch": "example",
          "number": 1,
          "source_branch": "example"
        },
        "started_at": "example",
        "status": "example",
        "tag": "example",
        "workflow": {
          "id": "example",
          "name": "example",
          "source": "example"
        }
      }
    ],
    "page_size": 1
  }
}

List caches

List an app's stored build caches, by workflow, with their size and last use.

Inputs

Appapp_idtextRequired
The Codemagic app.

Outputs

dataobject
The response from Codemagic.
Example output
{
  "data": {
    "caches": [
      {
        "_id": "example",
        "appId": "example",
        "lastUsed": "example",
        "size": 1,
        "workflowId": "example"
      }
    ]
  }
}

List team apps

List a team's apps with their repository and project type.

Inputs

TeamteamtextRequired
The Codemagic team. Your personal account is listed as a team too.
Namenametext
Only apps whose name contains every word of this.
Pagepagenumber
Which page of apps to read, starting at 1.At least 1.
Per pagepage_sizenumber
How many apps to return on a page, up to 100. Codemagic's default is 30.From 1 to 100.

Outputs

dataobject
The response from Codemagic.
Example output
{
  "data": {
    "current_page": 1,
    "data": [
      {
        "archived": true,
        "icon_url": "example",
        "id": "example",
        "last_build_id": "example",
        "name": "example",
        "project_type": "example",
        "repository": {
          "url": "example"
        },
        "settings_source": "example"
      }
    ],
    "page_size": 1,
    "total_pages": 1
  }
}

List team members

List a team's members with their team roles and app access.

Inputs

TeamteamtextRequired
The Codemagic team. Your personal account is listed as a team too.
Rolesrolelist
Only members with these roles.One or more of: owner, admin, member, app_developer (App developer), app_viewer (App viewer).
Pagepagenumber
Which page of members to read, starting at 1.At least 1.
Per pagepage_sizenumber
How many members to return on a page, up to 100. Codemagic's default is 30.From 1 to 100.

Outputs

dataobject
The response from Codemagic.
Example output
{
  "data": {
    "current_page": 1,
    "data": [
      {
        "app_grants": [
          {
            "app_id": "example",
            "role": "example"
          }
        ],
        "avatar_url": "example",
        "created_at": "example",
        "email": "example",
        "id": "example",
        "name": "example",
        "team_roles": [
          "example"
        ]
      }
    ],
    "page_size": 1,
    "total_pages": 1
  }
}

List teams

List your personal account and the teams you belong to.

Inputs

Pagepagenumber
Which page of teams to read, starting at 1.At least 1.
Per pagepage_sizenumber
How many teams to return on a page, up to 100. Codemagic's default is 30.From 1 to 100.

Outputs

dataobject
The response from Codemagic.
Example output
{
  "data": {
    "current_page": 1,
    "data": [
      {
        "created_at": "example",
        "icon_url": "example",
        "id": "example",
        "name": "example",
        "personal": true
      }
    ],
    "page_size": 1,
    "total_pages": 1
  }
}

List variable groups

List an app's groups of environment variables.

Inputs

Appapp_idtextRequired
The Codemagic app.
Pagepagenumber
Which page of groups to read, starting at 1.At least 1.
Per pagepage_sizenumber
How many groups to return on a page, up to 100. Codemagic's default is 30.From 1 to 100.

Outputs

dataobject
The response from Codemagic.
Example output
{
  "data": {
    "current_page": 1,
    "data": [
      {
        "id": "example",
        "name": "example"
      }
    ],
    "page_size": 1,
    "total_pages": 1
  }
}

List variables

List a variable group's variables. Secure values come back hidden.

Inputs

Variable group IDvariable_group_idtextRequired
The variable group's ID, as Create variable group or List variable groups gives it.
Searchsearchtext
Only variables matching this text.
Pagepagenumber
Which page of variables to read, starting at 1.At least 1.
Per pagepage_sizenumber
How many variables to return on a page, up to 100. Codemagic's default is 30.From 1 to 100.

Outputs

dataobject
The response from Codemagic.
Example output
{
  "data": {
    "current_page": 1,
    "data": [
      {
        "id": "example",
        "name": "example",
        "secure": true,
        "value": "example"
      }
    ],
    "page_size": 1,
    "total_pages": 1
  }
}

List workflows

List an app's workflows, from the Workflow Editor or codemagic.yaml.

Inputs

Appapp_idtextRequired
The Codemagic app.

Outputs

dataobject
The response from Codemagic.
Example output
{
  "data": {
    "data": [
      {
        "id": "example",
        "name": "example",
        "source": "example"
      }
    ]
  }
}

Start build

Queue a build of an app's workflow on a branch or tag, with extra variables, labels or machine.

Inputs

Appapp_idtextRequired
The Codemagic app.
WorkflowworkflowtextRequired
The workflow to build: its key in codemagic.yaml, or a Workflow Editor workflow.
Build aref_typetext
Whether to build a branch or a tag. Leave empty for a branch.One of: branch, tag. Default: branch.
Branch or tagreftextRequired
The branch or tag to build, such as main or v1.2.0.
Environment variablesvariablesobject
Environment variables for the build, by name.
Variable groupsvariable_groupslist
Variable groups to make available to the build, by name.
Workflow inputsinputsobject
Values for the workflow's inputs, by input name.
Labelslabelslist
Labels to tag the build with.
Machineinstance_typetext
The build machine. Leave empty for the workflow's own.One of: mac_mini_m2 (Mac mini M2), mac_mini_m4 (Mac mini M4), mac_studio_m4_max (Mac Studio M4 Max), linux_x2 (Linux X2), linux_x4 (Linux X4), windows_x2 (Windows X2).
Priorityprioritynumber
From 0 to 10: the team's builds with a higher priority start first.From 0 to 10.

Outputs

dataobject
The response from Codemagic.
Example output
{
  "data": {
    "data": {
      "id": "example"
    }
  }
}

Update variable

Change a variable's name, value or whether it is secure. Only the fields filled in change.

Inputs

Variable group IDvariable_group_idtextRequired
The variable group's ID, as Create variable group or List variable groups gives it.
Variablevariable_idtextRequired
The variable.
Namenametext
The variable's new name.
Valuevaluetext
The variable's new value.
Securesecuretrue/false
Store the value encrypted, so nobody can read it back.

Outputs

dataobject
The response from Codemagic.
Example output
{
  "data": {}
}

On this page