---
title: "File a document from a link"
method: POST
path: "/api/v1/documents/from-url"
tags: ["Documents"]
---

# File a document from a link

`POST /api/v1/documents/from-url`

## Request

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

Downloads the file a link points at and files it as a document of the given `kind`, under every record in `links`. The way to file a file you hold only as a link, since the bytes cannot travel in a JSON call. The link has to be https, answer within 30 seconds and hold one file the filing takes, a photo, PDF or office document of 33554432 bytes or less. A link that needs a sign-in, a web page, an address rather than a host name, or more than 5 redirects is refused. The link itself is not kept, only its host.

## Request body

- object
  - `url` string, uri, required: An https link that downloads the file itself: a public or signed link, such as a presigned S3 URL or a Dropbox link ending `dl=1`. A link behind a sign-in, such as a private Google Drive file, cannot be read.
  - `kind` 'lease' | 'lease_annex' | 'inspection_report' | 'invoice' | 'receipt' | 'quote' | 'supplier_invoice' | 'certificate' | 'id_document' | 'proof_of_income' | 'insurance_policy' | 'deed' | 'floor_plan' | 'photo' | 'correspondence' | 'formal_notice' | 'statement' | 'tax_document' | 'lease_termination' | 'lease_amendment' | 'other', required: What the document is.
  - `links` object[], required: The records it is filed under: a unit, its lease, the tenant it is about.
    - `kind` 'building' | 'unit' | 'lease' | 'contact' | 'issue' | 'work_order' | 'invoice' | 'certificate' | 'task' | 'booking', required: What the record is.
    - `id` string, required: Stable record id, e.g. `lse_012`.
  - `name` string: What to call it in the filing. The file’s own name when left out.

## Response `200`

The document it is now filed as.

- object
  - `ok` unknown, required
  - `data` object, required
    - `documentId` string, required: The document it is now filed as.
    - `name` string, required
    - `kind` string, required
  - `meta` object, required
    - `requestId` string, required: Echoed in the x-request-id header. Quote it in a bug report.

## Other responses

- `400`: A link that cannot be read, a file the filing does not take or one too large, or a kind or link the filing does not take.
- `409`: The account is holding its 536870912-byte limit and this file would not fit.
- `429`: Too many files at once.

---

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