POST/datasets/pipeline/file-upload

Upload Pipeline File

Uploads a file for use in a knowledge pipeline. Use the returned id as the reference of a local_file item in Run Pipeline.

  • IdempotentThe SDK sends Idempotency-Key, so a retried request is only applied once.

1 body field
filestringrequired
The file to upload, as one `multipart/form-data` part. Document files are capped at 15 MB by default. Self-hosted deployments adjust the limit with the `UPLOAD_FILE_SIZE_LIMIT` [environment variable](/en/self-host/deploy/configuration/environments). On Dify Cloud, Professional and Team plans raise the document cap to 50 MB. Images, audio, and video follow their own limits: 10 MB, 50 MB, and 100 MB by default.

5 status codes
201File uploaded successfully.
created_atstringoptional
Upload timestamp in ISO 8601 format. May be `null` while the record is being created.
created_bystringoptional
ID of the user who uploaded the file.
extensionstringoptional
File extension.
idstringoptional
Unique identifier of the uploaded file.
mime_typestringoptional
MIME type of the file. May be `null` if the upload did not include one.
namestringoptional
Original file name.
sizeintegeroptional
File size in bytes.
400- `no_file_uploaded` : No file was provided in the request. - `filename_not_exists_error` : The uploaded file has no filename. - `too_many_files` : Only one file is allowed per request.

3 documented failures

  • filename_not_exists_error

    The specified filename does not exist.

    filename_not_exists_error

  • no_file_uploaded

    Please upload your file.

    no_file_uploaded

  • too_many_files

    Only one file is allowed.

    too_many_files

403`forbidden` : The API key is scoped to specific knowledge bases. This endpoint has no knowledge base ID in its path, so it requires a key with access to all knowledge bases.

One documented failure

  • forbidden

    The API key is not authorized to access this knowledge base.

    forbidden (key scope)

413`file_too_large` : The file exceeds the upload size limit.

One documented failure

  • file_too_large

    File size exceeded.

    file_too_large

415`unsupported_file_type` : The file type is not supported.

One documented failure

  • unsupported_file_type

    File type not allowed.

    unsupported_file_type

Error handling

A 400 is returned: - no_file_uploaded : No file was provided in the request.

  • filename_not_exists_error : The uploaded file has no filename.
  • too_many_files : Only one file is allowed per request. A 403 is returned: forbidden : The API key is scoped to specific knowledge bases. This endpoint has no knowledge base ID in its path, so it requires a key with access to all knowledge bases. A 413 is returned: file_too_large : The file exceeds the upload size limit. A 415 is returned: unsupported_file_type : The file type is not supported.