# Upload binary image to Ghost AdminAPI from n8n fails

**URL:** <https://forum.ghost.org/t/upload-binary-image-to-ghost-adminapi-from-n8n-fails/42697>\
**Category:** Developer help\
**Created:** [November 14, 2023, 11:24am UTC](https://forum.ghost.org/t/upload-binary-image-to-ghost-adminapi-from-n8n-fails/42697 "2023-11-14T11:24:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Disane](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/disane/32/27327_2.png) [@Disane](https://forum.ghost.org/u/Disane)\
**Post date:** [November 14, 2023, 11:24am UTC](https://forum.ghost.org/t/upload-binary-image-to-ghost-adminapi-from-n8n-fails/42697/1 "2023-11-14T11:24:58Z")

</div>

I want to upload a binary image to the Ghost Admin API from a workflow engine (n8n) but that fails.

![image](https://us1.discourse-cdn.com/flex015/uploads/ghost2/original/3X/c/9/c946a129e7fbea57e67ba41b087c2b5128083346.jpeg)

As stated in the docs ([Ghost Admin API Documentation](https://ghost.org/docs/admin-api/#uploading-an-image)) the upload expects the file as `Blob`or `File`but imho thats the case, even when I don’t use a physical file, instead a use the direct binary data.

Actually I get this error:

> ERROR: Your request is invalid or could not be processed by the service  
> 415 - “{"errors":[{"message":"Please select a valid image.","context":null,"type":"UnsupportedMediaTypeError","details":null,"property":null,"help":null,"code":null,"id":"382764a0-827e-11ee-892a-db6acb4b0f68","ghostErrorCode":null}]}” - {“errors”:[{“message”:“Please select a valid image.”,“context”:null,“type”:“UnsupportedMediaTypeError”,“details”:null,“property”:null,“help”:null,“code”:null,“id”:“382764a0-827e-11ee-892a-db6acb4b0f68”,“ghostErrorCode”:null}]}

IMHO the request looks good. I already tested it with a webhook test site and that was the result:  
[(3) Webhook.site - Test, process and transform emails and HTTP requests](https://webhook.site/#!/a10e4ad9-2110-4e4e-be41-076cbd3156a7/70e30709-74de-40a0-8287-2f7068a1af0a/1)

What am I missing?

n8n setup:

- **n8n version:** Version 1.15.2
- **Database (default: SQLite):** MySQL
- **n8n EXECUTIONS\_PROCESS setting (default: own, main):** not changed
- **Running n8n via (Docker, npm, n8n cloud, desktop app):** Docker
- **Operating system:** Unraid

ghost setup:

- **Version:** [5.72.1](https://github.com/TryGhost/Ghost/releases/tag/v5.72.1)

Running as docker

---

<div class="post-metadata">

**Author:** ![Kevin](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/kevin/32/32_2.png) [@Kevin](https://forum.ghost.org/u/Kevin)\
**Post date:** [November 14, 2023, 11:29am UTC](https://forum.ghost.org/t/upload-binary-image-to-ghost-adminapi-from-n8n-fails/42697/2 "2023-11-14T11:29:06Z")

</div>

![Screenshot 2023-11-14 at 11.28.09](https://us1.discourse-cdn.com/flex015/uploads/ghost2/original/3X/0/c/0c51674967dd24614e20cd2349d8f5f1078b2d97.png)

You’re missing the `file` (the file/blob) form data property.

---

<div class="post-metadata">

**Author:** ![Disane](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/disane/32/27327_2.png) [@Disane](https://forum.ghost.org/u/Disane)\
**Post date:** [November 14, 2023, 1:36pm UTC](https://forum.ghost.org/t/upload-binary-image-to-ghost-adminapi-from-n8n-fails/42697/3 "2023-11-14T13:36:25Z")

</div>

Thank you! I discovered that I need to invoke my generating request with filename.extension at the end in the address. Than everything works perfectly. Nothing which is a problem at ghost side. Sorry for bothering :)
