# How to set HubDB image value through API?

**URL:** <https://community.hubspot.com/t/how-to-set-hubdb-image-value-through-api/49480>\
**Category:** CMS Development\
**Tags:** hubdb\
**Created:** [January 10, 2022, 1:15pm UTC](https://community.hubspot.com/t/how-to-set-hubdb-image-value-through-api/49480 "2022-01-10T13:15:59Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![gufoe](https://avatars.discourse-cdn.com/v4/letter/g/f17d59/32.png) [@gufoe](https://community.hubspot.com/u/gufoe)\
**Post date:** [January 10, 2022, 1:15pm UTC](https://community.hubspot.com/t/how-to-set-hubdb-image-value-through-api/49480/1 "2022-01-10T13:15:59Z")

</div>

There is no documentation about how to set a image cell value through the HubDB API.

I managed to upload the file to the file manager and get its ID and URL.

But now I don’t know how to use that into HubDB.

I tried many things, none worked.

I tried: a STRING url, it gives me

[message] =\> error when updating datatable row 63392861046 in table 5315761 for portal 3077106: the value {type=string, value=} for column image was of type STRING, but we’re expecting MAP

Then I tried with [type =\> image, value =\> http://] and many other combinations using both url, path, and ID.

No errors but nothing is set.

---

<div class="post-metadata">

**Author:** ![piersg](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/piersg/32/99782_2.png) [@piersg](https://community.hubspot.com/u/piersg)\
**Post date:** [January 10, 2022, 5:29pm UTC](https://community.hubspot.com/t/how-to-set-hubdb-image-value-through-api/49480/2 "2022-01-10T17:29:47Z")

</div>

With an image column type you can just insert an image using the normal Hubspot image selector when editing the HubDB

 ![piersg_0-1641835674084.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/a/8/a8bdaeaaba5742b467a68493d35995b07c6ed4bb.png)

 ![piersg_1-1641835688833.png](https://d2qpr2jzcazej7.cloudfront.net/original/3X/b/8/b8e6d12c575ffe111407b70b57d51a99da9cdd39.png)

Alternatively, if you want to point to a URL where an image is hosted instead of selecting one of your own images, use the URL column type and add the full address e.g. [https://via.placeholder.com/350x150](https://via.placeholder.com/350x150)

---

<div class="post-metadata">

**Author:** ![gufoe](https://avatars.discourse-cdn.com/v4/letter/g/f17d59/32.png) [@gufoe](https://community.hubspot.com/u/gufoe)\
**Post date:** [January 11, 2022, 7:38am UTC](https://community.hubspot.com/t/how-to-set-hubdb-image-value-through-api/49480/3 "2022-01-11T07:38:12Z")

</div>

Sorry, I meant throught the API, not through the interface.

---

<div class="post-metadata">

**Author:** ![piersg](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/piersg/32/99782_2.png) [@piersg](https://community.hubspot.com/u/piersg)\
**Post date:** [January 11, 2022, 9:34am UTC](https://community.hubspot.com/t/how-to-set-hubdb-image-value-through-api/49480/4 "2022-01-11T09:34:54Z")

</div>

@gufoe ah sorry, I misunderstood. I think you have to pass it an object as a value, like so

`{"width": null, "height": null, "url": "[full url of image including https://]"}`

as that’s how images are represented in HubDB. A map is a dict, i.e. a set of key value pairs.

---

<div class="post-metadata">

**Author:** ![gufoe](https://avatars.discourse-cdn.com/v4/letter/g/f17d59/32.png) [@gufoe](https://community.hubspot.com/u/gufoe)\
**Post date:** [February 14, 2022, 10:23am UTC](https://community.hubspot.com/t/how-to-set-hubdb-image-value-through-api/49480/5 "2022-02-14T10:23:04Z")

</div>

Sorry for the late reply. This method is not working aswell.

I get the following error: error when updating datatable row 65217422972 in table 5297224 for portal 3077106: null

This is my request content for the column [

[width] =\> 10  
[height] =\> 10  
[url] =\> [https://academy.dakota.eu/hubfs/On%20Page%20-%20section5-1.png](https://academy.dakota.eu/hubfs/On%20Page%20-%20section5-1.png)  
]

Any other idea?

---

<div class="post-metadata">

**Author:** ![gufoe](https://avatars.discourse-cdn.com/v4/letter/g/f17d59/32.png) [@gufoe](https://community.hubspot.com/u/gufoe)\
**Post date:** [February 14, 2022, 10:24am UTC](https://community.hubspot.com/t/how-to-set-hubdb-image-value-through-api/49480/6 "2022-02-14T10:24:09Z")

</div>

I tried passing null to width and height but I get the very same error

---

<div class="post-metadata">

**Author:** ![JArechiga](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jarechiga/32/14727_2.png) [@JArechiga](https://community.hubspot.com/u/JArechiga)\
**Post date:** [September 20, 2022, 11:04pm UTC](https://community.hubspot.com/t/how-to-set-hubdb-image-value-through-api/49480/7 "2022-09-20T23:04:39Z")

</div>

In addition to **width** and **height** , a **type** key with a value of **image** is also needed. For example if you’re using JSON, here is a valid image object you can post with the API:

```lia-code-sample
"image_property_name": {
 "url": "https://example.com/image.png",
 "width": 100,
 "height": 100,
 "type": "image"
}

```
