Last updated: September 18, 2024

<span aria-hidden="true" id="export-files-to-digitalocean-spaces-with-ease"></span>

# Export files to DigitalOcean Spaces with ease

![Julian Gruber](/assets/images/teammates/avatar-julian-1.jpg?dpl=dpl_6nhQNS5wkVkPZWuKMzXcWrAHNJL5)

**Julian Gruber**

Back-end Developer · Munich, Germany · Show bio

[](https://github.com/juliangruber)

Today, we are introducing the new [/digitalocean/store](/docs/robots/digitalocean-store.md) Robot, which allows you to export your Assembly results to DigitalOcean's[Spaces Object Storage⁠](https://www.digitalocean.com/products/spaces/). This adds another option to the list of file exporting providers we already support, like[Amazon S3](/docs/robots/s3-store.md),[Rackspace Cloud Files](/docs/robots/cloudfiles-store.md) and[Dropbox](/docs/robots/dropbox-store.md). Check out the full list[in our docs](/docs/robots.md#file-exporting).

<span aria-hidden="true" id="the-digitaloceanstore-robot"></span>

## The /digitalocean/store Robot

You can use the [/digitalocean/store](/docs/robots/digitalocean-store.md) Robot to upload your files or Assembly results to[DigitalOcean Spaces⁠](https://www.digitalocean.com/products/spaces/) for long and short term storage. Your files can set to be publicly available or private to your account.

![/digitalocean/store Robot](/_next/static/immutable/media/opengraph-image.2ky_93zam5irb.png)

Built upon the open source [Ceph⁠](https://ceph.io/) storage system, Spaces support most of the features [Amazon S3⁠](https://aws.amazon.com/en/s3/) offers, which means that if you already use our[/s3/store](/docs/robots/s3-store.md) Robot, the API should look very familiar.

In this blog post, we're guiding you through the process of setting up a DigitalOcean Spaces account, transcoding your files and exporting the results to your Spaces account. If you just want to look at the Robot's API and play with it yourself,[check out its docs](/docs/robots/digitalocean-store.md) and the example Assembly Instructions below:

```json
{
  "steps": {
    "store": {
      "robot": "/digitalocean/store",
      "credentials": "spaces-store-demo",
      "space": "spaces-store-demo",
      "acl": "public-read"
    }
  }
}

```

<span aria-hidden="true" id="setting-up-digitalocean-spaces"></span>

## Setting up DigitalOcean Spaces

The first step is to create a DigitalOcean account, if you haven't already done so. Head over to[digitalocean.com⁠](https://www.digitalocean.com/) to get started.

Next, navigate to the **Spaces** tab to create a new Space, which we're going to call`spaces-store-demo`. Select the datacenter region closest to where you're going to fetch the data from. Here, we've selected `fra1` / Frankfurt.

![Creating a Space on DigitalOcean in Frankfurt, with 'Restrict File Listing' selected.](/_next/static/immutable/media/1-create-a-space.3lav0_12gnu8w.png)

Once created, we have an empty Spaces account to which we can start exporting files:

![The newly created space with no files being stored.](/_next/static/immutable/media/2-empty-space.0e2uug4kq04fx.png)

In order for our Robot to be able to talk to the[DigitalOcean Spaces API⁠](https://developers.digitalocean.com/documentation/spaces/), we also need to create a pair of Spaces access keys. You can do so in the **API** section of your DigitalOcean account. Best keep this tab open for now, as we're going to need the public and private secret keys in the following steps. Never share these credentials with anyone you don't want to have write access to your Space.

![The Applications and API page, with the API key at the bottom](/_next/static/immutable/media/3-space-access-keys.2sj6aa3wxptj_.png)

<span aria-hidden="true" id="creating-template-credentials"></span>

## Creating Template Credentials

We're done with DigitalOcean for now, so let's head over to[transloadit.com](/index.md) and create a free account! The Sandbox plan comes with 2 GB of transcoding volume and two priority job slots, so it's all you're going to need to get started with our Robots.

To allow better security and easier re-use, Transloadit offers you to create Template Credentials and store the secrets for you. Once logged in, navigate to your account and select**Template Credentials**. Choose the third party service `Digital Ocean Spaces` and enter your Space credentials as follows, replacing *space name*, *region*, *key id* and *secret access key* as required:

![The Transloadit Template Credentials page, where a new DigitalOcean Credential is being made.](/_next/static/immutable/media/4-create-template-credentials.24r2k1j0cp5e9.png)

Hit save and you're done! The Template Credentials name — `spaces-store-demo` in this case — is what we're going to use in the next step.

<span aria-hidden="true" id="detecting-faces"></span>

## Detecting faces

Let's get to finally submitting some files to a new Assembly! Our example is going to use the [/image/facedetect](/docs/robots/image-facedetect.md) and[/digitalocean/store](/docs/robots/digitalocean-store.md) Robots. Once we're done, you'll be able to upload image files in which all human faces are going to be detected and separately uploaded to your DigitalOcean Space.

For the purpose of this guide, we're using the [curl(1)⁠](https://curl.haxx.se/) command line tool to interact with the Transloadit API, which is most likely already installed on your computer. If you are on Windows, check out the official[curl for Windows instructions⁠](https://curl.haxx.se/windows/).

First, another preparatory step: head over to the [API settings](/c/settings/) in your Transloadit account and please copy the **Auth Key**.

![Copying the Auth key from the Transloadit Credentials page](/_next/static/immutable/media/5-copy-auth-key.3jhyc5p034erg.png)

(Don't worry, we regenerated our Secret after taking this screenshot 😄)

Then, create a file with these Assembly Instructions, which we're going to call`params.json`. Replace the `auth.key` with your personal **Auth Key**.

```json
{
  "auth": {
    "key": "3ba3ac15473f4ce89a279db977248d29"
  },
  "steps": {
    "face-detect": {
      "use": ":original",
      "robot": "/image/facedetect",
      "crop": true,
      "faces": "each"
    },
    "store": {
      "use": "face-detect",
      "robot": "/digitalocean/store",
      "credentials": "spaces-store-demo",
      "space": "spaces-store-demo",
      "acl": "public-read"
    }
  }
}

```

The Assembly consists of two Steps:

1. Detect faces and extract each detected face as a cropped image
2. Upload the extracted faces to your DigitalOcean Space, using `public-read` permissions, so the files are publicly accessible

<span aria-hidden="true" id="testing-the-assembly"></span>

## Testing the Assembly

Now there is just one piece missing, and that's to kick off the whole machinery using a single command!

You're going to need an image with some faces on it to test your Assembly. Here's one you can grab if you don't have one readily available:

![A stock photo of two people looking towards the camera in a wooded area.](/_next/static/immutable/media/group.3g_iinz7q3sqz.jpg)

Issue the following `curl(1)` command in your terminal, in the same folder where `params.json` and the source image (here `group.jpg`) are stored. Pipe to[json\_pp(1)⁠](https://metacpan.org/pod/distribution/JSON-PP/bin/json%5Fpp) in order to get a nicely formatted JSON output.

```bash
curl \
  -s \
  -XPOST \
  -F params="$(< params.json)" \
  -F original=@group.jpg \
  https://api2.transloadit.com/assemblies \
  | json_pp

```

> If you're curious why the `curl(1)` command looks as it does:
>
> * `-s` instructs `curl(1)` to be quiet, so we only see the HTTP response body

* `-XPOST` in order to make this a POST request
* `-F ...` Transloadit uses[HTTP multipart formposts⁠](https://everything.curl.dev/http/post/multipart), so that the client can submit both the Assembly Instructions and the files, all in one request (and so that our API can be integrated with plain old `<form>`s). Here we use `-F` to submit both`params.json` and `group.jpg`.

Head over to your Transloadit account's [Assemblies](/c/assemblies/) page and click on the topmost row to see the results!

![The Assembly Results page](/_next/static/immutable/media/6-assembly-details.08c41uetz1o1_.png)

As you can see, in our case two faces were detected. Click on the **OPEN** buttons to the side of each result to see the cropped faces, served from your newly created DigitalOcean Space!

![A cropped version of the earlier stock photo focused on the face on the right](/_next/static/immutable/media/face-1.26z7mw6vc68dc.jpg)

![A cropped version of the earlier stock photo focused on the face on the left](/_next/static/immutable/media/face-2.11b3ye_ld3mzo.jpg)

<span aria-hidden="true" id="fin"></span>

## Fin

That's it! We hope you liked this blog post and are looking forward to the next one. And if you'd like to try this, [sign up for a free Transloadit](/c/signup/) account today!

[#file-exporting-service](/blog/tags/file-exporting-service.md)[#digitalocean-store-robot](/blog/tags/digitalocean-store-robot.md)[#digitalocean](/blog/tags/digitalocean.md)[#walkthrough](/blog/tags/walkthrough.md)[#spaces](/blog/tags/spaces.md)[#image-facedetect-robot](/blog/tags/image-facedetect-robot.md)[#s3-store-robot](/blog/tags/s3-store-robot.md)

### 👩‍💻 Join 20k+ developers

Sign up for our [monthly newsletter](/newsletters.md) to receive direct links to 3 exclusive tech — and 2 product updates. No less, no more.

Your email:

Get access

## File uploading and encoding. Made simple.

Transloadit streamlines file handling for developers, trusted by brands like Coursera and The New York Times. We’re known for a reliable API, top-notch support, and a strong commitment to open source, with projects like [Uppy⁠](https://uppy.io) and [Tus⁠](https://tus.io) setting standards in file processing.

[Sign up](/c/)[Book a Demo](https://survey.typeform.com/to/kRg47Xi5)

No credit card needed · 5 GB included in the free plan

Cancel anytime
