GHL and N8N - HTTP Connection Failing in workflow

Describe the problem/error/question

I cannot work out why I keep receiving a JWT error on the HTTP node to connect into Go High Level. I have troubleshooted this using Go High Level - the PIT works fine, and the set up is correct from what I can see.

What is the error message (if any)?

The error show is 'Authorization failed - please check your credentials’ and then followed JWT error.

Authorization failed - please check your credentials

Invalid JWT

Information on your n8n setup

  • **n8n version: **
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

@Just_Stay how are u sending the PIT — is it in the Authorization header as “Bearer ”? and which GHL API endpoint are u hitting (v1 or v2)? Invalid JWT usually means either the token format isnt being recognized, or ur hitting a v1 endpoint that doesnt accept PITs at all.

Hi @Just_Stay

I think there are two issues in your HTTP Request node:

  1. Authorization header is missing Bearer . Change the value from pit-b7e4542a-... to Bearer pit-b7e4542a-… That’s why you get “Invalid JWT”.

  2. Body parameter formatting. Your field names and values have extra quotes that will break the request. For example, "firstname" should just be firstName (no extra quotes), and values should be {{ $json.body.first_name }} without the ="..." wrapping.

  • Switch “Body Content Type” to JSON and paste the body as a clean JSON object instead of using individual fields:
{
  "firstName": "{{ $json.body.first_name }}",
  "lastName": "{{ $json.body.last_name }}",
  "email": "{{ $json.body.email }}",
  "phone": "{{ $json.body.phone }}",
  "locationId": "Wyba2v9gnxaXgpUCNypq",
  "tags": ["business-guest", "source-suiteop", "stayed-0-3m"]
}           

Let me know if it helps :crossed_fingers:

Hi,
I have inputted the PIT straight underneath my authorization header. I have not put Bearer within any header section.

The GHL endpoint is V2

Hello,

The first step has made a difference I am now receiving the following message.

I’ve also changed the body and included it all under one title - I am unsure if i have done this correctly

Thanks for your help -

Hello Just_stay,

The Bearer fix was correct. The new error “Authentication failed” suggests that either:

  1. The PIT token doesn’t have the right scopes. In GHL under Settings, Private Integrations, check if the token has access to the endpoint you’re calling

  2. The endpoint itself expects a different token type, some GHL v2 endpoints require a Location token, not the Agency PIT

Which endpoint are you calling and at which level (Agency or Location)?

I am calling at a sub-account level within GHL.

The scopes I have active are:

Hi @Just_Stay, welcome to the n8n community.

See if this node helps you

{
“nodes”: [
{
“parameters”: {
“httpMethod”: “POST”,
“path”: “leadconnector-contact”,
“options”: {}
},
“id”: “5b465b87-8c97-4b13-8db4-bcd869615e13”,
“name”: “Webhook”,
“type”: “n8n-nodes-base.webhook”,
“typeVersion”: 2.1,
“position”: [
240,
304
],
“webhookId”: “51fb3116-005f-424e-924a-e004dab7f3b8”
},
{
“parameters”: {
“method”: “POST”,
“url”: “https://services.leadconnectorhq.com/contacts/”,
“authentication”: “genericCredentialType”,
“genericAuthType”: “httpHeaderAuth”,
“sendHeaders”: true,
“headerParameters”: {
“parameters”: [
{
“name”: “Version”,
“value”: “2021-07-28”
}
]
},
“sendBody”: true,
“bodyParameters”: {
“parameters”: [
{
“name”: “firstName”,
“value”: “={{ $json.body.first_name }}”
},
{
“name”: “lastName”,
“value”: “={{ $json.body.last_name }}”
},
{
“name”: “email”,
“value”: “={{ $json.body.email }}”
},
{
“name”: “phone”,
“value”: “={{ $json.body.phone }}”
},
{
“name”: “locationId”,
“value”: “Wyba2v9gnxaXgpUCNypq”
},
{
“name”: “tags”,
“value”: “={{ [‘business-guest’, ‘source-suiteop’, ‘stayed-0-3m’] }}”
}
]
},
“options”: {}
},
“id”: “6748cc42-2ad7-46b2-a2e5-5b41f25f3c67”,
“name”: “Create LeadConnector Contact”,
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 4.4,
“position”: [
464,
304
]
}
],
“connections”: {
“Webhook”: {
“main”: [
[
{
“node”: “Create LeadConnector Contact”,
“type”: “main”,
“index”: 0
}
]
]
}
],
“pinData”: {},
“meta”: {
“instanceId”: “ea0c2eec4b76caa69b4b4c5710d93f227ef34fb351dbfc568d1671e154e38c4a”
}
}

In your Authorization header, your value is set to just the token like this:
pit-b7e4542a-00c5-4843-8f75-504d9da5b3ab

You need to add the word Bearer and a space before it, like this:
Bearer pit-b7e4542a-00c5-4843-8f75-504d9da5b3ab
GoHighLevel expects the word “Bearer” before the token. Without it, the server does not recognise the token as valid, which is exactly why you are getting the “Invalid JWT” error even though your token is correct.
How to fix it:

1.Open your HTTP node
2.Scroll to the Headers section
3.Find the Authorization row
4.Change the Value to: Bearer then a space then your token

That should fix it straight away.

If the Bearer issue is resolved but the Location Token is still causing problems, feel free to reach out to me!