Skip to main content
POST
Preview. This endpoint is available to organisations in the Wordsmith MCP pilot. Other organisations receive 403 mcp_not_enabled. See the preview overview.
Adds up to 100 files to a repository as documents and starts indexing them. The call returns a repository_indexing operation straight away. Indexing takes seconds per document. The documents appear in List Documents at once, with indexing_status: "pending". Each one becomes searchable as soon as it is indexed, before the whole batch finishes. What happens to each file:
  • A file you uploaded, still in your own space, moves into the repository, as an upload in the app does. Anyone who can read the repository can then read it, and removing the document or deleting the repository deletes the file.
  • A file that already belongs to something else, such as another repository’s document or a conversation, is copied into the repository instead. The document’s file_id is then the copy’s, and removing the document deletes only the copy.
  • A file that is already a document of this repository, itself or as a copy, is not added again. It still counts in the operation’s result.
  • A different file with the same name as a document already in the repository replaces that document. Of several files with the same name in one request, only the last is added.
  • An archive (.zip, .tar, .7z, mailbox files) is refused. Add the files inside it instead.
Get a file_id from Complete Upload, Import File or Create File.

Authentication

Requires an API key, or an OAuth token with repositories:write and files:read. The caller needs edit access to the repository and read access to every file.

Path parameters

string
required
The repository id.

Headers

string
A unique string for this request, such as a UUID, up to 255 characters. A repeat with the same key within 30 days returns the same operation with 200 instead of adding the files again.

Body parameters

string[]
required
The files to add, from 1 to 100 file ids. A repeated id is added once.
string
The folder to put the documents in. Leave it out to add them at the top level. Create folders with Create Folder.
integer
default:"0"
Seconds to wait for indexing to finish before responding, from 0 to 20. If it finishes in time, the response carries the finished operation.
string
An HTTPS URL that receives a signed POST with the operation when it finishes. API keys only: an OAuth caller waits on the operation instead.

Response

Returns 202 with the operation, or 200 with the earlier operation for a repeated Idempotency-Key. Its type is repository_indexing and its resource is the repository. While it runs, progress.completed and progress.total count documents. When it succeeds, result holds { "indexed", "failed" }: how many of the documents were indexed and how many could not be. A document that fails does not fail the operation; find it with List Documents. The operation cannot be cancelled.

Errors