Download file

All files uploaded via File Management module are accessible on the following url:

url = `$SPACE_CLOUD_ADDRESS/v1/api/$projectID/files/$path/$fileName`

The url is different for each file and has following variable parts to it:

  • $projectID - This is the project id with which you initialized the API
  • $path - This is the path at which the file was uploaded
  • $fileName - This is the name with which the file was uploaded (eg: profile.jpg)

A file can also be downloaded directly into a stream (or file), using the Java, Python and Golang clients. Here’s a code snippet to download a file:

api, err := api.New("books-app", "localhost:4124", false)
if(err != nil) {
filestore := api.Filestore()

file, err := os.Create("test1.txt")
if err != nil {
  fmt.Println("Error:", err)
defer file.Close()
err = filestore.DownloadFile("\\Folder\\text.txt", file)
if err != nil {
  fmt.Println("Error:", err)

API api = new API("books-app", "localhost", 4124);
FileStore fileStore = api.fileStore();
OutputStream outputStream = new FileOutputStream("output.txt";);
fileStore.downloadFile("\\file.txt", outputStream, new Utils.ResponseListener() {
    public void onResponse(int statusCode, Response response) {
        if (statusCode == 200) {
        } else {

    public void onError(Exception e) {
from space_api import API

# Initialize api with the project name and url of the space cloud
api = API("books-app", "localhost:4124")

# Initialize file storage module
file_store = api.file_store()

# Download the file ("\\a.txt" [remote]) into a file ("b.txt" [local])
response = file_store.download_file("\\a.txt", "b.txt")
if response.status == 200:

Have a technical question?

Improve the docs!