nohead is the command-line interface for Nohead, for developers, CI and coding agents. It calls the public API through the TypeScript SDK, so it can do what an API key can, and every change it makes is recorded in history as made via the CLI. The command reference lists every command; nohead <command> --help prints the same for one.
Install
The CLI needs Node 26 or newer.Sign in
nohead login opens Nohead’s approval page in your browser, as an app connecting to the MCP server does. Choose the projects the CLI may work in, or All my projects (current and future), whether it may change records and assets, and whether it may change collections and fields, which schema push needs; both start ticked. Allow it only if your own terminal just started it. The CLI then works as you, within your role in those projects, and its sign-in renews itself.
Where no browser opens, as over SSH, the CLI prints a link to open on any device, and the page shows a code to paste into the terminal. With no terminal either, as for a coding agent, nohead login prints the link and exits: open it, choose Allow, and finish with nohead login --code <the code it shows> within a minute.
One sign-in covers its projects: choose one for a command as below, or none when it reaches only one. It is listed as Nohead CLI under Connected apps on your Account page, where you can revoke it, and it ends when it goes unused for 90 days or you delete your account. nohead logout signs the CLI out and revokes it.
The sign-in is for the CLI alone: the SDKs read NOHEAD_API_KEY from the environment, not the CLI’s sign-in. For an app, create a key under API keys in the web app and set it as NOHEAD_API_KEY in the app’s environment.
To use an API key you already have, pipe it in: echo "$NOHEAD_API_KEY" | nohead login, or from the clipboard, pbpaste | nohead login on macOS (wl-paste or xclip -o on Linux, Get-Clipboard in PowerShell). The CLI saves it for its project, in a file only you can read, and uses it in that project instead of the sign-in; there, nohead logout forgets the key, which stays valid until you revoke it in the web app.
Projects
A command works in the first of:--project <id>NOHEAD_PROJECT- the project in the nearest
nohead.json, in the current folder or a folder above it - the project of the only saved key
- the only project the sign-in reaches
2 and says how to choose one. nohead whoami shows the project in use and where it came from.
nohead link writes nohead.json, { "project": "prj_..." }, in the current folder. It holds no secret, so commit it: each teammate signs in once, and a coding agent working in the folder stays in its project too. To unlink a folder, delete its nohead.json.
In CI, or for an agent that should act with a key of its own, set NOHEAD_API_KEY instead of logging in. It wins over saved keys and the sign-in, and works in its own project (or the one given with --project or NOHEAD_PROJECT); nohead.json doesn’t apply to it.
Configuration
Flags win over environment variables, which win overnohead.json, saved keys and the sign-in.
Output and exit codes
Scripts and agents can rely on this:- stdout carries only results. With
--json, exactly one JSON document, the API’s representation;records exportwrites JSON Lines. - stderr carries errors, summaries and diagnostics. With
--json, errors use the API’s error envelope,{ "error": { "type", "message", "request_id", "details" } }. - Exit codes:
0success,1an API error (validation, authentication, permission, not found, a stale revision, a plan limit, import failures),2a usage error (bad arguments, no API key, unreadable files),3the API or storage unreachable,4an unexpected failure in the CLI (NOHEAD_DEBUG=1prints the stack). - Retries: up to 3, reported on stderr. A
429is retried after itsRetry-After(up to 60 seconds); network failures and500,502,503and504with backoff. Every write carries anIdempotency-Key, so a retry never writes twice. - Deleting a collection and discarding a draft need
--yes; a discarded draft can’t be restored. Everything else is soft-deleted and can be restored.
Lists and filters
A list prints one page and ends withMore: --cursor <cursor> when there are more. A page holds 100 (audit: 20), and --limit n sets another size, up to 100. search prints the top 20 results, or --limit n up to 100, without pages. --cursor <cursor> prints the next page, and --all follows the cursors and prints everything. With --json, a page prints as the API returns it (data and meta.next_cursor), and --all as { "data": [...] }.
--filter takes key=value, key!=value, key<value (and >, <=, >=), "key in a,b" (\, for a comma in a value), "key exists" and "key !exists". Several on one key combine:
today, and dates with a time now. records list --status published (or unpublished) filters by published_at; across a whole project, search filters with "published_at exists" (or !exists). Reading content has how filters match.
Records and drafts
Record data comes from--set key=text, --set key:=json (numbers, booleans, null, lists, objects), --data '{...}' and --data-file <path|->. update changes only the fields given; --set key:=null clears one.
--if-revision n refuses the change if someone changed the record since revision n. records schedule publishes or unpublishes later: a time is ISO 8601 with a time zone (2026-10-01T09:00:00Z), an offset from now (+30m, +2h, +3d, +1w), or none to clear one. records scheduled <collection> lists what is coming. A draft holds changes until it is merged, now (drafts merge) or at --merge-at; drafts create and update take the same data flags as records.
Fields and migrations
Field options are flags:--description, --options a,b (enum), --target <collection> (relation), --max-length n, --min n and --max n, --include-time and --time-zone <zone> (dates), --format slug|url|email and --unique (text), and --searchable, --filterable, --sortable (each with a --no- form). Field types accept rich-text or rich_text.
fields migrate changes a field in a way that rewrites record values: its type, single or multiple, a stricter configuration, or required with a backfill. Run it with --dry-run first to see how every record converts. Without --no-wait it waits for the migration and exits non-zero if it fails or is cancelled. While it runs, the collection’s fields can’t change, and once it is running its records can’t either. Field migrations has the rules.
Schema as code, export and import
schema pull, schema diff and schema push keep a collection’s model in nohead.schema.yaml in your repository: Schema as code.
export --output <dir> writes a project’s schema, records, drafts and asset metadata (--include-history, --include-deleted, and --include-files for the originals). import <dir> recreates them in another project: the schema first, then the records, relinking relations to the new IDs, then the drafts. Every request has an idempotency key derived from the export, so re-running an interrupted import within 24 hours doesn’t duplicate anything. Imported records start a new history.
Source
The CLI is open source, under the MIT license. Report issues and follow releases on GitHub:nohead-io/nohead-cli
Loading repository data...