DifyAI icon

DifyAI

Consume Dify API

Overview

This node integrates with the Dify API to perform several operations related to AI-powered content processing. Specifically, for the File Upload operation, it uploads a file from the workflow's binary data to the Dify server associated with a specified user ID.

Common scenarios where this node is beneficial include:

  • Uploading files (images, documents, audio, video, etc.) to a remote AI service for further processing or storage.
  • Automating workflows that require sending user-specific files to an external API.
  • Integrating file upload capabilities into larger automation pipelines involving AI services.

For example, you might use this node to upload a recorded audio file or a scanned document to the Dify platform for transcription, analysis, or archival.

Properties

Name Meaning
User ID Unique identifier for the user uploading the file.
Binary Property Name of the binary property in the input item that contains the file to be uploaded.

Output

The node outputs a JSON object containing the response from the Dify API after the file upload request. This typically includes metadata about the uploaded file such as its ID, status, and any other relevant information returned by the API.

If the node processes multiple items, it returns an array of such JSON objects, one per input item.

The node does not output binary data itself; it only sends binary data to the API and outputs the API's JSON response.

Dependencies

  • Requires an active connection to the Dify API via an API key credential.
  • The node expects the Dify API base URL and API key to be configured in the credentials.
  • Input items must contain binary data under the specified binary property name for the file upload to work.

Troubleshooting

  • Error: No binary data property "X" on item!
    This error occurs if the specified binary property does not exist on the input item. Ensure that the input data contains binary data under the exact property name provided in the "Binary Property" field.

  • API Authentication Errors
    If the API key is invalid or missing, the node will fail to authenticate with the Dify API. Verify that the API key credential is correctly set up and has the necessary permissions.

  • Invalid File Data
    If the binary data is corrupted or the file type is unsupported, the API may reject the upload. Confirm that the binary data is valid and corresponds to a supported file format.

Links and References

Discussion