- My goal: I want to create environments automatically and resources for those environments via a trigger (manual or when an new environment is spun up)
- Issue: So far I can create new environments via API but I dont see a way to create new resources for that environment
- Steps I've taken to troubleshoot: Create a resource | Retool Docs
- Additional info: Cloud, Enterprise account
Hey @brynette
Thanks for reaching out to the Retool community!
For when you are using the REST API call to the <baseURL>/api/v2/resources endpoint, are you running into any errors or issues creating a resource? This is the right endpoint for creating a resource for Retool via the API.
Let me know any details on what those might be by including some screenshots of any errors or queries you might be using. I can help diagnose what might be going wrong here.
Regards,
John | Retool Support
Hey John, I have no issues with creating a resource but it creates it with the default production environment with no option to tie it to additional environments that we have configured in our account.
Our use case is that we will create ephemeral environments, like pr-124. Ideally, we can have a script to create the environment and its resources via the Retool API.
So far I have been able to:
- Create an environment
- Create a resource
But I’m not able to create a resource for an environment other than production from the API.
Hey @brynette
Thanks for reaching back with those details.
For the other physical environments, are you using the varying URLs for those? Normally you will need to be specific to any URLs of said environment for the API to work properly. Whether thats a Retool Space or a totally different deployment, each is going to have a unique URL we need to leverage for the API.
This page sort of walks through that by showing the changing URLs. Automate Spaces configuration using the Retool API | Retool Docs
If this is for an actual “Environment” in your Retool instance, then this would not work/be possible. By default in Retool, all Resources need a Production version so that may not be possible/explain why this might not work. There is this endpoint too which might be what you are looking for if that first key point is okay. Create resource configuration | Retool Docs
Let me know if you can share any of the requests you are sending off via the commands themselves or screenshots, along with any errors that are generated. I can do my best to get it all sorted from there ![]()
Regards,
John | Retool Support