---
title: "Upload a new document."
method: POST
path: "/v1/libraries/{library_id}/documents"
tags: ["beta.libraries.documents"]
---

# Upload a new document.

`POST /v1/libraries/{library_id}/documents`

Given a library, upload a new document to that library. It is queued for processing, it status will change it has been processed. The processing has to be completed in order be discoverable for the library search

## Path parameters

- `library_id` string, uuid, required

## Response `200`

A document with the same hash was found in this library. Returns the existing document.

- Document
  - `id` string, uuid, required
  - `library_id` string, uuid, required
  - `hash` string, nullable, required
  - `mime_type` string, nullable, required
  - `extension` string, nullable, required
  - `size` integer, nullable, required
  - `name` string, required
  - `summary` string, nullable
  - `created_at` string, date-time, required
  - `last_processed_at` string, date-time, nullable
  - `number_of_pages` integer, nullable
  - `process_status` 'self_managed' | 'missing_content' | 'noop' | 'done' | 'todo' | 'in_progress' | 'error' | 'waiting_for_capacity', required
  - `uploaded_by_id` string, uuid, nullable, required
  - `uploaded_by_type` string, required
  - `tokens_processing_main_content` integer, nullable
  - `tokens_processing_summary` integer, nullable
  - `url` string, nullable
  - `attributes` object, nullable
  - `expires_at` string, date-time, nullable — If set, the document will be automatically deleted after this date.
  - `processing_status` string, required
  - `tokens_processing_total` integer, required

## Other responses

- `201` — Upload successful, returns the created document information's.
- `422` — Validation Error

---

[API](https://skmtc.net/mistral/apis/mistral-ai-api.md) · [All operations](https://skmtc.net/mistral/apis/mistral-ai-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/mistral/mistral-ai-api/versions/933c4ebdcd72/schema)
