# Command line

> The sigil command sends documents for signature from the shell, scripts and coding agents, and uploads files from disk. Sign in once; no key to manage.

`sigil` is a small command-line client for the API. It is the tool for scripts, for CI, and for coding agents such as Claude Code, Codex and Cursor, which work with files on disk: the [MCP server](/mcp) can only send templates that are already uploaded, while the CLI uploads the file in front of it. It is published on npm as [`@signwithsigil/cli`](https://www.npmjs.com/package/@signwithsigil/cli), MIT-licensed, with the source on [GitHub](https://github.com/signwithsigil/cli).

## Install

It needs Node.js 20 or later and has no other dependencies:

```bash title="Install"
npm install -g @signwithsigil/cli
sigil --version
```

```bash title="Run without installing"
npx @signwithsigil/cli --version
```

Upgrade with the same `npm install -g` command; the CLI only calls the public API, so an older version keeps working.

## Sign in

```bash
sigil login
```

Your browser opens a Sigil page; log in and allow the connection. The CLI keeps its tokens in `~/.config/sigil/credentials.json` (`%APPDATA%\sigil` on Windows), readable only by you, and refreshes them on its own. Using the API needs the **Pro or Business** plan.

Where a browser is not available, such as CI, set an [API key](/authentication) instead; it takes precedence over a sign-in:

```bash
export SIGIL_API_KEY="sgk_…"
```

`sigil logout` forgets the sign-in and revokes it on the server; `sigil whoami` shows the account, plan and documents left.

## Send a document

The shortcut takes a file (PDF or Word, with [glyphs](/concepts/glyphs) typed where the fields go) or a saved template's id, and one `--to` per signer, in signing order:

```bash
sigil send agreement.pdf \
  --to "Avery Lane <avery@example.com>" \
  --to "Sam Ortiz <sam@example.com>" \
  --cc records@example.com \
  --title "Consulting agreement with Acme" \
  --message "Please sign by Friday." \
  --lapse-days 14
```

```text title="Output"
Pact 7DXW69YJ sent: 2 signers, 1 document used.
Avery Lane <avery@example.com> has been emailed their signing link.
```

A file is uploaded as a one-off document; a template id (`sigil send 7DXW69YJ …`) reuses the saved one. Sending uses one document per 3 signers; the command refuses, before anything is sent, when the account has too few left.

## Commands

| Command | What it does |
|---|---|
| `sigil login` / `sigil logout` / `sigil whoami` | Sign in and out; show the account. `--no-browser` prints the URL to open by hand. |
| `sigil templates list` | Saved templates. |
| `sigil templates show <uid>` | One template with its fields. |
| `sigil templates upload <file> [--name …]` | Upload a PDF or Word file as a template. |
| `sigil templates delete <uid>` | Delete a template; pacts made from it keep their copy. |
| `sigil pacts list [--status active\|draft\|sent\|sealed\|declined\|voided\|lapsed\|all]` | Pacts, newest first. |
| `sigil pacts show <uid>` | One pact: recipients and their status, fields, events, download links. |
| `sigil pacts create (--template <uid> \| --file <path>) --to … [--cc …] [--title …] [--message …] [--lapse-days N] [--send]` | A draft, or sent straight away with `--send`. |
| `sigil pacts send <uid> [--lapse-days N]` | Send a draft. |
| `sigil pacts resend <uid>` | A fresh link for the signer whose turn it is. |
| `sigil pacts void <uid> [--reason …]` | Withdraw a pact that is out for signature. |
| `sigil pacts download <uid> [--signed \| --sigil] [-o file]` | The document as sent, the signed copy, or the sigil (certificate of completion). |
| `sigil send <file\|uid> --to … ` | Create and send in one go. |
| `sigil mcp` | A stdio bridge to the hosted MCP server, for clients that only start local servers. |

Every command takes `--json` to print the API's response unchanged, for scripts:

```bash
sigil pacts list --status sent --json | jq '.data[] | {uid, title, status}'
```

Exit codes: `0` success, `1` the API refused (the message is on stderr, in the API's words), `2` usage.

## In a coding agent

Claude Code, Codex and Cursor can run `sigil` like any other command once it is installed and signed in. Tell the agent to use it, or install the [Sigil plugin](/mcp/connect#claude-code), whose skill explains the flow: check `sigil whoami` for documents left, prefer a draft and show it before `sigil pacts send`, and never guess an email address.

## As a local MCP server

Some clients can only start local (stdio) MCP servers. `sigil mcp` is a bridge: it reads MCP messages on standard input, forwards them to the [hosted server](/mcp) with your sign-in, and writes the answers back. Sign in first with `sigil login`, then register the command:

```json title="Claude Desktop (claude_desktop_config.json)"
{
  "mcpServers": {
    "sigil": { "command": "sigil", "args": ["mcp"] }
  }
}
```

```json title="Any stdio client"
{
  "command": "npx",
  "args": ["-y", "@signwithsigil/cli", "mcp"]
}
```

Clients that connect to remote servers themselves (Claude, Claude Code, Codex, ChatGPT, Cursor, VS Code) do not need the bridge: give them the server URL as on [Connect a client](/mcp/connect).

## Environment

| Variable | Use |
|---|---|
| `SIGIL_API_KEY` | An API key instead of a sign-in (CI). |
| `SIGIL_API` | Another API host (also `--api <url>`), for testing against a local server. Default `https://api.signwithsigil.com/v1` without `/v1`; the sign-in page is found from it. |
| `NO_COLOR` | Plain output. |

## Source and issues

The CLI is open source under the MIT license: [github.com/signwithsigil/cli](https://github.com/signwithsigil/cli). Report a problem as an issue there, or through the [contact page](https://www.signwithsigil.com/contact).
