Method: posts.imageUpload

Uploads an image for a post and returns an upload token. To attach the image to a post, set the token as an attachments.imageAttachments[].uploadToken value when you call the posts.insert method.

This method is in a pilot phase with access limited to select launch partners (approved Google Cloud projects). Broader public API access is planned for General Availability in 2027.

This method accepts raw binary image data in the HTTP request body rather than a JSON Post resource; the empty Request body section applies only to JSON metadata, not the binary media upload. Uploaded files must meet the following requirements:

  • Maximum file size: 16 MiB
  • Accepted media MIME types: image/jpeg, image/png, image/gif, image/webp, application/octet-stream
  • Image formats: JPEG, PNG, GIF, or WebP (detected from the file contents)
  • Aspect ratio: Between 2:5 and 5:2 (width to height), inclusive

The authorized user must own the channel or have permission to create posts for it.

Quota impact: A call to this method has a quota cost of 1 unit. The cost counts against the Post Modifications and Image Uploads quota, which is separate from the default YouTube Data API quota.

For method-specific error responses, see posts.imageUpload errors.

HTTP request

POST https://youtube.googleapis.com/upload/youtube/v3/posts/image

The URL uses gRPC Transcoding syntax.

Query parameters

Parameters
channelId

string

Required. The ID of the channel that publishes the post that uses this image.

The returned upload token works only in posts for this channel.

Request body

The request body must be empty.

Response body

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

JSON representation
{
  "imageUploadToken": string
}
Fields
imageUploadToken

string

The token that identifies the uploaded image.

Set this value as an attachments.imageAttachments[].uploadToken value when you call posts.insert for the same channel.

Authorization scopes

Requires one of the following OAuth scopes:

  • https://www.googleapis.com/auth/youtube
  • https://www.googleapis.com/auth/youtubepartner
  • https://www.googleapis.com/auth/youtube.force-ssl
  • https://www.googleapis.com/auth/youtube.upload

For more information, see the OAuth 2.0 Overview.