v46

latestOpenAPI 3.0.0MITraw.githubusercontent.com2026-08-0311978417.1 KB
Datasources

Upsert a document in a data source

Upsert a document in a data source in the workspace identified by {wId}.

post/api/v1/w/{wId}/spaces/{spaceId}/data_sources/{dsId}/documents/{documentId}

Path parameters

wIdstring required

ID of the workspace

spaceIdstring required

ID of the space

dsIdstring required

ID of the data source

documentIdstring required

ID of the document

Request body

titlestring

The title of the document to upsert.

mime_typestring

The MIME type of the document to upsert.

textstring

The text content of the document to upsert.

source_urlstring

The source URL for the document to upsert.

tagsstring[]

Tags to associate with the document.

timestampnumber

Unix timestamp (in milliseconds) for the document (e.g. 1736365559000).

light_document_outputboolean

If true, a lightweight version of the document will be returned in the response (excluding the text, chunks and vectors). Defaults to false.

asyncboolean

If true, the upsert operation will be performed asynchronously.

upsert_contextobject

Additional context for the upsert operation.

Response

The document

Example response

{
  "document": {
    "data_source_id": "3b7d9f1e5a",
    "created": 1625097600,
    "document_id": "2c4a6e8d0f",
    "title": "Customer Support FAQ",
    "mime_type": "text/md",
    "timestamp": 1625097600,
    "tags": [
      "customer_support",
      "faq"
    ],
    "parent_id": "1234f4567c",
    "parents": [
      "7b9d1f3e5a",
      "2c4a6e8d0f"
    ],
    "source_url": "https://example.com/support/article1",
    "hash": "a1b2c3d4e5",
    "text_size": 1024,
    "chunk_count": 5,
    "chunks": [
      {
        "chunk_id": "9f1d3b5a7c",
        "text": "This is the first chunk of the document.",
        "embedding": [
          0.1,
          0.2,
          0.3,
          0.4
        ]
      },
      {
        "chunk_id": "4a2c6e8b0d",
        "text": "This is the second chunk of the document.",
        "embedding": [
          0.5,
          0.6,
          0.7,
          0.8
        ]
      }
    ],
    "text": "This is the full text content of the document. It contains multiple paragraphs and covers various topics related to customer support.",
    "token_count": 150
  },
  "data_source": {
    "id": 12345,
    "createdAt": 1625097600,
    "name": "Customer Knowledge Base",
    "description": "Contains all customer-related information and FAQs",
    "dustAPIProjectId": "5e9d8c7b6a",
    "connectorId": "1f3e5d7c9b",
    "connectorProvider": "webcrawler",
    "assistantDefaultSelected": true
  }
}