---
title: "Check Documents Exist Api"
method: POST
path: "/api/kb/collections/{collection_name}/documents/check"
tags: ["kb"]
---

# Check Documents Exist Api

`POST /api/kb/collections/{collection_name}/documents/check`

Check which of the given filenames already exist in the collection.

Used by the frontend to show "file already exists, re-upload?" before ingest.
New records resolve names via `file_id -> UploadedFile.filename`; legacy records
fall back to `source_path` basename.

For duplicate check we always filter by current user's documents only (including
for admins), so "already exists" matches what will be overwritten on re-upload.

## Path parameters

- `collection_name` string, required

## Request body

- object — JSON body with 'filenames': list of filename strings

## Response `200`

Successful Response

- object

## Other responses

- `422` — Validation Error

## Changes

- **2026-05-01** `c9eb29ec9a1b` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/xorbitsai/apis/xagent/changes/api/kb/collections/:collection_name/documents/check/post.md)

---

[API](https://skmtc.dev/xorbitsai/apis/xagent.md) · [All operations](https://skmtc.dev/xorbitsai/apis/xagent/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/xorbitsai/xagent/revisions/33e4ba4936ad/schema)
