Octopus Deploy Documentation

Create a channel

Last updated

This script demonstrates how to programmatically create a channel in Octopus Deploy.


Provide values for:

  • Octopus URL
  • Octopus API Key
  • Name of the space to use
  • Name of the channel to create
  • ID of the project to add the channel to


package main

import (


func main() {
	octopusURL := os.Args[1]
	space := os.Args[2]
	name := os.Args[3]
	projectID := os.Args[4]

	fmt.Println("Enter Password Securely: ")
	apiKey, err := terminal.ReadPassword(0)

	if err != nil {

	APIKey := string(apiKey)

	octopusAuth(octopusURL, APIKey, space)
	CreateChannel(octopusURL, APIKey, space, name, projectID)


func octopusAuth(octopusURL, APIKey, space string) *client.Client {
	client, err := client.NewClient(nil, octopusURL, APIKey, space)
	if err != nil {

	return client

func CreateChannel(octopusURL, APIKey, space, name, projectID string) *model.Channel {
	client := octopusAuth(octopusURL, APIKey, space)
	Channel, err := model.NewChannel(name, projectID, "New channel")

	if err != nil {


	return Channel

Need support? We're here to help.