Update CMS Item image field via API

I want to update my collection item via API. I am using google app script for this, I have no problem with text based and boolean based items. I can update them smoothly.

but when it comes on image field, i can’t update it. if the cms item does not have value for image, the API response will not include the image field therefore I can’t make any changes as it will return (Screenshot by Lightshot - hero-image’: Field not described in schema)

now the API works only if i have existing image uploaded via CMS and will update it via API.

Is there anyway that I can update my blank image field straight from API?

note: i did tried PUT and PATCH but still no luck. any help would be greatly appreciated. thank ya’ll

nvm, okay so I got it now working this is my snippet. hope it helps others with the same issue

const COLLECTION_ID = ‘’;
const url = https://api.webflow.com/collections/${COLLECTION_ID}/items/${itemId};
const token = ‘’;
const options = {
method: ‘patch’,
headers: {
Accept: ‘application/json’,
‘Content-Type’: ‘application/json’,
Authorization: Bearer ${token}
},
// payload: JSON.stringify({
// fields: data // Include the ‘fields’ property with the data object
// }),
payload: JSON.stringify({
fields: {
name: data.table[0][1],
slug: (!data.useSlug) ? generateSlug(data.table[0][1]) : data.slug,
“new-image-field”: [{“url”: data.table[1][1]}],
_archived: false,
_draft: false
}
}),
muteHttpExceptions: true // Enable the option to mute HTTP exceptions
};

I used patch method and then for the image field i wrapped it on square brackets