Facebook Pixel
CLI

Command reference

Every global flag, environment variable, exit code and meta command in the ConnectSafely CLI, in one place.

Every command's own parameters are on the command reference page, generated from the same specification as the REST API docs. The binary carries the same information offline:

connectsafely commands                        # every command, one line each
connectsafely schema <command>                # exact parameters, as JSON
connectsafely <command> --help                # the same, formatted for a person

This page covers everything that is the same on every command.

Usage

connectsafely <command> [flags]

Command names are identical to the ConnectSafely MCP tool names, and to the operationId in the OpenAPI specification. One name always means one action, on all three surfaces.

Meta commands

CommandWhat it does
commandsList every command with a one-line summary. Accepts --search <term>, --group <name>, --kind read|write — classified by what the command does, not by HTTP verb
schema [command]Full parameter list as JSON. With no argument, every command's schema
batch <file|->Run a list of calls with pacing between writes. See Pacing
auth loginStore an API key in ~/.connectsafely/config.json (mode 0600)
auth statusShow the effective credentials and where each came from
auth logoutRemove the stored key, keeping other settings
skillPrint the router skill to stdout
skill listShow the eight skills in the pack and what each covers
skill install [name...]Write the pack into .claude/skills. Accepts --dir and --force. See Agent skills
helpThe command index
versionThe CLI version

commands, schema, help and skill need no API key and no network — they read the specification bundled in the binary.

Global flags

Every flag below works on every command and means the same thing everywhere.

Credentials and routing

FlagDescription
--api-key <key>API key. Prefer CONNECTSAFELY_API_KEY in CI and agent sandboxes
--account <id>LinkedIn account to act as. The global spelling of each command's --account-id
--base-url <url>API base URL. Defaults to https://api.connectsafely.ai
--spec <path>Use a local OpenAPI JSON instead of the bundled specification

Input

FlagDescription
--json <json>The whole request payload as JSON
--json @file.jsonRead the payload from a file
--json -Read the payload from stdin

Individual flags override keys of the same name inside --json. Any single string parameter also accepts @file and -, which is how a long post body avoids shell quoting entirely.

Output

FlagDescription
--output <mode>json, pretty, ndjson or markdown
--fields <mask>Keep only these response fields, e.g. people.firstName,people.headline
--max-items <n>Cap every array in the response at n entries
--quietSuppress progress on stderr
--verboseShow retry decisions and per-row batch progress on stderr
--no-colorDisable colour (also honours NO_COLOR)

--output defaults to pretty at an interactive terminal and json everywhere else — a pipe, a CI job, or a recognised agent runtime. See Cutting the cost of every answer.

Safety and reliability

FlagDescription
--dry-runResolve the whole request and print it. Send nothing
--yesConfirm a destructive command in a non-interactive shell
--idempotency-key <k>Make a retried write safe — a repeated key returns the first result
--retries <n>Attempts for retryable failures. Default 3
--timeout <ms>Per-attempt timeout. Default 60000

Batch only

FlagDescription
--pace <min-max>Seconds between writes. Default 30-90. A single number fixes the delay
--no-paceSend with no wait at all
--stop-on-errorHalt at the first failure instead of continuing

Skill install only

FlagDescription
--dir <path>Where to write. Defaults to .claude/skills
--forceReplace files you have already edited

Environment variables

VariableEffect
CONNECTSAFELY_API_KEYAPI key. The recommended way to authenticate
CONNECTSAFELY_ACCOUNT_IDDefault LinkedIn account for every command
CONNECTSAFELY_API_URLAPI base URL
CONNECTSAFELY_OUTPUTDefault output mode for the session
CONNECTSAFELY_SPECPath to a local OpenAPI JSON, replacing the bundled specification
CONNECTSAFELY_CONFIG_DIRDirectory for config.json. Defaults to ~/.connectsafely
CONNECTSAFELY_AGENTForce agent-style output regardless of terminal detection
NO_COLORDisable colour

Precedence is flag → environment variable → config file. connectsafely auth status reports which layer supplied each value, which is usually the fastest way to explain a surprise.

Exit codes

CodeNameWhat to do
0okContinue
1errorRead the envelope; do not retry blind
2authStop — the key is wrong or lacks the plan
3validationFix the named flag and retry
4confirm_requiredRe-run with --yes once intent is confirmed
5rate_limitStop this action for now; retrying will not help
6networkSafe to retry a read; verify before retrying a write
7unknown_commandRun connectsafely commands. Do not guess
8conflictRe-read state; the action may already have happened

Full detail, including the error envelope and the retry policy, is in When things go wrong.

Argument syntax

--flag value            # space-separated
--flag=value            # equals-separated, keeps any = inside the value
--flag                  # a boolean flag is true
--no-flag               # …and this makes it false
--flag a --flag b       # repeat for an array
--flag a,b              # or a comma list
--flag '["a","b"]'      # or JSON
-- --literal            # everything after -- is positional

Unknown flags are a hard error naming every offender at once. There is no fuzzy matching and no "did you mean" — see Not sending the wrong thing for why.

Command groups

The 87 commands are grouped for readability in --help. A command is always addressed by its own name, so a group can never appear in an invocation.

GroupCovers
Account & quotaConnected accounts, status, quota, invitations sent and received
Search & sourcingPeople, companies, jobs, groups, schools, geo lookups
Profiles & companiesFetching profiles, visits, endorsements, company followers
Relationship actionsConnect, follow, withdraw, respond to invitations
Inbox & messagingConversations, messages, attachments, reactions, sync
Posts & engagementPublishing, comments, reactions, reposts, media upload
AnalyticsSSI, network summary, creator dashboard, follower analytics
GroupsGroup details and membership
EventsEvent attendees
Sales NavigatorThreads and messaging
connectsafely commands --group inbox

The full list, with every flag and a runnable example per command, is on the command reference page.

On this page