I am making a request to Gemini API through Insomnia and I am getting this response:
{
"candidates": [
{
"finishReason": "OTHER",
"index": 0
}
],
"usageMetadata": {
"promptTokenCount": 259,
"totalTokenCount": 259,
"promptTokensDetails": [
{
"modality": "TEXT",
"tokenCount": 1
},
{
"modality": "IMAGE",
"tokenCount": 258
}
]
},
"modelVersion": "gemini-2.5-flash",
"responseId": "v-_CaK2zLJesz7IPt7GQyQE"
}
I am making a request to this URL: https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent
With this payload (I removed the image base64 because I cannot share the image as it contains sensitive data):
{
"contents":[
{
"role":"user",
"parts":[
{
"inlineData":{
"mimeType":"image/jpeg",
"data":"[IMAGE_BASE64]"
}
}
]
}
],
"safetySettings":[
{
"category":"HARM_CATEGORY_HARASSMENT",
"threshold":"OFF"
},
{
"category":"HARM_CATEGORY_HATE_SPEECH",
"threshold":"OFF"
},
{
"category":"HARM_CATEGORY_SEXUALLY_EXPLICIT",
"threshold":"OFF"
},
{
"category":"HARM_CATEGORY_DANGEROUS_CONTENT",
"threshold":"OFF"
},
{
"category":"HARM_CATEGORY_CIVIC_INTEGRITY",
"threshold":"OFF"
}
],
"generationConfig":{
"temperature":0,
"topP":1,
"maxOutputTokens":872,
"thinkingConfig":{
"thinkingBudget":0
}
}
}
The problem seems to be the image because when I remove it from the request it works. If I paint the sensitive information from the image and send the new version the request also works.
The image is basically a product order containing a list of products and sensitive information such as address, name, telephone, tax number, brand name, brand website, order number, etc