The `circleci-api` library provides a client for interacting with the CircleCI API, designed for use in both Node.js and browser environments. Written entirely in TypeScript, it offers comprehensive type definitions and auto-completion for API responses, significantly reducing the need to consult external documentation. The current stable version is 4.1.4. While the project has seen bug fix releases in 2020-2021, its major version updates are less frequent, with v4.0.0 released in 2019. A key differentiator is its robust TypeScript support, providing static analysis benefits that many alternative plain JavaScript wrappers lack. However, it's important to note that this library currently supports only CircleCI API v1 and does not yet integrate with the newer CircleCI API v2, which is a known limitation the maintainers plan to address in the future.
npm install circleci-apiVerified import paths — ran on the pinned version, not inferred.
This quickstart initializes the CircleCI client and fetches the latest successful build artifacts for a specified repository and branch, demonstrating basic setup and API interaction.
Review the MIGRATING.md documentation (https://github.com/worldturtlemedia/circleci-api/blob/master/MIGRATING.md) to adjust function call signatures for updated parameter orders.
Be aware that only CircleCI API v1 functionality is available. For CircleCI API v2 interactions, consider alternative clients or direct HTTP requests until this library is updated.
If encountering type errors or missing properties, consider casting the response to `any` as a temporary workaround and/or contribute a pull request with improved type definitions.
Ensure you are using `circleci-api@4.1.2` or newer. If the problem persists, check your `tsconfig.json` for proper `typeRoots` configuration or node module resolution.
Upgrade `circleci-api` to the latest version (v3.3.1 fixed a specific path issue). Ensure `axios` is correctly installed as a direct dependency or peer dependency if required by your bundler configuration.
Double-check your `CIRCLECI_TOKEN` environment variable for correctness. Verify the `vcs.owner`, `vcs.repo`, and `options.branch` match an existing CircleCI project and branch with builds. Inspect the error response for more specific details.