Unable to upload file to OpenAI

Describe the problem/error/question

I have tried every permutation combination but I keep getting some error or the other.

What is the error message (if any)?

Problem in node ‘Upload to OpenAI‘

Bad request - please check your parameters

Please share your workflow

{
“name”: “My workflow 5”,
“nodes”: [
{
“parameters”: {
“pollTimes”: {
“item”: [
{
“mode”: “everyMinute”
}
]
},
“triggerOn”: “specificFolder”,
“folderToWatch”: {
“__rl”: true,
“value”: “10T4ENzJyH9tHPRsfYAJiubyfEWHBgQA5”,
“mode”: “list”,
“cachedResultName”: “Jyotish GPT”,
“cachedResultUrl”: “https://drive.google.com/drive/folders/10T4ENzJyH9tHPRsfYAJiubyfEWHBgQA5
},
“event”: “fileCreated”,
“options”: {}
},
“id”: “a6701451-1342-405b-9689-1e8b7b8392e4”,
“name”: “Google Drive Trigger”,
“type”: “n8n-nodes-base.googleDriveTrigger”,
“typeVersion”: 1,
“position”: [
0,
0
],
“webhookId”: “webhook-google-drive”,
“credentials”: {
“googleDriveOAuth2Api”: {
“id”: “OpSGKxszwYZ56LSY”,
“name”: “Google Drive account 2”
}
}
},
{
“parameters”: {
“authentication”: “oAuth2”,
“operation”: “download”,
“fileId”: “={{ $json["id"] }}”,
“options”: {}
},
“id”: “5891c060-4a83-4d2b-b075-35fed073320b”,
“name”: “Download File”,
“type”: “n8n-nodes-base.googleDrive”,
“typeVersion”: 1,
“position”: [
200,
0
],
“credentials”: {
“googleDriveOAuth2Api”: {
“id”: “OpSGKxszwYZ56LSY”,
“name”: “Google Drive account 2”
}
}
},
{
“parameters”: {
“authentication”: “headerAuth”,
“requestMethod”: “POST”,
“url”: “https://api.openai.com/v1/files”,
“responseFormat”: “file”,
“options”: {
“bodyContentType”: “multipart-form-data”
},
“bodyParametersUi”: {
“parameter”: [
{
“name”: “purpose”,
“value”: “assistants”
},
{
“name”: “file”,
“value”: “=”
}
]
}
},
“id”: “0b2b723a-9d02-4b90-afd2-c3f7443ba832”,
“name”: “Upload to OpenAI”,
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 1,
“position”: [
420,
0
],
“credentials”: {
“httpHeaderAuth”: {
“id”: “hhcldC0WlK1A5yle”,
“name”: “Header Auth account 4”
}
}
}
],
“pinData”: {},
“connections”: {
“Google Drive Trigger”: {
“main”: [
[
{
“node”: “Download File”,
“type”: “main”,
“index”: 0
}
]
]
},
“Download File”: {
“main”: [
[
{
“node”: “Upload to OpenAI”,
“type”: “main”,
“index”: 0
}
]
]
}
},
“active”: false,
“settings”: {
“executionOrder”: “v1”
},
“versionId”: “b43eebb0-94d3-4310-9ec6-8cb0932537d5”,
“meta”: {
“templateCredsSetupCompleted”: true,
“instanceId”: “4a2510480edb298f31a3562f4682ee03a7c8f8df7e9b8d44d92a26456e842574”
},
“id”: “4RQJA9dDTV2qVIg9”,
“tags”:
}

(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": {
        "authentication": "headerAuth",
        "requestMethod": "POST",
        "url": "https://api.openai.com/v1/files",
        "responseFormat": "file",
        "options": {
          "bodyContentType": "multipart-form-data"
        },
        "bodyParametersUi": {
          "parameter": [
            {
              "name": "purpose",
              "value": "assistants"
            },
            {
              "name": "file",
              "value": "="
            }
          ]
        }
      },
      "id": "0b2b723a-9d02-4b90-afd2-c3f7443ba832",
      "name": "Upload to OpenAI",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        420,
        0
      ],
      "credentials": {
        "httpHeaderAuth": {
          "id": "hhcldC0WlK1A5yle",
          "name": "Header Auth account 4"
        }
      }
    }
  ],
  "connections": {},
  "pinData": {},
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "4a2510480edb298f31a3562f4682ee03a7c8f8df7e9b8d44d92a26456e842574"
  }
}

Share the output returned by the last node

data

File Name:

Neech Bhanga.pdf

File Extension:

pdf

Mime Type:

application/pdf

File Size:

153 kB

Just want to get past this error

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:

Did tried to pass it in base64 ?

I’ve recently started learning N8N. I don’t even know what you mean by base64. Can you elaborate?

Base64 let you have a file reprensanted as text in base64. This a way that some Web site use to transfert file over the web. This is a “text” representation of a binary file.

Has been solved already
Thank you so much