Skip to main content
Question

Webhooks returns base64 PDF, how do I turn it into a single “file” output for later steps?

  • August 27, 2025
  • 3 replies
  • 53 views

I’m pulling a PDF from an external API using Webhooks by Zapier (GET). The request works (I can download and view the PDF outside Zapier), but the API returns the PDF base64-encoded inside JSON. I need to convert that base64 into a single file object I can attach in later steps (Google Drive upload / Gmail attachment), but I can’t get Zapier to expose it as one “file” field — it keeps showing separate fields (filename/mime/content) or plain text.

 

My goal is to convert the JSON response { status: 1, data: "<very long base64>" } into a proper file output  so downstream actions treat it as a file (I’ve read somewhere it shows as “Exists but not shown”).

 

Sample of the response headers: content-type: text/html; charset=UTF-8, content-encoding: gzip

 

What I’ve already tried:

  • Returning three top-level outputs (filename, mime_type, content), downstream apps see them as three separate text fields, not a file.

  • Wrapping under a single file key as { file: { filename, mime_type, content } } (JS) / {"file": {...}} (Python), still not consistently getting a single “file” output; sometimes I only see the pieces.

  • JSON.rawJSON(...) on the Code step output, no change.

  • I also tried cleaning the payload (trim everything before %PDF-), then re-encoding to base64.

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

3 replies

Troy Tessalone
Zapier Orchestrator & Solution Partner
Forum|alt.badge.img+14
  • Zapier Orchestrator & Solution Partner
  • August 27, 2025

Hi ​@apiering 

Have you tried asking ChatGPT for custom Code (JavaScript / Python) to handle that file conversion?

 

Code: https://zapier.com/apps/code/integrations#help


Troy Tessalone
Zapier Orchestrator & Solution Partner
Forum|alt.badge.img+14
  • Zapier Orchestrator & Solution Partner
  • August 27, 2025

@apiering 

Have you tried using this Zap app: Base64 Encoder/Decoder

https://zapier.com/apps/base64-encoderdecoder/integrations

 


SamB
Community Manager
Forum|alt.badge.img+11
  • Community Manager
  • September 4, 2025

Hey ​@apiering, just checking in—were you able to get your Zap working by using the existing Base64 app as Troy suggested? 

Want to make sure this gets sorted, so let us know if you still need any help at all! 🙂