Delete Render Files When Storage Full

Trying to retrieve assets for deletion to free up storage but getting a Forbidden error.

As we understand, deletion of a render with a given RENDER ID from the Shotstack CDN involves retrieving all the IDs of all the assets stored for the render in the CDN, therefore we tried retrieving the asset IDs for the known render IDs using Shotscack API programmatically, however, we get 403 Forbidden response from the Shotstack API on all our requests.

[403] Client error: GET https://api.shotstack.io/serve/v1/assets/render/b****5-40d0-47e3-9**d-6*******7 resulted in a 403 Forbidden response: {“message”:“Forbidden”}

Perhaps, Shotstack API denies all our calls for the same reason - no more storage available in their CDN?

Any advice?

First off, are you using your API key in the x-api-key header? Like all other calls, you need to provide the API key. Also make sure you are using the correct for the correct stage. It looks like you are calling v1, so use your v1/production/prod key.

Next, you need to get the asset ID by looking up all the assets created for a known render ID. It sounds like this is where you are stuck.

API reference docs are here: Shotstack v1 API Reference Documentation and a simple Curl request to do what you want should look something like this:

curl -X GET \
     -H "Content-Type: application/json" \
     -H "x-api-key: ptmpOiyKgGYMnnONwvXH7FHzDGOazrIjaEDUS7Cf" \
     https://api.shotstack.io/serve/stage/assets/render/d2b46ed6-998a-4d6b-9d91-b8cf0193a655

Of course use a real key and render ID.

If you have tried all of the above and still get the error, reply here and will investigate further.

Here is the call to the API made with curl as per the sample provided and the API responds with {“message”:“Forbidden”}

Sorry about that, I am not even referencing the docs correctly. You need to do the following:

curl -X DELETE \
     -H "x-api-key: ptmpOiyKgGYMnnONwvXH7FHzDGOazrIjaEDUS7Cf" \
     https://api.shotstack.io/serve/v1/assets/d2b46ed6-998a-4d6b-9d91-b8cf0193a655

From the API docs:

curl -X DELETE https://api.shotstack.io/serve/{version}/assets/{id} \
  -H 'x-api-key: API_KEY'

Things to note:

  • The request method must be DELETE, not GET.
  • The URL just has /assets/{id}, not assets/render/{id}
  • Make sure you use your own key and correct stage/version (stage or v1)
  • You shouldn’t need a content-type.

Please try using the above and see if it works for you now.

Unfortunately this is not working.

As you can see from our previous message, we have been trying to retrieve ID’s of all the assets related to our render b701a9e5-40d0-47e3-9e8c-68f95df540a7:

However, we got the {“message”:“Forbidden”} response, and therefore we are unable to retrieve the asset id (or asset ids, if there are multiple) by the render id from ShotStack API.

You suggest that we send a DELETE HTTP request. Sure we tried that, but when we send a DELETE HTTP request we get another {“message”:“Forbidden”} response:

Again, we have the render id and it is b701a9e5-40d0-47e3-9e8c-68f95df540a7, but we do not have the asset id (or ids) and the API responds with {“message”:“Forbidden”} when we are trying to retrieve them

Any idea what the issue could be?

Kind Regards

I have sent you a PM and will reach out by email too.

Was this solved. I have been struggling with this for days and forum is not of much help and unable to reach support either.

For now this is still only possible via the API and can only be done 1 file at a time. Details here in the docs: Manage Hosted Assets withe the Serve API | Shotstack Documentation

If you want to delete all files in your account we can do that for you. Send us a message here with your API Key ids (not the keys) and we can do that for you: Talk to Sales | Shotstack