Documentation Index: Fetch llms.txt first to discover every published page. This page is also available as Markdown at /cli-overview.md.
Verified · 8/11/2026

What is the Primitive CLI?

The primitive CLI is an oclif-based terminal client that wraps the Node SDK and api-core to send mail, deploy Primitive Functions, manage payments, and administer your account without writing code.

The primitive CLI is a terminal client, built on the oclif framework, that exposes Primitive's email, payments, functions, and account operations as one-shot shell commands instead of SDK calls.

Install it separately from the Node SDK:

npm install -g primitive
primitive whoami
# `prim` is a short alias for the same binary
prim whoami

Install it as primitive. The same build is also published as primcli and the legacy scoped @primitivedotdev/cli, locked to the same version, for environments that already depend on those names.

No-install form:

npx primitive@latest <command>
Note

@primitivedotdev/sdk no longer ships a primitive bin. If you're embedding Primitive in application code, install the SDK directly; see Node.js SDK Quickstart. The CLI is for your shell and CI, not for import into a handler.

How it relates to the Node SDK and api-core#

The CLI wraps the Node.js SDK (@primitivedotdev/sdk) runtime client with one-shot commands. Internally, both the CLI and the Node SDK bundle the workspace-internal @primitivedotdev/api-core package inline, so the generated HTTP client, operation manifest, and PrimitiveApiClient error handling are shared code, not reimplementations.

For in-handler use, calling Primitive from inside a Primitive Function, import createPrimitiveClient from @primitivedotdev/sdk/api directly. The CLI is for operator and deploy workflows: signing in, sending test mail, deploying functions, managing secrets, from your terminal or CI pipeline.

The full codegen pipeline that produces this shared surface is covered in Architecture: Shared Codegen Pipeline.

Command style: task-oriented vs. generic#

Most day-to-day work uses task-oriented commands with mnemonic names and curated flags:

primitive send --to alice@example.com --body "Hello"
primitive reply --id <inbound-email-id> --body "Thanks"
primitive emails list
primitive emails get --id <inbound-email-id>
primitive functions templates
primitive functions init my-fn --template email-reply
primitive memories set thread:latest '{"email_id":"em_123"}'
primitive deliveries replay --id <delivery-id>

Every generated OpenAPI operation also remains reachable directly, for full schema parity or when no task-oriented command exists yet:

primitive emails:list-emails
primitive sending:reply-to-email
Task-oriented commandsGeneric operation commands
NamingMnemonic verbs (send, reply, functions deploy)<tag>:<operation-id> (kebab-case)
FlagsCurated, common defaults pre-filledFull parity with the OpenAPI operation's parameters
When to useEveryday workflows, scripts, CIAdvanced/uncommon operations, exploring the full API surface
Discoverabilityprimitive --help, primitive <group> --helpprimitive list-operations, primitive describe

See Direct API Access and Generic Commands for the api-command shortcut, list-operations, and describe in detail.

Command groups#

The CLI's command surface maps directly onto Primitive's operation domains:

GroupExample commandsCovered on
Authlogin, signin, signup, logout, whoamiAuthentication
Emailsend, reply, emails list, search, semantic-searchSending, Replying, and Searching Email from the CLI
Domains & routingdomains-zone-file, routes add/list/remove/reorderManaging Domains and Recipient Routes
Functionsfunctions init/deploy/redeploy/test/logsPrimitive Functions: Deploy, Route, and Manage
Org secretsorg-secrets-list/set/removeOrg Secrets Management
Paymentspayments register-payout-address/charge/pay/pay-emailx402 Payments from the CLI
Wake scheduleswake-schedules-*, wake-authorizations-*Wake Schedules and Authorizations
Memories & chatmemories set/get/search/delete, chatMemories and Chat Commands
Payloadspayloads push/pullPayloads Command: Streaming Large Attachments from the CLI
Inboxinbox-setup, inbox-statusInbox Setup and Status
Agent upgradeagent-upgradeAgent Account Upgrade from the CLI
Generic API access<tag>:<operation-id>, list-operations, describeDirect API Access and Generic Commands

A concrete example: functions deploy#

primitive functions deploy shows the pattern the whole CLI follows: a task-oriented command that wraps a generated operation and adds terminal-specific ergonomics (reading a file off disk, an optional wait loop, stderr hints) around it.

primitive functions templates
primitive functions init my-fn
cd my-fn && npm install && npm run build
primitive functions deploy --name my-fn --file ./dist/handler.js

Under the hood this calls the same createFunction generated operation available as primitive functions:create-function, but reads the bundle from --file instead of requiring you to shell-escape an entire ESM module into a JSON body. Passing --secret KEY=VALUE fans the same command out into create-functionset-secret per pair → a final update-function redeploy, so the running handler picks up the bindings in one call. See Primitive Functions: Deploy, Route, and Manage for the full flag surface.

What the CLI does not own#

Several concepts the CLI exercises are explained in full elsewhere, not on this page:

Next steps#

Was this page helpful?

© Primitive SDKs

Powered by Browzer