Method: media.upload

Creates a File.

HTTP request

  • Upload URI, for media upload requests:
    POST https://generativelanguage.googleapis.com/upload/v1beta/files
  • Metadata URI, for metadata-only requests:
    POST https://generativelanguage.googleapis.com/v1beta/files

The URL uses gRPC Transcoding syntax.

Request body

The request body contains data with the following structure:

JSON representation
{
  "file": {
    object (File)
  }
}
Fields
file

object (File)

Optional. Metadata for the file to create.

Response body

Response for media.upload.

If successful, the response body contains data with the following structure:

JSON representation
{
  "file": {
    object (File)
  }
}
Fields
file

object (File)

Metadata for the created file.