Retrieve Build Data via the API


Typically, build data will disappear after a set amount of time, based on your organization's plan. But what if I need data that is outside of my organization's plan? The CircleCI v2 API contains endpoints that will help retrieve build data on a regular basis so you can keep records going forward.


Steps to Retrieve Data:

  1. Retrieve a list of pipelines for a given project: Get all pipelines 
  2. Retrieve a list of workflows for a given pipeline by the pipeline ID: Get a pipeline’s workflows
  3. Retrieve the workflow data by the workflow ID: Get a workflow by ID
  4. Retrieve the jobs of a workflow by the workflow ID: Get a workflow’s jobs
  5. Store the retrieved pipeline, workflow, and job data in your chosen data stores
  6. Repeat steps as required with the next_page_token response from step 1

To expedite to process, we would recommend performing these steps in a script that can be reused and modified to suit your needs.



While this method may allow you to get build data that is outside of your retention period, it will not be able to get all build data for a project that is outside of your plan's retention period. This is why we recommend that users regularly retrieve their build data and store it securely.


Additional Resources:

Was this article helpful?
1 out of 1 found this helpful



Article is closed for comments.