Prompt Buddy logoPrompt Buddy

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.

Import to Prompt Buddy

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

FileContainsUse For
SKILL.mdEntry point: scope, routing table, and workflow.Start here.
docs/google-ai-api-using-files-workflow-guide.mdAn 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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.textA 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

  1. Open the most relevant file under docs/ for the exact documented workflow and wording.
  2. Open schemas/ files for exact structured contracts.
  3. Open examples/ files for concrete requests, commands, snippets, and manifests.
  4. Do not add behavior or configuration that is not present in the attached source files.

Canonical source: https://ai.google.dev/api/files