---
title: "Update multiple documents"
method: PATCH
path: "/knowledge-bases/{id}/documents/batch"
tags: ["Knowledge Base"]
---

# Update multiple documents

`PATCH /knowledge-bases/{id}/documents/batch`

## Request

- Base URL: `https://api.markcopy.ai/api/v1`
- URL: `https://api.markcopy.ai/api/v1/knowledge-bases/{id}/documents/batch`
- Auth: API key in header `X-API-Key`

Update metadata (`sourceUrl`, `name`, `tags`) of up to 100 existing documents in a single request, without re-uploading their content. Each item must include the document `id`. Items are processed independently — the response includes per-item results.

## Path parameters

- `id` string, required

## Request body

- object
  - `documents` object[], required
    - `id` string, required: The external ID of the document to update (prefixed with `doc_`).
    - `sourceUrl` string, uri: New source URL. Must be a valid HTTP or HTTPS URL.
    - `name` string: New name for the document.
    - `tags` string[]: Replaces the document's tags with this set. Tags are created automatically if they don't exist.
    - `mimeType` 'text/markdown' | 'text/plain' | 'text/html' | 'application/json': New declared format for the document.

## Response `200`

Batch processed. Each item has its own success or error status.

- object
  - `results` union[]
    - union
      - object
        - `status` 'success'
        - `document` UpdatedDocument
          - `id` string: Unique document ID (prefixed with `doc_`).
          - `name` string: The document name after the update.
          - `sourceUrl` string, uri: The new source URL, present only when `sourceUrl` was updated.
          - `tags` string[]: The document's tags after the update, present only when `tags` was updated.
          - `mimeType` 'text/markdown' | 'text/plain' | 'text/html' | 'application/json': The document's declared format after the update, present only when `mimeType` was updated.
          - `updatedAt` string, date-time: Timestamp of when the document was last updated.
      - object
        - `status` 'error'
        - `error` object
          - `code` string
          - `message` string
  - `summary` object
    - `total` integer
    - `succeeded` integer
    - `failed` integer

## Other responses

- `400`: Invalid or missing parameters.
- `401`: API key is missing, invalid, or expired.

---

[API](https://skmtc.dev/markcopy/apis/mark-api.md) - [All operations](https://skmtc.dev/markcopy/apis/mark-api/llms.txt) - [OpenAPI document](https://skmtc.dev/markcopy/apis/mark-api/revisions/93323d1697ae?raw)
