Skip to main content

When to use

  • User needs an API key scoped to a specific organization for deployments or automation
  • Setting up CI/CD credentials for a team or client workspace
  • Creating keys for agents or scripts that trigger workflows within an org

Prerequisites

  • codika CLI installed and authenticated
  • Personal key (ckp_) or admin key (cka_) with api-keys:manage scope
  • Target organization must already exist (see Create Organization)

Command

codika organization create-key [options]

Options

OptionRequiredDescriptionDefault
--organization-id <id>YesOrganization ID to create the key for
--name <name>YesKey name (for identification)
--scopes <scopes>YesComma-separated list of scopes
--description <desc>NoKey description
--expires-in-days <days>NoNumber of days until the key expiresNo expiry
--api-url <url>NoOverride API URL
--api-key <key>NoOverride API key
--profile <name>NoUse a specific profile instead of the active one
--jsonNoJSON output

Available scopes

ScopeDescription
deploy:use-caseDeploy use cases, upload documents, and read metadata
projects:createCreate new projects via API
projects:readList and inspect project details
workflows:triggerTrigger workflows and poll execution status
executions:readList and read execution details
instances:readRead process instance details
instances:manageActivate, deactivate, and manage instances
skills:readDownload agent skill documents
integrations:manageCreate, delete, and list integrations
api-keys:manageCreate, update, and manage organization API keys

Behavior

  1. Validates that the authenticated key has the api-keys:manage scope
  2. Verifies the user is an admin or owner of the target organization
  3. Creates a new organization key (cko_) with the specified scopes
  4. Saves the new key as a profile and sets it as active
  5. Returns the raw key once — it cannot be retrieved again after creation

Examples

# Basic key creation
codika organization create-key \
  --organization-id "xwk9CcT440Vupa8soIhY" \
  --name "CI Deploy Key" \
  --scopes "deploy:use-case,workflows:trigger"

# With description and expiry
codika organization create-key \
  --organization-id "xwk9CcT440Vupa8soIhY" \
  --name "Agent Key" \
  --scopes "deploy:use-case,workflows:trigger,integrations:manage" \
  --description "Key for autonomous agent deployments" \
  --expires-in-days 90

# JSON output for scripting
codika organization create-key \
  --organization-id "xwk9CcT440Vupa8soIhY" \
  --name "Script Key" \
  --scopes "deploy:use-case,workflows:trigger" \
  --json

Output

✓ Organization API Key Created Successfully

⚠ Save the API key below — it will not be shown again.

  API Key:     cko_xxxxxxxxxxxxxxxxxxxx
  Key Prefix:  cko_xxxxxxxx
  Key ID:      abc123-def456
  Name:        CI Deploy Key
  Scopes:      deploy:use-case, workflows:trigger
  Created:     3/30/2026
  Request ID:  req-789

  Saved as profile "org-api-key-ci-deploy-key" (now active)
The raw key is displayed only once at creation time. Store it securely — it cannot be retrieved later.

Exit codes

CodeMeaning
0Success
1API error (auth, network, server)
2CLI validation error (e.g., missing --organization-id, --name, or --scopes)