When to use
- An AI agent (or a user in a fresh terminal) needs a working Codika
cko_API key and can receive email — but can’t open a browser, run OAuth, or visit the dashboard. - The user wants to sign up for Codika and start deploying workflows in a single shell session.
- A CI/CD job needs a short-lived key scoped to one organization, minted without leaving the terminal.
codika login --api-key cko_…) still works — see authentication. This page documents the alternative: OTP-based self-provisioning.
How it works
Two commands per flow. The backend sends a 6-digit code to the email; the CLI sends the code back; the backend mints acko_ key and returns the raw key exactly once. The CLI saves it as a new profile in ~/.config/codika/config.json and activates it.
| Constant | Value |
|---|---|
| Code length | 6 digits |
| TTL | 10 minutes |
| Failed-attempt lockout | 5 attempts → code deleted |
| Min resend interval | 30 seconds |
| Per-email cap | 20 requests / hour |
| Per-IP cap | 60 requests / hour |
codika auth signup-request
Request an OTP for a brand-new signup.Options
| Option | Description |
|---|---|
--email <email> (required) | Email address to register |
--base-url <url> | Codika API base URL override (default: production) |
--api-url <url> | Full URL to the cliRequestSignupOtp endpoint (overrides --base-url) |
--json | Emit JSON output |
Response (--json)
Errors
| Code | Status | Meaning | Next action |
|---|---|---|---|
EMAIL_REQUIRED / EMAIL_INVALID | 400 | Missing or malformed email | Fix the flag |
USER_ALREADY_HAS_ORGANIZATION | 409 | Email already owns an org | Switch to login-request |
OTP_RESEND_COOLDOWN | 429 | Request spam (within 30s) | Wait details.retryInSeconds |
EMAIL_RATE_LIMITED | 429 | 20+ requests/hour from this email | Wait and retry |
IP_RATE_LIMITED | 429 | 60+ requests/hour from this IP | Wait and retry |
INTERNAL | 500 | Backend hiccup | Retry in a few seconds |
codika auth signup-complete
Verify the OTP and, in one atomic flow, create the Firebase Auth user, create the organization (with n8n error workflow + webhook auth credential seeded), and mint acko_ API key with the 10 default scopes.
Options
| Option | Description |
|---|---|
--email <email> (required) | Email that received the OTP |
--code <code> (required) | 6-digit code from the email |
--company <name> | Organization name (default: “My Organization”) |
--description <text> | Optional organization description |
--key-name <name> | Label for the minted API key (default: “CLI default key”) |
--key-expires-in <days> | 1–365; omit for no expiry |
--name <name> | Local profile name (auto-derived from org name if omitted) |
--base-url <url> / --api-url <url> | URL overrides |
--json | Emit JSON output |
Response (--json)
~/.config/codika/config.json and does not appear in the JSON output (other than masked) after save. It is only available inside the CLI’s profile.
Errors
| Code | Status | Meaning | Next action |
|---|---|---|---|
OTP_INVALID | 400 | Wrong code (details.attemptsRemaining) | Re-read email, retry |
OTP_NOT_FOUND | 404 | No pending code for this email | Re-run signup-request |
OTP_EXPIRED | 410 | Code older than 10 minutes | Re-run signup-request |
OTP_ALREADY_USED | 409 | Code already consumed | Re-run signup-request |
OTP_PURPOSE_MISMATCH | 409 | Crossed signup/login codes | Re-run the matching request |
OTP_LOCKED_OUT | 429 | 5+ failed attempts | Re-run signup-request |
USER_ALREADY_HAS_ORGANIZATION | 409 | Raced with another signup | Switch to login-* |
COMPANY_NAME_TOO_LONG | 400 | --company > 100 chars | Shorten |
INVALID_EXPIRES_IN_DAYS | 400 | --key-expires-in outside 1–365 | Fix or omit |
ORGANIZATION_CREATION_FAILED | 400–500 | Backend rejected org creation | Surface message, retry |
INTERNAL | 500 | Backend hiccup | Retry |
codika auth login-request
Same shape assignup-request, but for existing accounts.
Errors specific to login
| Code | Status | Meaning | Next action |
|---|---|---|---|
USER_NOT_FOUND | 404 | No account for this email | Switch to signup-request |
USER_HAS_NO_ORGANIZATION | 409 | Account exists but no org | Switch to signup-request |
codika auth login-complete
Verify the OTP and mint a freshcko_ key for one of the user’s organizations.
login-complete mints a new key. Previous keys remain valid until revoked from the dashboard.
Multi-org handling
Codika users can belong to multiple organizations. If the user has more than one and--organization-id is not provided, the backend returns:
--organization-id <id>.
Other login-specific errors
| Code | Status | Meaning | Next action |
|---|---|---|---|
ORGANIZATION_NOT_MEMBER | 403 | --organization-id doesn’t match any of the user’s orgs | Pick from details.organizations |
MAX_API_KEYS_REACHED | 429 | Org already has 20 active keys | Revoke one from the dashboard, retry |
USER_HAS_NO_ORGANIZATION | 409 | All orgs were deleted between request and complete | Run signup-request |
Agent recipe — optimistic signup, fallback to login
See also
- Authentication — profile management, dashboard-paste flow, resolution priority
- Create Organization — standalone org creation via personal/admin key
- Create Organization Key — adding additional API keys to an existing org