Enable Grounding with Google Search when using Gemini 2.5 Flash via Postman

Hi,

I am quite new to using Gemini API. While using AI Studio. I write a prompt and I get some pretty good responses. I am trying to replicate the same thing but I am doing it via an API call using postman. Through the API I am getting a lot of hallucination and the output is never as rich as in the studio.

I have added this to my postman in addition to contents…
“generationConfig”: {
“responseMimeType”: “application/json”,
“temperature”: 1,

But adding temperature doesn’t seem to help. I have come across this link and I think it is all due to Grounding with google search. Grounding with Google Search  |  Gemini API  |  Google AI for Developers

It works when I do the request using “tools” but i get an error when I add

"tools": [
      {
        "google_search": {}
      }
    ]

to my postman
“error”: {
“code”: 400,
“message”: “Tool use with a response mime type: ‘application/json’ is unsupported”,
“status”: “INVALID_ARGUMENT”
}

Just a snip:

“tools”: [
{
“google_search”: {}
}
],
“generationConfig”: {

Please could someone help me on how to use grounding via the AI gemini API?

Thank you in advance.

Hi @Pedro_Lima , welcome to the forum.

Ensure that the ‘responseMimeType’: ‘application/json’ is not included in the generationConfig, as it is not supported when grounding is enabled.

Thank you