Skip to main content
post/datasets/{dataset_id}/document/create-by-file
Request example
Response
post/datasets/{dataset_id}/document/create-by-file

Authorization

Authorizationstringheaderrequired#

Every request authenticates with an API key: Authorization: Bearer {API_KEY}. App endpoints take an app API key; knowledge endpoints take a knowledge base API key (Get Started).

Keep keys server-side; never embed them in client code. Requests with a missing or invalid key fail with HTTP 401 (unauthorized).

Path parameters

dataset_idstringrequired#
Knowledge base ID, from List Knowledge Bases. For a scoped key, copy the ID from the Dify URL.

Body

multipart/form-data
datastring#
JSON string containing configuration. Accepts the same fields as Create Document by Text (indexing_technique, doc_form, doc_language, process_rule, retrieval_model, embedding_model, embedding_model_provider) except name and text.
filefilerequired#

File to upload, capped at 15 MB by default.

Self-hosted deployments adjust the limit with the UPLOAD_FILE_SIZE_LIMIT environment variable. On Dify Cloud, Professional and Team plans raise the cap to 50 MB.

Responses

application/json
Document created successfully.
batchstring#
Batch ID for tracking indexing progress.
documentobject#