header when making requests to protected resources.
Example:
Authorization: Bearer ********************
Path Params
Query Params
Header Params
Body Params application/json
Examples
{"contents":[{"role":"user","parts":[{"text":"Hi, can you create a 3d rendered image of a pig with wings and a top hat flying over a happy futuristic scifi city with lots of greenery?"}]}],"generationConfig":{"responseModalities":["IMAGE"]}}
Request Code Samples
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
cURL
curl--location--globoff'/v1beta/models/gemini-2.5-flash-image-preview:generateContent?key=' \
--header'Authorization: Bearer <token>' \
--header'Content-Type: application/json' \
--data'{
"contents": [
{
"role": "user",
"parts": [
{
"text": "Hi, can you create a 3d rendered image of a pig with wings and a top hat flying over a happy futuristic scifi city with lots of greenery?"
}
]
}
],
"generationConfig": {
"responseModalities": [
"IMAGE"
]
}
}'