How do I promote runs using spacectl or API?

Last updated: August 6, 2025

How do I promote runs using spacectl or API?

Context

While the Spacelift UI provides a promotion option for certain stacks, users may want to automate this process using spacectl CLI tool or the API directly.

Answer

Currently, spacectl does not have a direct promote option. However, there are two ways to handle promotions:

Using the GraphQL API

You can promote runs directly using the GraphQL API with the runPromote mutation:

  1. Use an API client tool (such as Insomnia, Bruno, or Postman)

  2. Create a POST request with the following mutation:

    mutation PromoteProposedRunNext($stackId: ID!, $runId: ID!) {
      runPromote(stack: $stackId, run: $runId) {
        id
        __typename
      }
    }
    
  3. Include the variables in your request:

    {
      "stackId": "your-stack-id",
      "runId": "your-run-id"
    }
    

Alternative Commands with spacectl

While direct promotion isn't available in spacectl, you can use the following commands instead:

  • Confirm a run

  • Approve a run

  • Deploy a new tracked run using spacectl stack deploy [command options]

For more details about the runPromote mutation, you can refer to the API documentation.