# Upload Image : AxiosError: Request failed with status code 422

**URL:** <https://forum.ghost.org/t/upload-image-axioserror-request-failed-with-status-code-422/38093>\
**Category:** Developer help\
**Created:** [April 26, 2023, 9:12pm UTC](https://forum.ghost.org/t/upload-image-axioserror-request-failed-with-status-code-422/38093 "2023-04-26T21:12:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![nicolas\_chevalarias](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/nicolas_chevalarias/32/24174_2.png) [@nicolas\_chevalarias](https://forum.ghost.org/u/nicolas_chevalarias)\
**Post date:** [April 26, 2023, 9:12pm UTC](https://forum.ghost.org/t/upload-image-axioserror-request-failed-with-status-code-422/38093/1 "2023-04-26T21:12:00Z")

</div>

Good morning,  
I am new to ghost and I created my site on the ghost servers in order to test post publication via the API.  
I want to upload an image from an url and then put it in an HTML post.

I think I have implemented the API correctly but it gives me an error: “Please select an image.”.

Here is the Code:

```auto
const [id, secret] = API_KEY. split(':');
const token = jwt.sign({}, Buffer.from(secret, 'hex'), {
         keyid: id,
         algorithm: 'HS256',
         expiresIn: '5m',
         audience: `/admin/`
     });
     const url = 'https://sportews-2.ghost.io/ghost/api/admin/images/upload';
     const payload = {
         images: [
             {
                 url: "https://media.api-sports.io/football/teams/182.png",
                 ref: "6.png"
             }
         ]
     };
     const headers = { Authorization: `Ghost ${token}`};

     axios.post(url, payload, { headers })
         .then(response => console.log(response))
         .catch(error => {
             console.error(error)
         });

```

---

<div class="post-metadata">

**Author:** ![RyanF](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/ryanf/32/17448_2.png) [@RyanF](https://forum.ghost.org/u/RyanF)\
**Post date:** [April 27, 2023, 4:58pm UTC](https://forum.ghost.org/t/upload-image-axioserror-request-failed-with-status-code-422/38093/2 "2023-04-27T16:58:38Z")

</div>

This API request isn’t quite right. You’re providing the response object as the payload.

Instead, you need to follow the steps outlined here:

> **[Ghost Admin API Documentation](https://ghost.org/docs/admin-api/#uploading-an-image)**
>
> Manage content via Ghost's Admin API, with secure role-based authentication. Read more on Ghost Docs 👉
