# --input-format Flag

> It sets how claude -p reads what you send it.

**Field:** Artificial Intelligence  
**Category:** Claude Code  
**Also known as:** claude --input-format, --input-format stream-json, --replay-user-messages

## Think of it like

It is like you pass notes to a friend one at a time. You do not send one big letter.

## Definition

--input-format sets how claude -p reads what you send it. text, the default, reads one prompt. stream-json reads one JSON message per line, so a program can keep sending messages into the same run. It goes with --output-format stream-json. Add --replay-user-messages to have each message echoed back once it is taken.

## Example

Jack's chat app keeps one Claude run open. Each time the user types, the app sends one JSON line in, and reads the reply lines that come out.

## Example code

```bash
claude -p --input-format stream-json --output-format stream-json --verbose
```

Talk to one run in JSON lines, both ways.

## Why it matters

One run can take many messages, so an app does not start a new session for each one.

## Common mistake

Sending plain text lines with stream-json set. Each line has to be a JSON message.

## Three principles

- **text.** One prompt.
- **stream-json.** A message per line.
- **--replay-user-messages.** Echo each one back.

## Related terms

- [--output-format Flag](https://learn.benibix.com/term/ai/output-format-flag)
- [Non-Interactive Mode](https://learn.benibix.com/term/ai/non-interactive-mode)

## Taught in

- [Print Mode Output Flags](https://learn.benibix.com/learn/ai-claude-code-commands/print-mode-output-flags): Claude Code Commands, 14/17

![A stream-json run prints one event per line. Each stream flag adds one more kind of line.](https://learn.benibix.com/diagrams/flag-stream.svg)

---

Source: https://learn.benibix.com/term/ai/input-format-flag
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-16
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
