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

Posted October 17, 2017 2.6k views

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

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.

Submit an Answer
1 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!