Skip to content
Get started

Create a workspace

client.WorkspaceAdmin.New(ctx, body) (*Workspace, error)
POST/v1/account/workspaces

Creates a new workspace in the account. Admin only.

ParametersExpand Collapse
body WorkspaceAdminNewParams
Metadata param.Field[WorkspaceAdminNewParamsMetadata]

CreateAccountResourceMetadata contains the user-provided fields for creating an account-scoped resource. Read-only fields (id, account_id, profile_id) are excluded since they are set by the server.

Name string

Human-readable name for the resource (e.g., “Production API Key”, “Staging Workspace”)

ExternalID stringOptional

External ID for the resource (e.g., a workflow ID from an external system)

Labels map[string, string]Optional

Arbitrary key-value pairs for categorization and filtering Examples: {“environment”: “production”, “team”: “platform”, “version”: “v2”}

Spec param.Field[WorkspaceSpec]
ReturnsExpand Collapse
type Workspace struct{…}

AccountResourceMetadata is used to represent a resource that is associated to an account but not to a workspace.

ID string

Unique identifier for the resource (prefixed ULID, e.g., “apikey_01HXK…”)

AccountID string

Account this resource belongs to for multi-tenant isolation (prefixed ULID)

Name string

Human-readable name for the resource (e.g., “Customer Support Agent”, “Email Tool”) Required for resources that users interact with directly

ProfileID string
ExternalID stringOptional

External ID for the resource (e.g., a workflow ID from an external system)

Labels map[string, string]Optional

Arbitrary key-value pairs for categorization and filtering Examples: {“environment”: “production”, “team”: “platform”, “version”: “v2”}

Description stringOptional
Status WorkspaceStatusOptional

Lifecycle status of the workspace. Archived workspaces reject all requests scoped to them. Server-populated.

formatenum
One of the following:
const WorkspaceStatusStatusEnabled WorkspaceStatus = "STATUS_ENABLED"
const WorkspaceStatusStatusDisabled WorkspaceStatus = "STATUS_DISABLED"
const WorkspaceStatusStatusArchived WorkspaceStatus = "STATUS_ARCHIVED"

Create a workspace

package main

import (
  "context"
  "fmt"

  "github.com/cadenya/cadenya-go"
  "github.com/cadenya/cadenya-go/option"
)

func main() {
  client := cadenya.NewClient(
    option.WithAPIKey("My API Key"),
  )
  workspace, err := client.WorkspaceAdmin.New(context.TODO(), cadenya.WorkspaceAdminNewParams{
    Metadata: cadenya.F(cadenya.WorkspaceAdminNewParamsMetadata{
      Name: cadenya.F("name"),
    }),
    Spec: cadenya.F(cadenya.WorkspaceSpecParam{

    }),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", workspace.Metadata)
}
{
  "metadata": {
    "id": "id",
    "accountId": "accountId",
    "name": "name",
    "profileId": "profileId",
    "externalId": "externalId",
    "labels": {
      "foo": "string"
    }
  },
  "spec": {
    "description": "description"
  },
  "status": "STATUS_ENABLED"
}
Returns Examples
{
  "metadata": {
    "id": "id",
    "accountId": "accountId",
    "name": "name",
    "profileId": "profileId",
    "externalId": "externalId",
    "labels": {
      "foo": "string"
    }
  },
  "spec": {
    "description": "description"
  },
  "status": "STATUS_ENABLED"
}