CLI Quickstart
Thedl 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
node --version. The package installs dl and an equivalent draftlift command.
API keys and the CLI need a plan that includes API access. If your plan does not, CLI commands exit with code 2 and link to pricing.
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):
DRAFTLIFT_API_KEY supplies a key when no saved key is present.
dl whoami --json to check the account and available key details.
key.scopes lists the key’s permissions. key.workspace_id identifies the workspace when the key is restricted to one.
2. Add a reference material
References store text or source URLs. This CLI command saves the URL string; it does not fetch the page:--stdin. This is a power-user workflow, not native document upload:
3. Generate
This CLI generation does not attach the references saved above. Use a drafting surface with explicit reference selection when the output must use those sources.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?
--json and --help with concrete examples.
4. Finalize and follow up
After editing in the DraftLift editor, inspect the saved result:--dry-run to dl repurpose to preview the selected platform and template.
When calendar planning is available, set an editorial date with a future ISO 8601 timestamp that includes a time zone.
Workspaces
If your account has more than one workspace, every workspace-scoped command accepts a--workspace flag:
--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:Headless / agent loops
Use--json to read structured output from commands such as generate, score, and content get. These commands include a trace_id for logging. Error exit codes are 1 for input errors, 2 for authentication errors, 3 for server errors, and 4 for missing items.
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.