---
title: "Say what a document is"
method: POST
path: "/api/v1/reading/sort"
tags: ["Portfolio"]
---

# Say what a document is

`POST /api/v1/reading/sort`

## Request

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

Takes the first pages of a file, as pictures, and answers with the kind of document it is, who it is about and the words that decided it. It is what lets an owner hand in a folder rather than label every file: the lease in it is then read as a lease, and everything else is filed as what it turned out to be. Nothing is written: the answer goes back to the screen that asked.

## Response `200`

What the document is.

- object
  - `ok` unknown, required
  - `data` object, required
    - `kind` 'lease' | 'lease_annex' | 'id_document' | 'proof_of_income' | 'correspondence' | 'inspection_report' | 'certificate' | 'insurance_policy' | 'statement' | 'invoice' | 'receipt' | 'tax_document' | 'lease_termination' | 'lease_amendment' | 'other', required: What the document is. `other` where it is nothing this product recognises.
    - `confidence` number, required: 0 to 1, as the model gave it. A screen shows a low one rather than hiding it.
    - `person` string, nullable, required: Who the document is about, where it is about one person.
    - `title` string, nullable, required: A short name for it, in its own language.
    - `evidence` string, nullable, required: The words on the page it was decided from.
    - `by` 'vision_model' | 'nothing', required: `nothing` where no model answered, which is not the same as an unrecognised document.
  - `meta` object, required
    - `requestId` string, required: Echoed in the x-request-id header. Quote it in a bug report.

## Other responses

- `400`: No page, a page that is not a picture, or more bytes than it reads.
- `429`: Over the reading budget.

---

[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)
