Overview
This node integrates with the Google Gemini AI API to perform various AI-powered operations, including uploading files for processing. The Upload File operation allows users to upload binary files (such as audio, image, video, or document files) to the Gemini service, which can then be used in subsequent AI tasks like analysis or transcription.
Typical use cases include:
- Uploading media files to Gemini for later analysis or processing.
- Storing files in Gemini's system to leverage its AI capabilities on those files.
- Preparing files for workflows that require AI understanding or transformation of uploaded content.
For example, you might upload an audio recording to Gemini and then analyze it with a text prompt to transcribe or describe the audio content.
Properties
| Name | Meaning |
|---|---|
| Binary Property | The name of the binary property from the input data that contains the file to upload. |
| Display Name | A custom name for the uploaded file. If left empty, the original filename will be used. |
Output
The output JSON object includes details about the uploaded file returned by the Gemini API:
fileUri: The URI identifier of the uploaded file within Gemini.fileName: The internal filename assigned by Gemini.displayName: The display name of the file (custom or derived).mimeType: The MIME type of the uploaded file.sizeBytes: The size of the file in bytes.createTime: Timestamp when the file was created/uploaded.originalFileName: The original filename from the binary data.originalMimeType: The MIME type inferred or provided from the original file.- Plus any additional JSON data passed through from the input item.
No binary data is output by this operation; it only returns metadata about the uploaded file.
Dependencies
- Requires an API key credential for authenticating requests to the Google Gemini API.
- The node uses n8n's built-in HTTP request helper with authentication to communicate with Gemini endpoints.
- No other external dependencies are required.
Troubleshooting
- No binary data found in property: This error occurs if the specified binary property does not exist or contains no data. Ensure the previous node outputs binary data under the correct property name.
- Binary data does not contain valid data: The binary property exists but lacks valid base64-encoded data. Verify the binary data integrity.
- Failed to get upload URL from Gemini API: Indicates an issue obtaining the resumable upload URL. Check API credentials and network connectivity.
- Failed to upload file to Gemini API: The actual file upload failed. Possible causes include network issues, invalid file data, or API limits.
- General API errors are wrapped and reported with descriptive messages to help identify the failure point.
To resolve these issues:
- Confirm the binary property name matches exactly.
- Validate that the input binary data is correctly formatted and present.
- Verify API credentials and permissions.
- Check network access to the Gemini API endpoint.