Set up your environment

Choose the project your files belong to, and set up the address and API key your requests use.

Choose a project

Buckets belong to a project. Open the project in the console and copy its ID from Settings.

export PROJECT_ID="your-project-id"

Create an API key

Every request to the API carries an API key as a bearer token. In the console, open API keys, select Create API key, and choose the Storage service. For the guides here, choose:

  • Storage buckets: Create, View, and Delete.
  • Storage files: Upload, View and download, and Delete.

Copy the key when it is shown, then keep it in your app’s secret settings. See API keys.

export STORAGE_API_KEY="dsk_…"

A missing, unknown, or expired key gets Authentication required. A key without the permission, or not allowed in the project, gets Forbidden.

The address

Send every request to https://storage-api.digitospace.com. Every path starts with /v1/projects/$PROJECT_ID, so the guides keep the project’s address in one variable:

export STORAGE_URL="https://storage-api.digitospace.com/v1/projects/$PROJECT_ID"

Check your set-up by listing the project’s buckets:

curl "$STORAGE_URL/buckets" \
  -H "Authorization: Bearer $STORAGE_API_KEY"

An empty list, "data": [], means everything works.

Last updated