dbt Cloud API get to return job status and which models failed

The problem I’m having:

I would like to use the dbt Cloud API to get job run details. Specifically which models failed. What is the API endpoint to query? I can use http://cloud.getdbt.com/api/v2/accounts/account/runs/jobrunid and get data.status_humanized to see “Error” but I want to see which models had the failure(s). I can query https://cloud.getdbt.com/api/v2/accounts/account/runs/jobrunid/?include_related=[“run_steps”] and see which command had errors but is there a way to succinctly get just the models that had a failure?

The context of why I’m trying to do this

I am hitting the dbt Cloud endpoints using a Web activity from ADF and wanting to save the output to a variable and then based on that display the error and fail the activity or move forward with the next step in our ELT process.

Thanks for any help!

  1. You could download (using the API) the run_results.json artifact that is generated after each run.
  2. The discovery API I think can tell you the status of models for the run.

Note: @Jeremy Yeo originally posted this reply in Slack. It might not have transferred perfectly.

@a_slack_user Thanks for your help. I am somewhat new to API calls. When I try a GET with https://cloud.getdbt.com/api/v2/accounts/1/runs/1/artifacts/run_results.json using my account and my run id, I get a 404 Not Found error in Postman. Should I be calling it in a different way or is this only returned if we are above dbt v 1.0 for now? Thank you!