Is there any place I can find "detailed" API documentation of Spaces?

I tried to find the API to delete at a folder(i know it is more of a virtual folder) level. I couldn’t find it in documentation. But I managed to inspect the api requests of the Spaces dashboard and figure out folder level delete is supported and the api details. Is there any documentation available other than this

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Andrew SB
DigitalOcean Employee
DigitalOcean Employee badge
October 17, 2017
Accepted Answer

The API that the Spaces dashboard calls is an internal implementation detail. It’s how our Ember front end talks to our backend. Under the hood, it is still accessing the same S3-compatible API from the linked docs.

A “folder” is actually just a “key” with a zero sized “object.” Items inside the folder have the folder key as a prefix to their own key. For example, here is a listing of objects in a Space with a folder named foo containing a file named bar:

$ aws s3api --endpoint-url --profile do list-objects --bucket my-bucket
    "Contents": [
            "LastModified": "2017-10-17T17:50:50.840Z", 
            "ETag": "\"d41d8cd98f00b204e9800998ecf8427e\"", 
            "StorageClass": "STANDARD", 
            "Key": "foo/", 
            "Owner": {
                "DisplayName": "681451698", 
                "ID": "681451698"
            "Size": 0
            "LastModified": "2017-10-17T17:56:08.583Z", 
            "ETag": "\"8cf8463b34caa8ac871a52d5dd7ad1ef\"", 
            "StorageClass": "STANDARD", 
            "Key": "foo/bar", 
            "Owner": {
                "DisplayName": "681451698", 
                "ID": "681451698"
            "Size": 2

The API does not support recursively deleting files per se. On the backend, we list all objects with that prefix and then delete them. You can achieve this same result by including a prefix query parameter when calling the API to list the contents of a Space. Here’s a quick Python example:

import boto3

session = boto3.session.Session()
client = session.client('s3',

resp = client.list_objects(Bucket='my-bucket', Prefix='foo/')
objects_to_delete = []
for obj in resp['Contents']:
     objects_to_delete.append({'Key': obj['Key']})

response = client.delete_objects(Bucket='my-bucket',
                                     'Objects': objects_to_delete

print("Deleted: {0}".format(response['Deleted']))

Hope that helps!

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel