# `Beancount.Directives.Document`
[🔗](https://github.com/thanos/beancount_ex/blob/v0.6.0/lib/beancount/directives/document.ex#L1)

The `document` directive links a file to an account at a date.

See [Documents](https://beancount.github.io/docs/beancount_language_syntax/#documents).

## Beancount syntax

    2026-01-01 document Assets:Bank "statements/2026-01.pdf"

General form: `YYYY-MM-DD document Account "Path"`

## Elixir struct

    %Beancount.Directives.Document{
      date: ~D[2026-01-01],
      account: "Assets:Bank",
      path: "statements/2026-01.pdf",
      metadata: %{}
    }

Or use `Beancount.document/4`:

    Beancount.document(~D[2026-01-01], "Assets:Bank", "statements/2026-01.pdf")

## Fields

  * `date` - `Date.t()` the document is associated with.
  * `account` - account the file belongs to (often Assets or Liabilities).
  * `path` - relative or absolute file path string.
  * `metadata` - optional map rendered below the directive.

# `t`

```elixir
@type t() :: %Beancount.Directives.Document{
  account: String.t(),
  date: Date.t(),
  metadata: map(),
  path: String.t()
}
```

---

*Consult [api-reference.md](api-reference.md) for complete listing*
