Retrieve Historical 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 outside of your retention period by iterating through the data as required.


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.


Additional Resources:

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



Article is closed for comments.