Upload a file in Pipedream and pass the URL to the next step
Pipedream handles triggers, code, and downstream actions. FilePost handles the durable public file URL: keep the key in a secret input, upload the bytes, and export the response fields your next step needs.
Webhook or buffer in
Use request bodies and headers from an HTTP trigger, or map bytes from an earlier step.
Multipart upload
Use Python requests or Node.js axios and FilePost's dedicated upload host.
URL out
Export file_url, file_id, file_size, and expiry for later steps.
Python step
Define filepost_api_key as a secret input. Adapt the trigger field names to your workflow.
import requests
def handler(pd: "pipedream"):
file_data = pd.steps["trigger"]["event"]["body"]
file_name = pd.steps["trigger"]["event"]["headers"].get("x-filename", "upload.bin")
content_type = pd.steps["trigger"]["event"]["headers"].get("content-type", "application/octet-stream")
response = requests.post(
"https://upload.filepost.dev/v1/upload",
headers={
"X-API-Key": pd.inputs["filepost_api_key"],
"X-FilePost-Integration": "pipedream",
},
files={"file": (file_name, file_data, content_type)},
timeout=60,
)
response.raise_for_status()
result = response.json()
pd.export("file_url", result["url"])
pd.export("file_id", result["file_id"])
pd.export("file_size", result["size"])
return result
Choose the correct input path
Use multipart /v1/upload for bytes, /v1/upload/base64 when the previous step returns encoded content, and /v1/upload/url when it returns a public temporary URL. Add expires_in when the artifact should disappear after processing.
For the longer Node.js example and webhook response step, read the Pipedream file upload guide. For AI-oriented patterns, see FilePost for AI agents.