# How to delete images from cloudinary

**URL:** https://community.thunkable.com/t/how-to-delete-images-from-cloudinary/1390766
**Category:** Questions about Thunkable X
**Tags:** beginner
**Created:** [July 11, 2021, 3:32pm UTC](https://community.thunkable.com/t/how-to-delete-images-from-cloudinary/1390766 "2021-07-11T15:32:48Z")
**Posts on this page:** 20
**Page:** 2

<div class="post-metadata">

### Author: ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)
#### Post date: [July 12, 2021, 7:00pm UTC](https://community.thunkable.com/t/how-to-delete-images-from-cloudinary/1390766/21 "2021-07-12T19:00:56Z")

</div>

You need to use the public\_id and the timestamp and follow it by the secret key.

Use the hashify API and you will get the correct signature. I know because I use it and it works.

I also took the sample data in Cloudinary documentation and run it through the API and got the same signature in the documentation.

---

<div class="post-metadata">

### Author: ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)
#### Post date: [July 13, 2021, 2:05am UTC](https://community.thunkable.com/t/how-to-delete-images-from-cloudinary/1390766/22 "2021-07-13T02:05:18Z")

</div>

> [@arleen](#):
>
> Can you please write the correct code block.  
> this is the link of sample I am trying.

I looked at your code. You are not passing any parameters to the hashify API and therefore you are not creating the correct signature.

> [@arleen](#):
>
> ` "message": "Invalid Signature kqb8gbway27wvmqvrspdt-fdjms. String to sign - 'public_id=y5b9oqtyqge6z3m2wwhf&timestamp=1626015856'."`

Use the suggestion in the error message and add to it your `secret key` and make it as the `body` of your first API.

So, assuming your `secret key` is abc123def987 then the `body` of the hashify API would look like this  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/5/a/5a8dd0f0a415c452413f1754cd2b4a6cc954f847.png)  
The `text` part is public\_id=y5b9oqtyqge6z3m2wwhf&timestamp=1626015856abc123def987

---

<div class="post-metadata">

### Author: ![arleen](https://avatars.discourse-cdn.com/v4/letter/a/a6a055/32.png) [@arleen](https://community.thunkable.com/u/arleen)
#### Post date: [July 13, 2021, 3:56am UTC](https://community.thunkable.com/t/how-to-delete-images-from-cloudinary/1390766/23 "2021-07-13T03:56:10Z")

</div>

As I told I am a beginner I am sorry.  
Now I changed my code like this.

 ![s2](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/f/9/f943f6cc7ecb3ac0730398f91f9d8f65170e5d5b.png)  
Now I get this error. “Upload preset must be whitelisted for unsigned uploads”.

I have added unsigned and signet preset in cloudinary  
this is the screen shot of cloudingnary…

 ![s3](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/6/36a3b9e2120a815100df5ae55c00b813734ce39d.png)  
What should I do next  
Thanks

---

<div class="post-metadata">

### Author: ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)
#### Post date: [July 13, 2021, 10:41am UTC](https://community.thunkable.com/t/how-to-delete-images-from-cloudinary/1390766/24 "2021-07-13T10:41:19Z")

</div>

I can see 4 obvious mistakes.

- Timestamp, according to documentation is UNIX time and you are using the `seconds since 1970` block which has a decimal part. You need to get rid of it.
- The `body` section of the Hashify does not include the `secret key` which will lead to wrong signature.
- The `query` section of Cloudinary API should be an `object` and you coded it as text.
- The `destroy` command does not require a “file=” as part of the parameters.

Hope this helps you to get code it correctly.

---

<div class="post-metadata">

### Author: ![lamagalhaes](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/lamagalhaes/32/76611_2.png) [@lamagalhaes](https://community.thunkable.com/u/lamagalhaes)
#### Post date: [July 13, 2021, 1:41pm UTC](https://community.thunkable.com/t/how-to-delete-images-from-cloudinary/1390766/25 "2021-07-13T13:41:59Z")

</div>

I use it another way to delete images.  
Set your api URL to this: [https://api.cloudinary.com/v1\_1/XXX/resources/image/upload/](https://api.cloudinary.com/v1_1/XXX/resources/image/upload/)  
where XXX is your cloud name  
Then, pass only one query parameter: `public_ids`  
This parameter must receive your url file name, without path and extension.  
Then you call DELETE method of api.

---

<div class="post-metadata">

### Author: ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)
#### Post date: [July 13, 2021, 2:17pm UTC](https://community.thunkable.com/t/how-to-delete-images-from-cloudinary/1390766/26 "2021-07-13T14:17:48Z")

</div>

Yes, this is part of Admin API resources which you can delete up to 100 images in one single call.

---

<div class="post-metadata">

### Author: ![arleen](https://avatars.discourse-cdn.com/v4/letter/a/a6a055/32.png) [@arleen](https://community.thunkable.com/u/arleen)
#### Post date: [July 13, 2021, 3:10pm UTC](https://community.thunkable.com/t/how-to-delete-images-from-cloudinary/1390766/27 "2021-07-13T15:10:36Z")

</div>

I changed like this now I get previous error “Invalid signature”

 ![s4](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/5/3/533d7e8c80a61cfec1b43644d46c1944c228653e.png)

my project link  
[https://x.thunkable.com/copy/0d8ff07bf84ed81479a26d599c65ab63](https://x.thunkable.com/copy/0d8ff07bf84ed81479a26d599c65ab63)

---

<div class="post-metadata">

### Author: ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)
#### Post date: [July 13, 2021, 5:06pm UTC](https://community.thunkable.com/t/how-to-delete-images-from-cloudinary/1390766/28 "2021-07-13T17:06:12Z")

</div>

Of course it will be invalid signature.  
The `body section` of the first URL should include only the following:  
public\_id  
timestamp  
**secret key**

You are using signature in the first URL which is **WRONG**.

I cannot help you with the project because I do not have your **secret key**. You are the only one who can add it to the `body section` of the first URL to create the correct signature.

---

<div class="post-metadata">

### Author: ![arleen](https://avatars.discourse-cdn.com/v4/letter/a/a6a055/32.png) [@arleen](https://community.thunkable.com/u/arleen)
#### Post date: [July 13, 2021, 5:12pm UTC](https://community.thunkable.com/t/how-to-delete-images-from-cloudinary/1390766/29 "2021-07-13T17:12:33Z")

</div>

this is my secret key  
KqB8gbWAY27wvMQvgh

---

<div class="post-metadata">

### Author: ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)
#### Post date: [July 13, 2021, 5:43pm UTC](https://community.thunkable.com/t/how-to-delete-images-from-cloudinary/1390766/30 "2021-07-13T17:43:35Z")

</div>

I encourage you to remove sensitive info from the forum.

This is the `body section` of the Hashify API  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/5/c/5c26c288b7ddb011e585a9000029d5b20e068a73.png)

The **public\_id** should be referring to the image. If you uploaded the image using the `MediaDB` component of Thunkable then the the **public\_id** will be very similar in construction and format to the **secret key** you provided.

---

<div class="post-metadata">

### Author: ![arleen](https://avatars.discourse-cdn.com/v4/letter/a/a6a055/32.png) [@arleen](https://community.thunkable.com/u/arleen)
#### Post date: [July 14, 2021, 2:54am UTC](https://community.thunkable.com/t/how-to-delete-images-from-cloudinary/1390766/31 "2021-07-14T02:54:56Z")

</div>

Sorry to reveal my secret key, as this is trial after that I will change my key.  
Are you able to open my project?.  
I changed as you said but same error.

Thanks

---

<div class="post-metadata">

### Author: ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)
#### Post date: [July 14, 2021, 12:00pm UTC](https://community.thunkable.com/t/how-to-delete-images-from-cloudinary/1390766/32 "2021-07-14T12:00:28Z")

</div>

I’ve noticed you change the URL to “upload” the details are for “destroy”. I will check it later.

---

<div class="post-metadata">

### Author: ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)
#### Post date: [July 14, 2021, 3:06pm UTC](https://community.thunkable.com/t/how-to-delete-images-from-cloudinary/1390766/33 "2021-07-14T15:06:51Z")

</div>

I kept getting invalid signature with all the attempts and modifications I did and then I decided to use the credentials of my Cloudinary account and I immediately go this

 ![Screenshot_20210714_175820_com.thunkable.live](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/5/5/55747ea1d474c0a4462c85776ccc16b0c6347614.jpeg)

This is correct because the public id is not in my Cloudinary account.

Result is: you have something wrong with either your API key or your Secret key or your public\_id

---

<div class="post-metadata">

### Author: ![arleen](https://avatars.discourse-cdn.com/v4/letter/a/a6a055/32.png) [@arleen](https://community.thunkable.com/u/arleen)
#### Post date: [July 16, 2021, 7:55am UTC](https://community.thunkable.com/t/how-to-delete-images-from-cloudinary/1390766/34 "2021-07-16T07:55:53Z")

</div>

I now created a new account in cloudinary, then also I get the same error.

Proj link: [https://x.thunkable.com/copy/94c37faaa7e5f7bde28da56bd5efe2b0](https://x.thunkable.com/copy/94c37faaa7e5f7bde28da56bd5efe2b0)

Thanks.

---

<div class="post-metadata">

### Author: ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)
#### Post date: [July 16, 2021, 12:17pm UTC](https://community.thunkable.com/t/how-to-delete-images-from-cloudinary/1390766/35 "2021-07-16T12:17:23Z")

</div>

Check this.

I changed the code a bit and used a photo from the net (I did not use “select” option)

You can upload the image then test your own account to see that the photo is uploaded.  
You can then use the delete option to remove it from your Cloudinary account.

[https://x.thunkable.com/projectPage/60f13c644a6596001191d3fc](https://x.thunkable.com/projectPage/60f13c644a6596001191d3fc)

---

<div class="post-metadata">

### Author: ![arleen](https://avatars.discourse-cdn.com/v4/letter/a/a6a055/32.png) [@arleen](https://community.thunkable.com/u/arleen)
#### Post date: [July 17, 2021, 5:30am UTC](https://community.thunkable.com/t/how-to-delete-images-from-cloudinary/1390766/36 "2021-07-17T05:30:39Z")

</div>

Thank you very much now it is working fine.  
I found one more problem by using photo library. I assigned Photo from Photo library to a label, here I get “file:///…” which shows invalid URL. Is there any solution to get file path correctly?.

I Used Media DB for uploading and took public Id from its URL like this.  
I want to know weather I am doing right or any method.

 ![s1](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/4/9/49d1c71099bc26f669b53823399e9dea44129d00.png)  
Any how it is working for delete.  
Thanks.

---

<div class="post-metadata">

### Author: ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)
#### Post date: [July 17, 2021, 3:33pm UTC](https://community.thunkable.com/t/how-to-delete-images-from-cloudinary/1390766/37 "2021-07-17T15:33:04Z")

</div>

If you use Media DB to upload your images then the public\_id is the image file name without the extension (.jpg or others).

---

<div class="post-metadata">

### Author: ![arleen](https://avatars.discourse-cdn.com/v4/letter/a/a6a055/32.png) [@arleen](https://community.thunkable.com/u/arleen)
#### Post date: [July 18, 2021, 4:54pm UTC](https://community.thunkable.com/t/how-to-delete-images-from-cloudinary/1390766/38 "2021-07-18T16:54:42Z")

</div>

But how can we get file name and path from camera or photo library?

---

<div class="post-metadata">

### Author: ![muneer](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/muneer/32/75210_2.png) [@muneer](https://community.thunkable.com/u/muneer)
#### Post date: [July 18, 2021, 5:27pm UTC](https://community.thunkable.com/t/how-to-delete-images-from-cloudinary/1390766/39 "2021-07-18T17:27:16Z")

</div>

The cloudinary API requires full URL of the image starting with “http or https”. I does not recognise URL starting with “file://”

You will need external code to upload files directly from the phone to Cloudinary using API.

Media DB component takes care of this process.

---

<div class="post-metadata">

### Author: ![arleen](https://avatars.discourse-cdn.com/v4/letter/a/a6a055/32.png) [@arleen](https://community.thunkable.com/u/arleen)
#### Post date: [July 18, 2021, 5:54pm UTC](https://community.thunkable.com/t/how-to-delete-images-from-cloudinary/1390766/40 "2021-07-18T17:54:56Z")

</div>

So there is no way to get file path for uploading using photo library. Can we use any external code in thinkable?.

Thanks

 ![E102197AE27D40BD82DDD13B1F6C506D.png](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/1/7159a975d714a6caee787759490140daf4d4fda6.png)

[Previous page](https://community.thunkable.com/t/how-to-delete-images-from-cloudinary/1390766.md?page=1)

[Next page](https://community.thunkable.com/t/how-to-delete-images-from-cloudinary/1390766.md?page=3)
