I’m trying to upload images to WordPress via the REST API using n8n, but I’m getting an error. Here’s my setup:
Configuration:
- Method: POST
- URL:
[my-domain]/wp-json/wp/v2/media/
- Authentication: WordPress API (using application password)
- Headers:
content-disposition
:attachment; filename={{ $binary.data.fileName }}
content-type
:{{ $binary.data.mimeType }}
- Body Content Type: n8n Binary File
- Input Data Field Name: data
Error Message:
“The service was not able to process your request” “Du bist leider nicht berechtigt, diesen Dateityp hochzuladen.” (You are not authorized to upload this file type)
Questions:
- Is my header configuration correct for WordPress media uploads?
- Could this be a file permission issue on the WordPress side?
- Do I need to add the
.htaccess
authorization rules for the WordPress REST API? - Is there a different approach for handling binary file uploads to WordPress via n8n?
The file I’m trying to upload is a standard JPEG image. WordPress is hosted on a Hestia control panel server.
Any help would be greatly appreciated!
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:
- Database (default: SQLite):
- n8n EXECUTIONS_PROCESS setting (default: own, main):
- Running n8n via (Docker, npm, n8n cloud, desktop app):
- Operating system: