Need API for connect project with Tenants and Environment

Hi Team,

From the UI we can connect the project with particular tenant and environment .

I am trying to with api , but I could not find it one, so kindly please help me on this.

Hi @YuvarajDuraisamy,
Thanks for reaching out and welcome to the community!

You can always see how Octopus makes its API calls by bringing up the developer tools (F12) built into most browsers. If you do that and add or modify a tenant you will see an API POST call to the /tenants endpoint. You can view the swagger documentation for that endpoint on your instance by following the instructions here.

Additionally, you might find this blog post helpful as it goes through the process of creating tenants from environments and therefore will do a lot of similar things as what you may be trying to accomplish. In particular, if you look at the first script and expand that createtenantsfrom_environments.ps1, towards the bottom it has the necessary calls depending on if you are creating a new tenant or modifying an existing one:

  • POST to /tenants for creating a new tenant
  • POST to /tenants/$($existingTenant.Id) for modifying existing tenant

The critical bit in the body of the POST you are looking for will be the ProjectEnvironments object. It will look something like the following and will contain the projects and it’s environments you want to tie that tenant to.


I hope this helps, and please let us know if there is any additional questions you may have.

Happy deployments!

Thanks for the response , let me check and update.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.