> ## Documentation Index
> Fetch the complete documentation index at: https://docs.okrapdf.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Install the Okra CLI and work with PDFs from your terminal.

## Install

```bash theme={null}
npm install -g @okrapdf/cli
```

The package installs the `okra` binary. For one-off usage:

```bash theme={null}
npx @okrapdf/cli --help
```

## Authenticate

```bash theme={null}
export OKRA_API_KEY=okra_sk_YOUR_KEY

okra auth set-key "$OKRA_API_KEY"
okra auth status
```

## Upload a PDF

```bash theme={null}
okra upload ./report.pdf
okra upload https://example.com/report.pdf
```

## Ask a question

```bash theme={null}
okra chat "What is total revenue?" --doc doc-abc123
```

## Extract structured data

```bash theme={null}
okra extract ./invoice.pdf \
  --schema ./invoice.schema.json \
  --prompt "Extract vendor, total, currency, and due date"
```

## Read markdown

```bash theme={null}
okra read doc-abc123 --pages 1-3
```

## Machine and agent output

When stdout is not a TTY, most `okra` commands automatically emit a structured JSON envelope. You can also force this in an interactive terminal with `--json`:

```bash theme={null}
okra context resolve "https://example.com/report.pdf" --json
okra extract ./invoice.pdf --schema ./schema.json --json
```

The envelope returns a uniform success/failure shape with `ok`, `result`, `cost`, `citations`, and `next_actions`. See the [CLI Reference](/cli/reference) for the full envelope contract, stable error codes, and agent stop-gate rules.

## What's next

<CardGroup cols={2}>
  <Card title="Extract" icon="file-pdf" href="/cli/extract">
    Structured extraction flags and examples.
  </Card>

  <Card title="Chat" icon="message" href="/cli/chat">
    Ask questions against a processed document.
  </Card>

  <Card title="Collections" icon="list-check" href="/cli/collections">
    Query across multiple documents.
  </Card>

  <Card title="Reference" icon="terminal" href="/cli/reference">
    Auth, environment variables, and global flags.
  </Card>
</CardGroup>
