Knowledge Base

Update a document

Update metadata (sourceUrl, name, tags) of an existing document without re-uploading its content. At least one field must be provided. Updating tags replaces the document's existing tags with the provided set.

patch/knowledge-bases/{id}/documents/{documentId}

Request

  • Base URL
    https://api.markcopy.ai/api/v1
  • Auth
    API key in header X-API-Key

Path parameters

idstring required
Example:kb_a8f3x9k2m4pQ

The external ID of the knowledge base (prefixed with kb_).

documentIdstring required
Example:doc_b7n4p1q8r3wX

The external ID of the document (prefixed with doc_).

Request body

sourceUrlstring uri

New source URL for the document, used as the citation source in retrieval. Must be a valid HTTP or HTTPS URL.

namestring

New name for the document.

tagsstring[]

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 (markdown, plain text, HTML, or JSON).

Response

Document updated.

idstring

Unique document ID (prefixed with doc_).

namestring

The document name after the update.

sourceUrlstring uri

The new source URL, present only when sourceUrl was updated.

tagsstring[]

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.

updatedAtstring date-time

Timestamp of when the document was last updated.

Example response

{
  "id": "doc_b7n4p1q8r3wX",
  "name": "Onboarding Guide",
  "sourceUrl": "https://wiki.internal/handbook/onboarding",
  "tags": [
    "handbook",
    "hr"
  ],
  "mimeType": "text/markdown"
}

Changes

No recorded changes to this operation across all 1 revision of this API.