---
title: "The filing cabinet, newest first"
method: GET
path: "/api/v1/documents"
tags: ["Files"]
---

# The filing cabinet, newest first

`GET /api/v1/documents`

## Request

- Base URL: `http://localhost:5180`
- URL: `http://localhost:5180/api/v1/documents`
- Auth: API key in cookie `better-auth.session_token`

Every document with what it hangs off, whether the AI generated it or the owner uploaded it, and the date it expires where it has one. Expiry is what feeds the compliance calendar, so it is worth reading even on a document nobody has opened. `size` and `mimeType` are what the client claimed when it filed the record; what the account actually holds is at `/documents/{id}/content`, and a document may have no bytes at all.

## Response `200`

Documents and folders.

- object
  - `ok` unknown, required
  - `data` object, required
    - `documents` object[], required: Every document on file, newest first.
      - `id` string, required: Stable record id, e.g. `lse_012`.
      - `name` string, required
      - `kind` string, required: `lease`, `invoice`, `certificate`, `inspection_report` and the rest. This is the product’s own filing.
      - `mimeType` string, required
      - `size` number, required: Bytes.
      - `createdAt` string, required: ISO 8601 timestamp.
      - `links` object[], required: Every place the document is shown. A document can hang off any record, and off more than one; `folderId` is the folder that place files it in.
        - `kind` string, required
        - `id` string, required: Stable record id, e.g. `lse_012`.
        - `folderId` string: Stable record id, e.g. `lse_012`.
      - `expiresOn` string: Set on anything that expires, which is what feeds the compliance calendar.
      - `generated` boolean, required: True when the AI produced it rather than the owner uploading it.
      - `templateId` string: Stable record id, e.g. `lse_012`.
      - `language` 'en' | 'nl' | 'fr' | 'de': One of the four the product itself authors wording in: the clause library, the seeded messages, the words on a notice.
      - `folderId` string: No longer written. The folder is kept per place, on each of `links`.
      - `tags` string[], required
      - `status` 'withdrawn': `withdrawn` on a generated letter filed for a case that has since closed paid. Absent means the document stands.
      - `provenance` object, required
        - `actor` object, required
          - `kind` 'owner' | 'ai' | 'tenant' | 'contractor' | 'system' | 'channel', required: `ai` is Dardaris acting on the owner’s behalf. Everything it touches is marked.
          - `id` string: Stable record id, e.g. `lse_012`.
          - `name` string, required
        - `at` string, required: ISO 8601 timestamp.
        - `workflowRunId` string: Set when an automated run produced this, linking the record back to the run.
        - `reasoning` string: The rationale the AI recorded at the moment it acted.
    - `folders` object[], required: The folders the owner made, each scoped to one record.
      - `id` string, required: Stable record id, e.g. `lse_012`.
      - `name` string, required
      - `scope` object, required: What the folder hangs under. It is scoped to that record, so the same name under two apartments is two folders.
        - `kind` string, required
        - `id` string, required: Stable record id, e.g. `lse_012`.
      - `createdAt` string, required: ISO 8601 timestamp.
      - `provenance` object, required
        - `actor` object, required
          - `kind` 'owner' | 'ai' | 'tenant' | 'contractor' | 'system' | 'channel', required: `ai` is Dardaris acting on the owner’s behalf. Everything it touches is marked.
          - `id` string: Stable record id, e.g. `lse_012`.
          - `name` string, required
        - `at` string, required: ISO 8601 timestamp.
        - `workflowRunId` string: Set when an automated run produced this, linking the record back to the run.
        - `reasoning` string: The rationale the AI recorded at the moment it acted.
    - `objects` object[], required: One row per document that has bytes on the account, or an upload opened for it. A document with no entry here holds no file.
      - `documentId` string, required: Stable record id, e.g. `lse_012`.
      - `bytes` integer, required: What R2 counted once the bytes landed, not what the upload claimed.
      - `contentType` string, required: What the upload said the file is. Nothing opens the file to check it.
      - `mediaKind` 'photo' | 'video' | 'document', required: What the account calls this file, derived from its content type. A gallery asks for `photo` rather than reading types itself.
      - `checksum` string, required: The digest the object is addressed by, lower-case hex.
      - `checksumAlgo` 'md5' | 'sha256', required
      - `state` 'pending' | 'stored' | 'failed', required: Only a `stored` document can be downloaded. `pending` is an upload that was opened and never landed.
      - `uploadedAt` string, nullable, required: ISO 8601 timestamp.
      - `variants` object[], required: Copies derived once when the file landed and served from storage ever after. Ask for one with `?variant=` on the content route.
        - `variant` 'thumb' | 'display', required
        - `width` integer, required
        - `height` integer, required
        - `bytes` integer, required
  - `meta` object, required
    - `requestId` string, required: Echoed in the x-request-id header. Quote it in a bug report.

---

[API](https://skmtc.dev/dardaris/apis/dardaris-api.md) · [All operations](https://skmtc.dev/dardaris/apis/dardaris-api/llms.txt) · [OpenAPI document](https://skmtc.dev/dardaris/apis/dardaris-api/revisions/4aff33835c73?raw)
