Google search in SerpApi issue (authorization failed )

i am facing always unauthorized error in “Google search in SerpApi” node and i am correctly apply api key there

Issue
Couldn’t connect with these settings

Authorization failed - please check your credentials

{

“name”: “Telgram1 Sub Workflow Search”,

“nodes”: [

{

  "parameters": {

    "inputSource": "passthrough"

  },

  "type": "n8n-nodes-base.executeWorkflowTrigger",

  "typeVersion": 1.1,

  "position": \[

    0,

    0

  \],

  "id": "f5f9534c-c16c-4713-bbe7-ce63f8205078",

  "name": "When Executed by Another Workflow"

},

{

  "parameters": {

    "promptType": "define",

    "text": "={{ $json.query }}",

    "options": {

      "systemMessage": "=You are a helpful assistant for research\\n\\nyou can use your tools to search the web."

    }

  },

  "type": "@n8n/n8n-nodes-langchain.agent",

  "typeVersion": 3.1,

  "position": \[

    208,

    0

  \],

  "id": "41e9252f-13b1-4c17-b449-8e76ee824652",

  "name": "AI Agent"

},

{

  "parameters": {

    "model": {

      "\__rl": true,

      "mode": "list",

      "value": "gpt-5-mini"

    },

    "builtInTools": {},

    "options": {}

  },

  "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",

  "typeVersion": 1.3,

  "position": \[

    80,

    208

  \],

  "id": "8adc58e1-a04e-4849-94c2-9177b54e1e8b",

  "name": "OpenAI Chat Model",

  "credentials": {

    "openAiApi": {

      "id": null,

      "name": "",

      "\__aiGatewayManaged": true

    }

  }

},

{

  "parameters": {},

  "type": "@n8n/n8n-nodes-langchain.toolWikipedia",

  "typeVersion": 1,

  "position": \[

    224,

    304

  \],

  "id": "499b12b9-5f77-4f53-acd9-692237079398",

  "name": "Wikipedia"

},

{

  "parameters": {

    "resource": "all",

    "limit": 20,

    "additionalFields": {

      "keyword": "={{ /\*n8n-auto-generated-fromAI-override\*/ $fromAI('Keyword', \`\`, 'string') }}"

    }

  },

  "type": "n8n-nodes-base.hackerNewsTool",

  "typeVersion": 1,

  "position": \[

    368,

    288

  \],

  "id": "da7806e6-7a74-48b4-9733-d1cb0aa634ea",

  "name": "Hacker News"

},

{

  "parameters": {

    "q": "={{ /\*n8n-auto-generated-fromAI-override\*/ $fromAI('Search_Query__q\_', \`\`, 'string') }}",

    "location": "={{ /\*n8n-auto-generated-fromAI-override\*/ $fromAI('Location__location\_', \`\`, 'string') }}",

    "additionalFields": {},

    "requestOptions": {}

  },

  "type": "n8n-nodes-serpapi.serpApiTool",

  "typeVersion": 1,

  "position": \[

    544,

    288

  \],

  "id": "67ddaf70-2408-4e19-a79c-a355703a0d35",

  "name": "Google search in SerpApi",

  "credentials": {

    "serpApi": {

      "id": "uF8n5EBM0zMke4ll",

      "name": "SerpApi account"

    }

  }

},

{

  "parameters": {

    "promptType": "define",

    "text": "={{ $json.query }}",

    "options": {

      "systemMessage": "=You are a helpful research agent.\\nYou use your Tools to search the web, you have access to hackernwes, wikipedia and the serpAPI, surch them all or use the rigth one."

    }

  },

  "type": "@n8n/n8n-nodes-langchain.agent",

  "typeVersion": 1.7,

  "position": \[

    1152,

    720

  \],

  "id": "a71e2746-f386-4e99-91c4-4d3ab0b4d758",

  "name": "AI Agent1"

},

{

  "parameters": {

    "model": {

      "\__rl": true,

      "value": "gpt-4o",

      "mode": "list",

      "cachedResultName": "gpt-4o"

    },

    "options": {}

  },

  "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",

  "typeVersion": 1.2,

  "position": \[

    1072,

    960

  \],

  "id": "671a8ea6-707f-4409-b2d1-6a14d8dc5ffa",

  "name": "OpenAI Chat Model1"

},

{

  "parameters": {},

  "type": "@n8n/n8n-nodes-langchain.toolWikipedia",

  "typeVersion": 1,

  "position": \[

    1216,

    960

  \],

  "id": "8fd5c8fb-a016-4fac-bbdd-47dbf6faa59b",

  "name": "Wikipedia1"

},

{

  "parameters": {

    "resource": "all",

    "limit": 20,

    "additionalFields": {

      "keyword": "={{ /\*n8n-auto-generated-fromAI-override\*/ $fromAI('Keyword', \`\`, 'string') }}"

    }

  },

  "type": "n8n-nodes-base.hackerNewsTool",

  "typeVersion": 1,

  "position": \[

    1360,

    960

  \],

  "id": "7aa1304b-cd8c-40a8-8c10-25b60516f28f",

  "name": "Hacker News1"

}

],

“pinData”: {

"When Executed by Another Workflow": \[

  {

    "json": {

      "query": "Honda bike news"

    }

  }

\]

},

“connections”: {

"When Executed by Another Workflow": {

  "main": \[

    \[

      {

        "node": "AI Agent",

        "type": "main",

        "index": 0

      }

    \]

  \]

},

"OpenAI Chat Model": {

  "ai_languageModel": \[

    \[

      {

        "node": "AI Agent",

        "type": "ai_languageModel",

        "index": 0

      }

    \]

  \]

},

"Wikipedia": {

  "ai_tool": \[

    \[

      {

        "node": "AI Agent",

        "type": "ai_tool",

        "index": 0

      }

    \]

  \]

},

"Hacker News": {

  "ai_tool": \[

    \[

      {

        "node": "AI Agent",

        "type": "ai_tool",

        "index": 0

      }

    \]

  \]

},

"Google search in SerpApi": {

  "ai_tool": \[

    \[

      {

        "node": "AI Agent",

        "type": "ai_tool",

        "index": 0

      }

    \]

  \]

},

"OpenAI Chat Model1": {

  "ai_languageModel": \[

    \[

      {

        "node": "AI Agent1",

        "type": "ai_languageModel",

        "index": 0

      }

    \]

  \]

},

"Wikipedia1": {

  "ai_tool": \[

    \[

      {

        "node": "AI Agent1",

        "type": "ai_tool",

        "index": 0

      }

    \]

  \]

},

"Hacker News1": {

  "ai_tool": \[

    \[

      {

        "node": "AI Agent1",

        "type": "ai_tool",

        "index": 0

      }

    \]

  \]

}

},

“active”: false,

“settings”: {

"executionOrder": "v1",

"binaryMode": "separate"

},

“versionId”: “c1435b84-8b12-45c4-b332-09340a9fdc93”,

“meta”: {

"templateCredsSetupCompleted": true,

"instanceId": "9f81a7770771d2db166482bd80259ea45591cbec80ffb304895a93391779c88e"

},

“id”: “N2zPDbeMqBtZ5SwX”,

“tags”: []

}

Hi @Ahmed_Ali9

First, try the “refresh” trick. Sometimes n8n looks like it is connected to your account, but the internal link is actually broken. To fix this, open the SerpApi node, set the credentials to “None,” and then select your account again from the dropdown menu. This often forces the system to wake up and recognize your API key.

Second, double-check which service you are actually using. There are two very similar services: SerpApi and Serper.dev. The n8n node you are using is built specifically for SerpApi. If you accidentally signed up for Serper.dev and used that key, it will never work in this specific node, and you will keep seeing the “Unauthorized” error.

Third, look for “invisible” mistakes. It is very common to accidentally copy a tiny space at the beginning or the end of the API key when pasting it into n8n. Even one single space makes the key invalid. Go back into your credentials settings and carefully make sure there are no extra spaces around the text.

Fourth, test the key outside of n8n to see if the problem is with your account. You can do this by using a simple command in your computer’s terminal or by checking your SerpApi dashboard. This helps you figure out if the key is actually expired or if you have run out of search credits, which would also cause an authorization failure.

curl "https://serpapi.com/search.json?q=n8n&api_key=YOUR_API_KEY"

Finally, if the official node still isn’t working, you can use a “back door.” Instead of the SerpApi node, use the generic “HTTP Request” node. This allows you to connect to the service manually. It is often more reliable because it bypasses the specific settings of the SerpApi node and lets you control the connection directly.

@Ahmed_Ali9, good morning!

Please share the response from your API key test, via terminal or browser.
First we need to validate if it’s working correctly.
confirm your plan on serpai
don’t use community nodes, prefer HTTPS.