# Flags, Output and Exit Codes

Global flags every LinkedIn CLI command accepts, the output format, and the exit codes scripts can rely on.

`linkedin` commands share global flags, an output format and exit codes. This page describes all three, with the few commands that differ.

## Global flags

Every command that calls Linked API supports these flags. The local commands `setup`, `reset` and `account …` print plain text and take none of them: `account list` ignores them, and the others reject them as unknown flags.

| Flag | Description |
| --- | --- |
| `--json` | Structured JSON output to stdout |
| `--fields name,url,...` | Select specific fields in output |
| `--quiet` / `-q` | Suppress stderr progress |
| `--no-color` | Disable colors |
| `--account "Name"` | Use a specific account for this command. Admin commands do not take it – they use the current account's Linked API token; switch with `linkedin account switch` |

## Output format

**JSON mode** (`--json` or non-TTY stdout):

```json
{"success": true, "data": {"name": "Vlad Prudnikov", "headline": "CEO at Linked API"}}
```

```json
{"success": false, "error": {"type": "personNotFound", "message": "Person not found"}}
```

**Human mode** (TTY stdout): key-value pairs for objects, tables for arrays.

Request errors – invalid tokens, rate limits, a subscription that does not allow the action – are written to stderr as `{"error": "…", "message": "…"}` and set the exit codes below. `linkedin changelog` is the one command that prints its response as is, without this envelope and without `--fields` – see [Changelog](/cli/getting-started#changelog).

## Exit codes

| Code | Meaning |
| --- | --- |
| `0` | Success (check `success` field – action may have returned an error like "person not found") |
| `1` | General/unexpected error |
| `2` | Missing or invalid tokens, or a usage error caught by the argument parser – a missing required argument or flag, an unknown flag, or a value outside the allowed list; the message is on stderr |
| `3` | Subscription/plan required |
| `4` | LinkedIn account issue |
| `5` | Invalid arguments rejected by the command's own checks, or by the API as `invalidRequestPayload` or `invalidWorkflow` |
| `6` | Rate limited |
| `7` | Network error |
| `8` | Workflow timeout (workflowId returned for recovery) |
