How to send base64-encoded PDF file from Google Drive to HTTP Request node?

Describe the problem/error/question

What is the error message (if any)?

Please share your workflow

(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.)

Share the output returned by the last node

Information on your n8n setup

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

Hi, I’m trying to connect to an external API using the HTTP Request node in n8n.

Here’s my current workflow:

  • Google Drive Node

    • Operation: Download
    • Resource: File
  • HTTP Request Node

    • Method: POST
    • Content-Type: application/json

According to the API documentation, I need to send the PDF file as a base64-encoded string in the data field of the JSON body.

The Google Drive node successfully downloads the PDF file.
However, I’m not sure how to access the base64-encoded binary data of the file.

I read in the documentation that it might be accessible using binary.data.data,
but when I try that, I get an error saying the data doesn’t exist.

:red_question_mark: What’s the correct way to reference the base64 data from the Google Drive node
in the HTTP Request node?

Example payload I want to build:

{
  "data": ??? ← What expression should go here?
}

Try this:

This is how you can turn pdf binary to a base64 string.

Thank you! However, I have an additional question. When I ran an OCR on the extracted data, it seems that only one of the two PDF pages was OCRed. What could be the issue?

@skkustartup

If you could create an additional topic about this saparaate issue, that would be great; and for this one, if I was able to answer your question, kindly mark the answer as solution. Thank you.