API call failure.. can't sort out what I'm doing wrong

I have the following API call, that I can do in Postman no issue… I can also paste into the web, no issue, but creating the same call in n8n consistently gives me a 403 error…

https://mobile.fmcsa.dot.gov/qc/services/carriers/2591066/?webKey=8fc080abfa6e1bc887849e73b95d5c077c0d02b5

What is the error message (if any)?

403 - "<html>\r\n<head><title>403 Forbidden</title></head>\r\n<body>\r\n<center><h1>403 Forbidden</h1></center>\r\n</body>\r\n</html>\r\n"

Request

{ "headers": { "user-agent": "n8n", "accept": "application/json" }, "method": "GET", "uri": "https://mobile.fmcsa.dot.gov/qc/services/carriers/2591066/?webKey=8fc080abfa6e1bc887849e73b95d5c077c0d02b5\", "gzip": true, "rejectUnauthorized": true, "followRedirect": true, "resolveWithFullResponse": true, "followAllRedirects": true, "maxRedirects": 21, "timeout": 300000, "encoding": null, "json": false, "useStream": true }

Please share your workflow

Using the GET HTTP request I configure as follows:

URL - https://mobile.fmcsa.dot.gov/qc/services/carriers/2591066/?webKey=8fc080abfa6e1bc887849e73b95d5c077c0d02b5

“headers”: {
“User-Agent”: “n8n”,
“Accept”: “application/json”

“followRedirects”: true


(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

{
“nodes”: [
{
“parameters”: {
“url”: “https://mobile.fmcsa.dot.gov/qc/services/carriers/2591066/?webKey=8fc080abfa6e1bc887849e73b95d5c077c0d02b5”,
“sendHeaders”: true,
“headerParameters”: {
“parameters”: [
{
“name”: “User-Agent”,
“value”: “n8n”
},
{
“name”: “Accept”,
“value”: “application/json”
}
]
},
“options”: {
“redirect”: {
“redirect”: {}
}
}
},
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 4.2,
“position”: [
-300,
-80
],
“id”: “f8901f77-ee08-45d9-a436-c0a059f2665e”,
“name”: “HTTP Request”,
“executeOnce”: false
}
],
“connections”: {},
“pinData”: {},
“meta”: {
“templateCredsSetupCompleted”: true,
“instanceId”: “aca0339c46cbee6ca406d5c0ca26494bdeeb44f859838f9696b124c5037e2bd7”
}
}

Share the output returned by the last node

Information on your n8n setup

  • n8n version: - 1.77.3
  • Database (default: SQLite): none
  • n8n EXECUTIONS_PROCESS setting (default: own, main): own
  • Running n8n via (Docker, npm, n8n cloud, desktop app):. n8n cloud
  • Operating system:. Mac OS

It looks like your topic is missing some important information. Could you provide the following if applicable.

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

Hi @John_Shoust - Welcome to the community! You might try your HTTP Node without sending headers. It looks like your source (FMSCA) has you structure queries with your webkey appended. I was able to pull data for the carrier you have listed in your URL within the HTTP Node: Give it a try and let us all know if it works for your use-case!

Gosh, I wish I wasn’t losing my mind here… I cannot see an ounce of difference between mine and yours…

@John_Shoust - That is puzzling! Your original post showed the node JSON as containing header values. All I did was create a new HTTP Request node in my canvas and then copy pasted the URL you provided into the settings.

For example, here is my node configuration:

{
“nodes”: [
{
“parameters”: {
“url”: “https://mobile.fmcsa.dot.gov/qc/services/carriers/2591066/?webKey=8fc080abfa6e1bc887849e73b95d5c077c0d02b5”,
“options”: {
“allowUnauthorizedCerts”: false
}
},
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 4.2,
“position”: [
220,
0
],
“id”: “a002b7f5-1cb2-49fb-8755-5bf7ee67b44e”,
“name”: “HTTP Request”
}
],
“connections”: {},
“pinData”: {},
“meta”: {
“instanceId”: “9ece000261a85eddaff876fb32cc39e5b0d4e2ccd7ac87545f96083c052b0963”
}
}


Perhaps try deleting your HTTP Node and creating from new? Just to note, I am using the same n8n version 1.77.3 on a local hosted Docker.

Also, something to strongly consider, since your webKey is tied to your FMCSA login, you might want to delete and recreate your webKey after you solve this issue!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.