N8n WordPress Media Upload Failing - "The service was not able to process your request"

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:

  1. Is my header configuration correct for WordPress media uploads?
  2. Could this be a file permission issue on the WordPress side?
  3. Do I need to add the .htaccess authorization rules for the WordPress REST API?
  4. 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:
1 Like

Hey @Sandro

It seems like you need a full stop between filename and file extension, it seems to be causing it to think it’s a different file type,

WP Extra File Types Plugin — WordPress.com which if using other file types u can use this, but am quite sure jpg is already acceptable, so it’s likely the full stop needed.

This is the node I have

Best regards,

Samuel

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.