dbt cloud has an API to use to call job from external applications.
Hello @ddumas,
Welcome to The Retool Community!
Yes, Retool can be used to trigger a dbt job run using the dbt Cloud API. Here's how you can set it up:
-
Generate API Token: Log in to dbt Cloud and create an API token in your profile settings.
-
Get Job ID: Find the Job ID in the dbt Cloud job settings (see the screenshot below).
-
Set Up API Resource in Retool: Add a new REST API resource with the base URL
https://cloud.getdbt.com/api/v2
, and use the API token as a Bearer Token. -
Create Query:
- Endpoint:
/accounts/{account_id}/jobs/{job_id}/run/
- Method:
POST
- Headers:
json
{
"Content-Type": "application/json",
"Authorization": "Bearer <your_api_token>"
}
- Body (optional):
json
{
"cause": "Triggered from Retool"
}
- Test the Query: Run the query to ensure it successfully triggers the job.
- Integrate in Retool: Add a button to trigger the query.
Optional: Add job status tracking and error handling for a smoother integration.
For more details, refer to the dbt Cloud documentation:
dbt Cloud API Documentation
Thank you!
1 Like
Thanks @WidleStudioLLP !
1 Like