Example Request
# Write the request to a file: inline base64 data can exceed the shell's
# argument size limit.
cat > request.json <<EOF
{
"model": "gemini-3.8-flash",
"input": [
{
"type": "user_input",
"content": [
{
"type": "text",
"text": "Summarize this document."
},
{
"type": "document",
"mime_type": "application/pdf",
"data": "$(base64 -w0 report.pdf)"
}
]
}
]
}
EOF
curl -X POST https://aiplatform.googleapis.com/v1/projects/{project}/locations/global/interactions \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
-H "Api-Revision: 2026-05-20" \
-d @request.json
import pathlib
from google import genai
client = genai.Client(vertexai=True, location='global')
interaction = client.interactions.create(
model="gemini-3.8-flash",
input=[
{
"type": "user_input",
"content": [
{"type": "text", "text": "Summarize this document."},
{
"type": "document",
"data": pathlib.Path("report.pdf"),
"mime_type": "application/pdf",
},
],
}
],
)
print(interaction.output_text)
import {GoogleGenAI} from '@google/genai';
import * as fs from 'fs';
const ai = new GoogleGenAI({vertexai: true, location: 'global'});
const interaction = await ai.interactions.create({
model: 'gemini-3.8-flash',
input: [
{
type: 'user_input',
content: [
{type: 'text', text: 'Summarize this document.'},
{
type: 'document',
data: fs.readFileSync('report.pdf', 'base64'),
mime_type: 'application/pdf',
},
],
},
],
});
console.log(interaction.output_text);