CircleCI is a cloud-based continuous integration and continuous delivery (CI/CD) platform. Software development teams use CircleCI to run build jobs, automate tests, and orchestrate complex workflows.

To set up CircleCI integration for your API, you’ll need to create an API token in CircleCI and configure your API in Postman. After you set up the integration, you can view the status of builds or kick off a new build, all from within Postman.

Creating a CircleCI API Token

  1. Log into CircleCI and navigate to User Settings > Personal API Tokens.
  2. Select Create New Token.
  3. Enter a Token Name and select Add API Token.
  4. Select Copy to copy the new token. (You might want to save the token somewhere safe.)

Configuring CircleCI integration

  1. Open your API by selecting APIs in the left sidebar, and then selecting an API and a version. Each API version can be linked to only one CI project.

  2. Select the Test tab.

  3. Under Connect to CI/CD Builds, select CircleCI.

    CI Integration

  4. For API Key, enter your CircleCI token.

  5. Enter a Nickname to help you recognize the integration later.

  6. Select the CI project used for your API.

  7. Select Connect.

    Add API key

Configuring Newman for CircleCI

With the help of Newman and the Postman API, you can run API tests created in Postman as part of your CI pipeline. First generate the Newman configuration code in Postman. Then add the configuration code to CircleCI:

  1. Open your project in CircleCI, select a branch, and then select Edit Config.
  2. Paste the Newman configuration you copied from Postman:
    • Replace both instances of $POSTMAN_API_KEY with a valid Postman API Key.
    • Make sure to add the newman-collection-run job to a new or existing workflow.
  3. Select Save and Run to run the pipeline using the new configuration.
  4. To view the test results in Postman, open your API and select the Tests tab.

Example CircleCI config.yml

version: 2.1

  newman: postman/newman@0.0.2

    executor: newman/postman-newman-docker
      - checkout

      - newman/newman-run:

      - newman-collection-run

Last modified: 2021/11/01