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

# The Document object

> A record's notes (or a document page), rendered to markdown.

A **document** is the rich-text body behind a `notes`-type field on a
[record](/dev/api-reference/records) (and behind document pages). A record's
notes field doesn't hold the text. It holds the document's `doc_…` id. Fetch the
document to get the content, rendered to markdown.

<ResponseExample>
  ```json The Document object theme={null}
  {
    "id": "doc_3Ab9xK2mQ7",
    "markdown": "## Notes\n\nCustomer asked about volume pricing. Follow up after the pilot review."
  }
  ```
</ResponseExample>

## Attributes

<ResponseField name="id" type="string">
  Unique identifier, prefixed `doc_`. This is the value a record's notes-type
  field holds.
</ResponseField>

<ResponseField name="markdown" type="string">
  The document content rendered to markdown. Custral's internal rich-text representation is never exposed.
</ResponseField>

<Note>
  Two ways to get a record's notes as text: fetch the document directly by its
  `doc_` id (the **Retrieve a document** endpoint), or ask the record to inline
  it with [`expand=notes`](/dev/api-reference/records) on retrieve. One call, no
  second round-trip. Both need the `documents:read` scope.
</Note>

## Updating a document

Send markdown to the **Update a document** endpoint (`PATCH`) to replace a
document's content in full, by its `doc_` id. This is **update-only**, the
document must already exist (an unknown id returns `document_not_found`); there
is no create. The write merges into the document's live state, so an editor with
the document open sees the change immediately. Requires the `documents:write`
scope. The markdown you send is the markdown you get back on the next read.


## Related topics

- [The Object object](/dev/api-reference/objects.md)
- [Object Views](/data/objects/views.md)
- [Standard Objects](/data/objects/standard-objects.md)
- [Modifying Objects](/data/objects/modify.md)
- [Object Templates](/data/objects/templates.md)
