Skip to main content

CLI Quickstart

The dl CLI is the fastest way to drive DraftLift from a terminal, a script, or an AI agent. This page takes you from a fresh install to your first generated draft.

Install

The CLI requires Node.js 22 or later. Verify with node --version.

1. Log in

dl login opens your browser, authenticates against DraftLift, and writes an API key to ~/.draftlift/credentials.json. If you cannot open a browser (CI, remote shell):
You can also set DRAFTLIFT_API_KEY in your environment — the CLI prefers it over the saved credentials file, which makes scripted use trivial:
dl whoami confirms who you are and surfaces the calling key’s metadata:
The key object is what we’ll iterate on next.

2. Add a reference material

References give DraftLift source material to draw on. Add one from a URL:
Or pipe text from disk via --stdin:
List what you have:

3. Generate

The first generation prints a content_id, the generated body, token usage, and an estimated cost. Pass --dry-run to preview the resolved platform and template, the requested workspace value, and the execution mode without spending tokens. If you omit --workspace, the preview shows null; the server chooses any API-key-bound or default workspace when you run the generation. Need to discover what’s available?
Each command supports --json and --help with concrete examples.

4. Finalize and follow up

After editing in the DraftLift editor, inspect the saved result:
You can also score, schedule, or repurpose without leaving the terminal:

Workspaces

If your account has more than one workspace, every workspace-scoped command accepts a --workspace flag:
Pass it as a global option to apply to any subcommand:
If your API key is bound to a single workspace at creation time, you can omit --workspace — the server resolves it for you. Passing a different --workspace value against a bound key returns 403 workspace_mismatch. See API Key Scopes & Workspace Binding for the full model.

Scopes in practice

API keys carry one or more scopes. The CLI maps scope errors to a typed exit code (2) with the upgrade URL on its own line:
To fix: re-issue the key from Settings → API Keys with the Write checkbox enabled. See API Key Scopes & Workspace Binding for guidance on choosing scopes.

Headless / agent loops

The CLI is designed to be driven by other programs. Every command supports --json, returns a trace_id you can log, and uses non-zero exit codes for typed errors (1=user, 2=auth, 3=server, 4=not found). A minimal agent loop:

Next steps

API Key Scopes

Choose the right scopes and decide when to bind a key to a workspace.

Authentication

Full reference for keys, scopes, workspace binding, and error shapes.

API Overview

Use the same endpoints from any HTTP client.

Templates as Vessels

Understand how templates shape output across platforms.