google · Google AI Docs
Google AI API Using files
Explains how to upload and manage media files separately from prompt inputs to enable media reuse across multiple requests and prompts within the Gemini API.
Derived skill
Files assembled from official documentation
Viewing SKILL.md
Google AI API Using files
Explains how to upload and manage media files separately from prompt inputs to enable media reuse across multiple requests and prompts within the Gemini API.
When To Use
Use when you need to upload large media files to the Gemini API for reuse across multiple prompts or requests to avoid redundant uploads.
Reference Files
| File | Contains | Use For |
|---|---|---|
SKILL.md | Entry point: scope, routing table, and workflow. | Start here. |
docs/google-ai-api-using-files-workflow-guide.md | An API reference detailing the media.upload method, endpoint, and request body structure for uploading files to the Gemini API. | Questions about an API reference detailing the media.upload method, endpoint, and request body structure for uploading files to the G... |
examples/google-ai-api-using-files-google-ai-api-python-upload-and-generate.text | A Python script demonstrating how to upload a media file to the Google AI File API and use it as input for a generateContent request. | Exact payloads, commands, or snippets shown in A Python script demonstrating how to upload a media file to the Google AI File API and use it as input for a generate... |
examples/google-ai-api-using-files-google-ai-api-nodejs-upload.text | A Node.js code example demonstrating how to upload a media file to the Google AI File API using the @google/genai SDK. | Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to upload a media file to the Google AI File API using the @google/genai SDK. |
examples/google-ai-api-using-files-google-ai-api-go-upload.text | A Go code example demonstrating how to upload a media file to the Google AI API using the genai client. | Exact payloads, commands, or snippets shown in A Go code example demonstrating how to upload a media file to the Google AI API using the genai client. |
examples/google-ai-api-using-files-google-ai-api-resumable-upload-curl.text | A shell script example using curl to perform a resumable file upload to the Google AI API by capturing response headers. | Exact payloads, commands, or snippets shown in A shell script example using curl to perform a resumable file upload to the Google AI API by capturing response headers. |
examples/google-ai-api-using-files-google-ai-api-python-upload-and-generate-2.text | A Python script demonstrating how to upload a media file to the Google AI File API and use it as input for a generateContent request. | Exact payloads, commands, or snippets shown in A Python script demonstrating how to upload a media file to the Google AI File API and use it as input for a generate... |
examples/google-ai-api-using-files-google-ai-api-nodejs-upload-2.text | A Node.js code example demonstrating how to upload an audio file to the Google AI File API using the @google/genai library. | Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to upload an audio file to the Google AI File API using the @google/genai li... |
examples/google-ai-api-using-files-google-ai-api-go-upload-2.text | A Go code example demonstrating how to upload an audio file to the Google AI File API using the genai client. | Exact payloads, commands, or snippets shown in A Go code example demonstrating how to upload an audio file to the Google AI File API using the genai client. |
examples/google-ai-api-using-files-google-ai-api-resumable-upload-curl-2.text | A shell script using curl to perform a resumable file upload to the Google AI API by capturing response headers for metadata. | Exact payloads, commands, or snippets shown in A shell script using curl to perform a resumable file upload to the Google AI API by capturing response headers for m... |
examples/google-ai-api-using-files-google-ai-api-python-upload-and-generate-3.text | A Python script demonstrating how to upload a text file to the Google AI File API and use it as context for a content generation request. | Exact payloads, commands, or snippets shown in A Python script demonstrating how to upload a text file to the Google AI File API and use it as context for a content... |
examples/google-ai-api-using-files-google-ai-api-nodejs-upload-3.text | A Node.js code example demonstrating how to upload a text file to the Google AI File API using the @google/genai library. | Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to upload a text file to the Google AI File API using the @google/genai libr... |
examples/google-ai-api-using-files-google-ai-api-go-upload-3.text | A Go code example demonstrating how to upload a text file to the Google AI File API using the genai client. | Exact payloads, commands, or snippets shown in A Go code example demonstrating how to upload a text file to the Google AI File API using the genai client. |
examples/google-ai-api-using-files-google-ai-api-resumable-upload-curl-request.text | A curl command demonstrating how to initiate a resumable file upload request to the Google AI API by capturing response headers. | Exact payloads, commands, or snippets shown in A curl command demonstrating how to initiate a resumable file upload request to the Google AI API by capturing respon... |
examples/google-ai-api-using-files-google-ai-api-python-upload-and-status-polling.text | A Python script demonstrating how to upload a media file to the Google AI API and poll the file state until it becomes active. | Exact payloads, commands, or snippets shown in A Python script demonstrating how to upload a media file to the Google AI API and poll the file state until it become... |
examples/google-ai-api-using-files-google-ai-api-nodejs-upload-video.text | A Node.js code example demonstrating how to upload a video file to the Google AI File API using the @google/genai library. | Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to upload a video file to the Google AI File API using the @google/genai lib... |
examples/google-ai-api-using-files-google-ai-api-go-upload-4.text | A Go code example demonstrating how to upload a video file to the Google AI File API using the genai client. | Exact payloads, commands, or snippets shown in A Go code example demonstrating how to upload a video file to the Google AI File API using the genai client. |
examples/google-ai-api-using-files-google-ai-api-resumable-upload-curl-3.text | A curl command demonstrating how to initiate a resumable file upload request to the Google AI API by capturing response headers. | Exact payloads, commands, or snippets shown in A curl command demonstrating how to initiate a resumable file upload request to the Google AI API by capturing respon... |
examples/google-ai-api-using-files-google-ai-api-python-upload-and-generate-4.text | A Python script demonstrating how to upload a PDF file to the Google AI API and use it as context for a content generation request. | Exact payloads, commands, or snippets shown in A Python script demonstrating how to upload a PDF file to the Google AI API and use it as context for a content gener... |
examples/google-ai-api-using-files-google-ai-api-go-upload-pdf.text | A Go code example demonstrating how to upload a PDF file to the Google AI API using the genai client. | Exact payloads, commands, or snippets shown in A Go code example demonstrating how to upload a PDF file to the Google AI API using the genai client. |
examples/google-ai-api-using-files-google-ai-api-python-upload-and-get.text | A Python script demonstrating how to upload a media file and retrieve its metadata using the Google GenAI client. | Exact payloads, commands, or snippets shown in A Python script demonstrating how to upload a media file and retrieve its metadata using the Google GenAI client. |
examples/google-ai-api-using-files-google-ai-api-nodejs-upload-and-get.text | A Node.js code example demonstrating how to upload a text file and retrieve its metadata using the Google AI File API. | Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to upload a text file and retrieve its metadata using the Google AI File API. |
examples/google-ai-api-using-files-google-ai-api-go-upload-5.text | A Go code example demonstrating how to upload a text file to the Google AI File API using the genai client. | Exact payloads, commands, or snippets shown in A Go code example demonstrating how to upload a text file to the Google AI File API using the genai client. |
examples/google-ai-api-using-files-google-ai-api-files-metadata-retrieval-shell-s.text | A shell script that uses curl and jq to retrieve and display metadata for a specific file uploaded to the Google AI API. | Exact payloads, commands, or snippets shown in A shell script that uses curl and jq to retrieve and display metadata for a specific file uploaded to the Google AI API. |
examples/google-ai-api-using-files-google-ai-api-python-list-files.text | A Python script using the Google GenAI SDK to list uploaded files via the client.files.list method. | Exact payloads, commands, or snippets shown in A Python script using the Google GenAI SDK to list uploaded files via the client.files.list method. |
examples/google-ai-api-using-files-google-ai-api-list-files-nodejs.text | A Node.js code example demonstrating how to use the Google AI API to list uploaded files using a pager. | Exact payloads, commands, or snippets shown in A Node.js code example demonstrating how to use the Google AI API to list uploaded files using a pager. |
examples/google-ai-api-using-files-google-ai-api-list-files-go.text | A Go code example demonstrating how to use the Google AI API client to list uploaded files. | Exact payloads, commands, or snippets shown in A Go code example demonstrating how to use the Google AI API client to list uploaded files. |
examples/google-ai-api-using-files-google-ai-api-list-files-bash-script.text | A bash script that uses curl to list uploaded files via the Google AI Files API. | Exact payloads, commands, or snippets shown in A bash script that uses curl to list uploaded files via the Google AI Files API. |
examples/google-ai-api-using-files-google-ai-api-python-upload-and-delete.text | A Python script demonstrating how to upload a file to the Google AI File API, use it in a generateContent request, and then delete the file. | Exact payloads, commands, or snippets shown in A Python script demonstrating how to upload a file to the Google AI File API, use it in a generateContent request, an... |
examples/google-ai-api-using-files-google-ai-api-files-typescript-preview-readme.text | A README file describing the preview status and implementation details of the Google AI SDK for TypeScript and JavaScript regarding file usage. | Exact payloads, commands, or snippets shown in A README file describing the preview status and implementation details of the Google AI SDK for TypeScript and JavaSc... |
examples/google-ai-api-using-files-google-ai-api-go-upload-6.text | A Go code example demonstrating how to upload a text file to the Google AI File API using the genai client. | Exact payloads, commands, or snippets shown in A Go code example demonstrating how to upload a text file to the Google AI File API using the genai client. |
examples/google-ai-api-using-files-google-ai-api-delete-curl-request.text | A shell command using curl to delete a specific file from the Google AI API via a DELETE request. | Exact payloads, commands, or snippets shown in A shell command using curl to delete a specific file from the Google AI API via a DELETE request. |
What This Skill Covers
- The Gemini API supports uploading media files separately from the prompt input, allowing your media to be reused across multiple requests and multiple prompt...
- Main sections:
Method: media.upload,Endpoint,Request body,Example request,Image.
Workflow
- Open the most relevant file under
docs/for the exact documented workflow and wording. - Open
schemas/files for exact structured contracts. - Open
examples/files for concrete requests, commands, snippets, and manifests. - Do not add behavior or configuration that is not present in the attached source files.
Canonical source: https://ai.google.dev/api/files
