# Files & attachments

Govern bytes without prescribing their meaning.

Canonical page: /docs/content

## Upload then attach

files.upload transfers bounded bytes and verifies integrity. Append an attachment containing the returned file_id. The ledger contract controls attachment count, byte size and media types. JSON text remains ordinary record payload.

```shell
op-sys files upload --ledger-id <ledger-id> --file ./document.pdf --media-type application/pdf
```

- [Detailed contract and examples](/docs/raw/manuals/ledger-files.md)

## Read availability explicitly

files.get reports availability. files.download reads authorized bytes; --output-file saves a fully verified download. Missing, partial and erased files are distinct states. references.resolve performs an authorized record lookup, not a cross-ledger permission grant.

- [Detailed contract and examples](/docs/raw/manuals/ledger-files.md)

## Related guides

- [How ledgers work](/docs/raw/ledger-core.md)
