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

# Append

> Append newline-delimited records from stdin, files, or pipelines with the S2 CLI, including options for concurrency control and encrypted streams.

Append records to a stream. Each newline-delimited input becomes one record.

### From stdin

```bash theme={null}
echo -e "hello world\nfoo bar\nthird record" \
  | s2 append s2://my-basin/my-stream
```

```
✓ [APPENDED] 0..3 // tail: 3 @ 1771390606217
```

### From a file

```bash theme={null}
s2 append s2://my-basin/my-stream -i records.txt
```

### Interactive

Start an interactive append session where each line you type becomes a record:

```bash theme={null}
s2 append s2://my-basin/my-stream
```

### Piping from another process

```bash theme={null}
nc starwars.s2.dev 23 | s2 append s2://my-basin/starwars
```

### Encrypted streams

```bash theme={null}
export S2_ENCRYPTION_KEY="$(openssl rand -base64 32)"

echo "top secret" | s2 append s2://my-basin/my-stream
```

Or provide the key explicitly:

```bash theme={null}
echo "top secret" | s2 append s2://my-basin/my-stream \
  --encryption-key-file ./stream-key.b64
```

### Options

| Flag | Description |
| - | - |
| `-f, --fencing-token` | Enforce fencing token. |
| `-m, --match-seq-num` | Enforce that the sequence number issued to the first record matches. |
| `--format` | Input format. |
| `--linger` | How long to wait for more records before flushing a batch. |
| `-i, --input` | Input newline delimited records to append from a file or stdin. Use `-` to read from stdin. |
| `-k, --encryption-key` | Base64-encoded encryption key material. Alternatively, set `S2_ENCRYPTION_KEY`. |
| `--encryption-key-file` | Read base64-encoded encryption key material from file. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.