Docs

Storage API


Server integration with  

The Storage service allows you to manage your project files. Using the Storage service, you can upload, view, download, and query all your project files.

Files are managed using buckets. Storage buckets are similar to Collections we have in our Databases service. The difference is, buckets also provide more power to decide what kinds of files, what sizes you want to allow in that bucket, whether or not to encrypt the files, scan with antivirus and more.

Using Appwrite permissions architecture, you can assign read or write access to each bucket or file in your project for either a specific user, team, user role, or even grant it with public access (any). You can learn more about how Appwrite handles permissions and access control.

The preview endpoint allows you to generate preview images for your files. Using the preview endpoint, you can also manipulate the resulting image so that it will fit perfectly inside your app in terms of dimensions, file size, and style. The preview endpoint also allows you to change the resulting image file format for better compression or image quality for better delivery over the network.

Create bucket

POST/v1/storage/buckets

Create a new storage bucket.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "buckets.write" scope.

HTTP Request

Name Type Description
bucketId required string

Unique Id. Choose a custom ID or generate a random ID with ID.unique(). Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.

name required string

Bucket name

permissions optional array

An array of permission strings. By default, no user is granted with any permissions. Learn more about permissions.

fileSecurity optional boolean

Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. Learn more about permissions.

enabled optional boolean

Is bucket enabled?

maximumFileSize optional integer

Maximum file size allowed in bytes. Maximum allowed value is 30MB. For self-hosted setups you can change the max limit by changing the _APP_STORAGE_LIMIT environment variable. Learn more about storage environment variables

allowedFileExtensions optional array

Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.

compression optional string

Compression algorithm choosen for compression. Can be one of none, gzip, or zstd, For file size above 20MB compression is skipped even if it's enabled

encryption optional boolean

Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled

antivirus optional boolean

Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled

HTTP Response

Status Code Content Type Payload
201  Created application/json Bucket Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const storage = new sdk.Storage(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    const promise = storage.createBucket('[BUCKET_ID]', '[NAME]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let storage = new sdk.Storage(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = storage.createBucket('[BUCKET_ID]', '[NAME]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Storage;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $storage = new Storage($client);
    
    $result = $storage->createBucket('[BUCKET_ID]', '[NAME]');
  • from appwrite.client import Client
    from appwrite.services.storage import Storage
    
    client = Client()
    
    (client
      .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    storage = Storage(client)
    
    result = storage.create_bucket('[BUCKET_ID]', '[NAME]')
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    storage = Storage.new(client)
    
    response = storage.create_bucket(bucket_id: '[BUCKET_ID]', name: '[NAME]')
    
    puts response.inspect
  • using Appwrite;
    using Appwrite.Models;
    
    var client = new Client()
        .SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .SetProject("5df5acd0d48c2") // Your project ID
        .SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    var storage = new Storage(client);
    
    Bucket result = await storage.CreateBucket(
        bucketId: "[BUCKET_ID]",
        name: "[NAME]");
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Storage storage = Storage(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = storage.createBucket(
        bucketId: '[BUCKET_ID]',
        name: '[NAME]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Storage
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val storage = Storage(client)
    
    val response = storage.createBucket(
        bucketId = "[BUCKET_ID]",
        name = "[NAME]",
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Storage;
    
    Client client = new Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Storage storage = new Storage(client);
    
    storage.createBucket(
        "[BUCKET_ID]",
        "[NAME]",
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let storage = Storage(client)
    
    let bucket = try await storage.createBucket(
        bucketId: "[BUCKET_ID]",
        name: "[NAME]"
    )
    
    
  • mutation {
        storageCreateBucket(
            bucketId: "[BUCKET_ID]",
            name: "[NAME]"
        ) {
            _id
            _createdAt
            _updatedAt
            _permissions
            fileSecurity
            name
            enabled
            maximumFileSize
            allowedFileExtensions
            compression
            encryption
            antivirus
        }
    }
    
  • POST /v1/storage/buckets HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-Key: 919c2d18fb5d4...a2ae413da83346ad2
    
    {
      "bucketId": "[BUCKET_ID]",
      "name": "[NAME]",
      "permissions": ["read(\"any\")"],
      "fileSecurity": false,
      "enabled": false,
      "maximumFileSize": 1,
      "allowedFileExtensions": [],
      "compression": "none",
      "encryption": false,
      "antivirus": false
    }
    

List buckets

GET/v1/storage/buckets

Get a list of all the storage buckets. You can use the query params to filter your results.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "buckets.read" scope.

HTTP Request

Name Type Description
queries optional array

Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: enabled, name, fileSecurity, maximumFileSize, encryption, antivirus

search optional string

Search term to filter your list results. Max length: 256 chars.

HTTP Response

Status Code Content Type Payload
200  OK application/json Buckets List Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const storage = new sdk.Storage(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    const promise = storage.listBuckets();
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let storage = new sdk.Storage(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = storage.listBuckets();
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Storage;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $storage = new Storage($client);
    
    $result = $storage->listBuckets();
  • from appwrite.client import Client
    from appwrite.services.storage import Storage
    
    client = Client()
    
    (client
      .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    storage = Storage(client)
    
    result = storage.list_buckets()
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    storage = Storage.new(client)
    
    response = storage.list_buckets()
    
    puts response.inspect
  • using Appwrite;
    using Appwrite.Models;
    
    var client = new Client()
        .SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .SetProject("5df5acd0d48c2") // Your project ID
        .SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    var storage = new Storage(client);
    
    BucketList result = await storage.ListBuckets();
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Storage storage = Storage(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = storage.listBuckets(
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Storage
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val storage = Storage(client)
    
    val response = storage.listBuckets(
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Storage;
    
    Client client = new Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Storage storage = new Storage(client);
    
    storage.listBuckets(
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let storage = Storage(client)
    
    let bucketList = try await storage.listBuckets()
    
    
  • query {
        storageListBuckets {
            total
            buckets {
                _id
                _createdAt
                _updatedAt
                _permissions
                fileSecurity
                name
                enabled
                maximumFileSize
                allowedFileExtensions
                compression
                encryption
                antivirus
            }
        }
    }
    
  • GET /v1/storage/buckets HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-Key: 919c2d18fb5d4...a2ae413da83346ad2
    
    

Get Bucket

GET/v1/storage/buckets/{bucketId}

Get a storage bucket by its unique ID. This endpoint response returns a JSON object with the storage bucket metadata.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "buckets.read" scope.

HTTP Request

Name Type Description
bucketId required string

Bucket unique ID.

HTTP Response

Status Code Content Type Payload
200  OK application/json Bucket Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const storage = new sdk.Storage(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    const promise = storage.getBucket('[BUCKET_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let storage = new sdk.Storage(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = storage.getBucket('[BUCKET_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Storage;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $storage = new Storage($client);
    
    $result = $storage->getBucket('[BUCKET_ID]');
  • from appwrite.client import Client
    from appwrite.services.storage import Storage
    
    client = Client()
    
    (client
      .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    storage = Storage(client)
    
    result = storage.get_bucket('[BUCKET_ID]')
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    storage = Storage.new(client)
    
    response = storage.get_bucket(bucket_id: '[BUCKET_ID]')
    
    puts response.inspect
  • using Appwrite;
    using Appwrite.Models;
    
    var client = new Client()
        .SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .SetProject("5df5acd0d48c2") // Your project ID
        .SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    var storage = new Storage(client);
    
    Bucket result = await storage.GetBucket(
        bucketId: "[BUCKET_ID]");
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Storage storage = Storage(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = storage.getBucket(
        bucketId: '[BUCKET_ID]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Storage
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val storage = Storage(client)
    
    val response = storage.getBucket(
        bucketId = "[BUCKET_ID]"
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Storage;
    
    Client client = new Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Storage storage = new Storage(client);
    
    storage.getBucket(
        "[BUCKET_ID]"
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let storage = Storage(client)
    
    let bucket = try await storage.getBucket(
        bucketId: "[BUCKET_ID]"
    )
    
    
  • query {
        storageGetBucket(
            bucketId: "[BUCKET_ID]"
        ) {
            _id
            _createdAt
            _updatedAt
            _permissions
            fileSecurity
            name
            enabled
            maximumFileSize
            allowedFileExtensions
            compression
            encryption
            antivirus
        }
    }
    
  • GET /v1/storage/buckets/{bucketId} HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-Key: 919c2d18fb5d4...a2ae413da83346ad2
    
    

Update Bucket

PUT/v1/storage/buckets/{bucketId}

Update a storage bucket by its unique ID.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "buckets.write" scope.

HTTP Request

Name Type Description
bucketId required string

Bucket unique ID.

name required string

Bucket name

permissions optional array

An array of permission strings. By default, the current permissions are inherited. Learn more about permissions.

fileSecurity optional boolean

Enables configuring permissions for individual file. A user needs one of file or bucket level permissions to access a file. Learn more about permissions.

enabled optional boolean

Is bucket enabled?

maximumFileSize optional integer

Maximum file size allowed in bytes. Maximum allowed value is 30MB. For self hosted version you can change the limit by changing _APP_STORAGE_LIMIT environment variable. Learn more about storage environment variables

allowedFileExtensions optional array

Allowed file extensions. Maximum of 100 extensions are allowed, each 64 characters long.

compression optional string

Compression algorithm choosen for compression. Can be one of none, gzip, or zstd, For file size above 20MB compression is skipped even if it's enabled

encryption optional boolean

Is encryption enabled? For file size above 20MB encryption is skipped even if it's enabled

antivirus optional boolean

Is virus scanning enabled? For file size above 20MB AntiVirus scanning is skipped even if it's enabled

HTTP Response

Status Code Content Type Payload
200  OK application/json Bucket Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const storage = new sdk.Storage(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    const promise = storage.updateBucket('[BUCKET_ID]', '[NAME]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let storage = new sdk.Storage(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = storage.updateBucket('[BUCKET_ID]', '[NAME]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Storage;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $storage = new Storage($client);
    
    $result = $storage->updateBucket('[BUCKET_ID]', '[NAME]');
  • from appwrite.client import Client
    from appwrite.services.storage import Storage
    
    client = Client()
    
    (client
      .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    storage = Storage(client)
    
    result = storage.update_bucket('[BUCKET_ID]', '[NAME]')
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    storage = Storage.new(client)
    
    response = storage.update_bucket(bucket_id: '[BUCKET_ID]', name: '[NAME]')
    
    puts response.inspect
  • using Appwrite;
    using Appwrite.Models;
    
    var client = new Client()
        .SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .SetProject("5df5acd0d48c2") // Your project ID
        .SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    var storage = new Storage(client);
    
    Bucket result = await storage.UpdateBucket(
        bucketId: "[BUCKET_ID]",
        name: "[NAME]");
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Storage storage = Storage(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = storage.updateBucket(
        bucketId: '[BUCKET_ID]',
        name: '[NAME]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Storage
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val storage = Storage(client)
    
    val response = storage.updateBucket(
        bucketId = "[BUCKET_ID]",
        name = "[NAME]",
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Storage;
    
    Client client = new Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Storage storage = new Storage(client);
    
    storage.updateBucket(
        "[BUCKET_ID]",
        "[NAME]",
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let storage = Storage(client)
    
    let bucket = try await storage.updateBucket(
        bucketId: "[BUCKET_ID]",
        name: "[NAME]"
    )
    
    
  • mutation {
        storageUpdateBucket(
            bucketId: "[BUCKET_ID]",
            name: "[NAME]"
        ) {
            _id
            _createdAt
            _updatedAt
            _permissions
            fileSecurity
            name
            enabled
            maximumFileSize
            allowedFileExtensions
            compression
            encryption
            antivirus
        }
    }
    
  • PUT /v1/storage/buckets/{bucketId} HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-Key: 919c2d18fb5d4...a2ae413da83346ad2
    
    {
      "name": "[NAME]",
      "permissions": ["read(\"any\")"],
      "fileSecurity": false,
      "enabled": false,
      "maximumFileSize": 1,
      "allowedFileExtensions": [],
      "compression": "none",
      "encryption": false,
      "antivirus": false
    }
    

Delete Bucket

DELETE/v1/storage/buckets/{bucketId}

Delete a storage bucket by its unique ID.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is create with the "buckets.write" scope.

HTTP Request

Name Type Description
bucketId required string

Bucket unique ID.

HTTP Response

Status Code Content Type Payload
204  No Content - -
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const storage = new sdk.Storage(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    const promise = storage.deleteBucket('[BUCKET_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let storage = new sdk.Storage(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = storage.deleteBucket('[BUCKET_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Storage;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $storage = new Storage($client);
    
    $result = $storage->deleteBucket('[BUCKET_ID]');
  • from appwrite.client import Client
    from appwrite.services.storage import Storage
    
    client = Client()
    
    (client
      .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    storage = Storage(client)
    
    result = storage.delete_bucket('[BUCKET_ID]')
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    storage = Storage.new(client)
    
    response = storage.delete_bucket(bucket_id: '[BUCKET_ID]')
    
    puts response.inspect
  • using Appwrite;
    using Appwrite.Models;
    
    var client = new Client()
        .SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .SetProject("5df5acd0d48c2") // Your project ID
        .SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    var storage = new Storage(client);
    
    await storage.DeleteBucket(
        bucketId: "[BUCKET_ID]");
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Storage storage = Storage(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = storage.deleteBucket(
        bucketId: '[BUCKET_ID]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Storage
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val storage = Storage(client)
    
    val response = storage.deleteBucket(
        bucketId = "[BUCKET_ID]"
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Storage;
    
    Client client = new Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Storage storage = new Storage(client);
    
    storage.deleteBucket(
        "[BUCKET_ID]"
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let storage = Storage(client)
    
    let result = try await storage.deleteBucket(
        bucketId: "[BUCKET_ID]"
    )
    
    
  • mutation {
        storageDeleteBucket(
            bucketId: "[BUCKET_ID]"
        ) {
            status
        }
    }
    
  • DELETE /v1/storage/buckets/{bucketId} HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-Key: 919c2d18fb5d4...a2ae413da83346ad2
    
    

Create File

POST/v1/storage/buckets/{bucketId}/files

Create a new file. Before using this route, you should create a new bucket resource using either a server integration API or directly from your Appwrite console.

Larger files should be uploaded using multiple requests with the content-range header to send a partial request with a maximum supported chunk of 5MB. The content-range header values should always be in bytes.

When the first request is sent, the server will return the File object, and the subsequent part request must include the file's id in x-appwrite-id header to allow the server to know that the partial upload is for the existing file and not for a new one.

If you're creating a new file using one of the Appwrite SDKs, all the chunking logic will be managed by the SDK internally.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is created with the "files.write" scope. You can also authenticate using a valid JWT and perform actions on behalf of your user.

Rate Limits

This endpoint is limited to 60 requests in every 1 minutes per IP address, method and user account. We use rate limits to avoid service abuse by users and as a security practice. Learn more about rate limiting.

HTTP Request

Name Type Description
bucketId required string

Storage bucket unique ID. You can create a new storage bucket using the Storage service server integration.

fileId required string

File ID. Choose a custom ID or generate a random ID with ID.unique(). Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.

file required file

Binary file. Appwrite SDKs provide helpers to handle file input. Learn about file input.

permissions optional array

An array of permission strings. By default, only the current user is granted all permissions. Learn more about permissions.

HTTP Response

Status Code Content Type Payload
201  Created application/json File Object
Example Request
  • const sdk = require('node-appwrite');
    const fs = require('fs');
    
    // Init SDK
    const client = new sdk.Client();
    
    const storage = new sdk.Storage(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    const promise = storage.createFile('[BUCKET_ID]', '[FILE_ID]', InputFile.fromPath('/path/to/file.png', 'file.png'));
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let storage = new sdk.Storage(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = storage.createFile('[BUCKET_ID]', '[FILE_ID]', InputFile.fromPath('/path/to/file.png', 'file.png'));
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\InputFile;
    use Appwrite\Services\Storage;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $storage = new Storage($client);
    
    $result = $storage->createFile('[BUCKET_ID]', '[FILE_ID]', InputFile::withPath('file.png'));
  • from appwrite.client import Client
    from appwrite.input_file import InputFile
    from appwrite.services.storage import Storage
    
    client = Client()
    
    (client
      .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    storage = Storage(client)
    
    result = storage.create_file('[BUCKET_ID]', '[FILE_ID]', InputFile.from_path('file.png'))
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    storage = Storage.new(client)
    
    response = storage.create_file(bucket_id: '[BUCKET_ID]', file_id: '[FILE_ID]', file: InputFile.from_path('dir/file.png'))
    
    puts response.inspect
  • using Appwrite;
    using Appwrite.Models;
    
    var client = new Client()
        .SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .SetProject("5df5acd0d48c2") // Your project ID
        .SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    var storage = new Storage(client);
    
    File result = await storage.CreateFile(
        bucketId: "[BUCKET_ID]",
        fileId: "[FILE_ID]",
        file: new File("./path-to-files/image.jpg"));
  • import 'dart:io';
    import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Storage storage = Storage(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = storage.createFile(
        bucketId: '[BUCKET_ID]',
        fileId: '[FILE_ID]',
        file: InputFile(path: './path-to-files/image.jpg', filename: 'image.jpg'),
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.models.InputFile
    import io.appwrite.services.Storage
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val storage = Storage(client)
    
    val response = storage.createFile(
        bucketId = "[BUCKET_ID]",
        fileId = "[FILE_ID]",
        file = InputFile.fromPath("file.png"),
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.models.InputFile;
    import io.appwrite.services.Storage;
    
    Client client = new Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Storage storage = new Storage(client);
    
    storage.createFile(
        "[BUCKET_ID]",
        "[FILE_ID]",
        InputFile.fromPath("file.png"),
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let storage = Storage(client)
    
    let file = try await storage.createFile(
        bucketId: "[BUCKET_ID]",
        fileId: "[FILE_ID]",
        file: InputFile.fromPath("file.png")
    )
    
    
  • POST /v1/storage/buckets/{bucketId}/files HTTP/1.1
    Host: HOSTNAME
    Content-Type: multipart/form-data; boundary="cec8e8123c05ba25"
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-Key: 919c2d18fb5d4...a2ae413da83346ad2
    X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...
    Content-Length: *Length of your entity body in bytes*
    
    --cec8e8123c05ba25
    Content-Disposition: form-data; name="operations"
    
    { "query": "mutation { storageCreateFile(bucketId: $bucketId, fileId: $fileId, file: $file) { id }" }, "variables": { "bucketId": "[BUCKET_ID]", "fileId": "[FILE_ID]", "file": null } }
    
    --cec8e8123c05ba25
    Content-Disposition: form-data; name="map"
    
    { "0": ["variables.file"] }
    
    --cec8e8123c05ba25
    Content-Disposition: form-data; name="0"; filename="file.ext"
    
    File contents
    
    --cec8e8123c05ba25--
    
  • POST /v1/storage/buckets/{bucketId}/files HTTP/1.1
    Host: HOSTNAME
    Content-Type: multipart/form-data; boundary="cec8e8123c05ba25"
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-Key: 919c2d18fb5d4...a2ae413da83346ad2
    X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...
    Content-Length: *Length of your entity body in bytes*
    
    --cec8e8123c05ba25
    Content-Disposition: form-data; name="fileId"
    
    "[FILE_ID]"
    
    --cec8e8123c05ba25
    Content-Disposition: form-data; name="file"
    
    cf 94 84 24 8d c4 91 10 0f dc 54 26 6c 8e 4b bc 
    e8 ee 55 94 29 e7 94 89 19 26 28 01 26 29 3f 16...
    
    --cec8e8123c05ba25
    Content-Disposition: form-data; name="permissions[]"
    
    ["read(\"any\")"]
    
    --cec8e8123c05ba25--
    

List Files

GET/v1/storage/buckets/{bucketId}/files

Get a list of all the user files. You can use the query params to filter your results.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is created with the "files.read" scope. You can also authenticate using a valid JWT and perform actions on behalf of your user.

HTTP Request

Name Type Description
bucketId required string

Storage bucket unique ID. You can create a new storage bucket using the Storage service server integration.

queries optional array

Array of query strings generated using the Query class provided by the SDK. Learn more about queries. Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: name, signature, mimeType, sizeOriginal, chunksTotal, chunksUploaded

search optional string

Search term to filter your list results. Max length: 256 chars.

HTTP Response

Status Code Content Type Payload
200  OK application/json Files List Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const storage = new sdk.Storage(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    const promise = storage.listFiles('[BUCKET_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let storage = new sdk.Storage(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = storage.listFiles('[BUCKET_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Storage;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $storage = new Storage($client);
    
    $result = $storage->listFiles('[BUCKET_ID]');
  • from appwrite.client import Client
    from appwrite.services.storage import Storage
    
    client = Client()
    
    (client
      .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    storage = Storage(client)
    
    result = storage.list_files('[BUCKET_ID]')
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    storage = Storage.new(client)
    
    response = storage.list_files(bucket_id: '[BUCKET_ID]')
    
    puts response.inspect
  • using Appwrite;
    using Appwrite.Models;
    
    var client = new Client()
        .SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .SetProject("5df5acd0d48c2") // Your project ID
        .SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    var storage = new Storage(client);
    
    FileList result = await storage.ListFiles(
        bucketId: "[BUCKET_ID]");
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Storage storage = Storage(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = storage.listFiles(
        bucketId: '[BUCKET_ID]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Storage
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val storage = Storage(client)
    
    val response = storage.listFiles(
        bucketId = "[BUCKET_ID]",
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Storage;
    
    Client client = new Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Storage storage = new Storage(client);
    
    storage.listFiles(
        "[BUCKET_ID]",
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let storage = Storage(client)
    
    let fileList = try await storage.listFiles(
        bucketId: "[BUCKET_ID]"
    )
    
    
  • query {
        storageListFiles(
            bucketId: "[BUCKET_ID]"
        ) {
            total
            files {
                _id
                bucketId
                _createdAt
                _updatedAt
                _permissions
                name
                signature
                mimeType
                sizeOriginal
                chunksTotal
                chunksUploaded
            }
        }
    }
    
  • GET /v1/storage/buckets/{bucketId}/files HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-Key: 919c2d18fb5d4...a2ae413da83346ad2
    X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...
    
    

Get File

GET/v1/storage/buckets/{bucketId}/files/{fileId}

Get a file by its unique ID. This endpoint response returns a JSON object with the file metadata.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is created with the "files.read" scope. You can also authenticate using a valid JWT and perform actions on behalf of your user.

HTTP Request

Name Type Description
bucketId required string

Storage bucket unique ID. You can create a new storage bucket using the Storage service server integration.

fileId required string

File ID.

HTTP Response

Status Code Content Type Payload
200  OK application/json File Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const storage = new sdk.Storage(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    const promise = storage.getFile('[BUCKET_ID]', '[FILE_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let storage = new sdk.Storage(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = storage.getFile('[BUCKET_ID]', '[FILE_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Storage;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $storage = new Storage($client);
    
    $result = $storage->getFile('[BUCKET_ID]', '[FILE_ID]');
  • from appwrite.client import Client
    from appwrite.services.storage import Storage
    
    client = Client()
    
    (client
      .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    storage = Storage(client)
    
    result = storage.get_file('[BUCKET_ID]', '[FILE_ID]')
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    storage = Storage.new(client)
    
    response = storage.get_file(bucket_id: '[BUCKET_ID]', file_id: '[FILE_ID]')
    
    puts response.inspect
  • using Appwrite;
    using Appwrite.Models;
    
    var client = new Client()
        .SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .SetProject("5df5acd0d48c2") // Your project ID
        .SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    var storage = new Storage(client);
    
    File result = await storage.GetFile(
        bucketId: "[BUCKET_ID]",
        fileId: "[FILE_ID]");
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Storage storage = Storage(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = storage.getFile(
        bucketId: '[BUCKET_ID]',
        fileId: '[FILE_ID]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Storage
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val storage = Storage(client)
    
    val response = storage.getFile(
        bucketId = "[BUCKET_ID]",
        fileId = "[FILE_ID]"
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Storage;
    
    Client client = new Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Storage storage = new Storage(client);
    
    storage.getFile(
        "[BUCKET_ID]",
        "[FILE_ID]"
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let storage = Storage(client)
    
    let file = try await storage.getFile(
        bucketId: "[BUCKET_ID]",
        fileId: "[FILE_ID]"
    )
    
    
  • query {
        storageGetFile(
            bucketId: "[BUCKET_ID]",
            fileId: "[FILE_ID]"
        ) {
            _id
            bucketId
            _createdAt
            _updatedAt
            _permissions
            name
            signature
            mimeType
            sizeOriginal
            chunksTotal
            chunksUploaded
        }
    }
    
  • GET /v1/storage/buckets/{bucketId}/files/{fileId} HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-Key: 919c2d18fb5d4...a2ae413da83346ad2
    X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...
    
    

Get File Preview

GET/v1/storage/buckets/{bucketId}/files/{fileId}/preview

Get a file preview image. Currently, this method supports preview for image files (jpg, png, and gif), other supported formats, like pdf, docs, slides, and spreadsheets, will return the file icon image. You can also pass query string arguments for cutting and resizing your preview image. Preview is supported only for image files smaller than 10MB.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is created with the "files.read" scope. You can also authenticate using a valid JWT and perform actions on behalf of your user.

HTTP Request

Name Type Description
bucketId required string

Storage bucket unique ID. You can create a new storage bucket using the Storage service server integration.

fileId required string

File ID

width optional integer

Resize preview image width, Pass an integer between 0 to 4000.

height optional integer

Resize preview image height, Pass an integer between 0 to 4000.

gravity optional string

Image crop gravity. Can be one of center,top-left,top,top-right,left,right,bottom-left,bottom,bottom-right

quality optional integer

Preview image quality. Pass an integer between 0 to 100. Defaults to 100.

borderWidth optional integer

Preview image border in pixels. Pass an integer between 0 to 100. Defaults to 0.

borderColor optional string

Preview image border color. Use a valid HEX color, no # is needed for prefix.

borderRadius optional integer

Preview image border radius in pixels. Pass an integer between 0 to 4000.

opacity optional number

Preview image opacity. Only works with images having an alpha channel (like png). Pass a number between 0 to 1.

rotation optional integer

Preview image rotation in degrees. Pass an integer between -360 and 360.

background optional string

Preview image background color. Only works with transparent images (png). Use a valid HEX color, no # is needed for prefix.

output optional string

Output format type (jpeg, jpg, png, gif and webp).

HTTP Response

Status Code Content Type Payload
200  OK image/* -
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const storage = new sdk.Storage(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    const promise = storage.getFilePreview('[BUCKET_ID]', '[FILE_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let storage = new sdk.Storage(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = storage.getFilePreview('[BUCKET_ID]', '[FILE_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Storage;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $storage = new Storage($client);
    
    $result = $storage->getFilePreview('[BUCKET_ID]', '[FILE_ID]');
  • from appwrite.client import Client
    from appwrite.services.storage import Storage
    
    client = Client()
    
    (client
      .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    storage = Storage(client)
    
    result = storage.get_file_preview('[BUCKET_ID]', '[FILE_ID]')
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    storage = Storage.new(client)
    
    response = storage.get_file_preview(bucket_id: '[BUCKET_ID]', file_id: '[FILE_ID]')
    
    puts response.inspect
  • using Appwrite;
    using Appwrite.Models;
    
    var client = new Client()
        .SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .SetProject("5df5acd0d48c2") // Your project ID
        .SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    var storage = new Storage(client);
    
    byte[] result = await storage.GetFilePreview(
        bucketId: "[BUCKET_ID]",
        fileId: "[FILE_ID]");
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Storage storage = Storage(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = storage.getFilePreview(
        bucketId: '[BUCKET_ID]',
        fileId: '[FILE_ID]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Storage
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val storage = Storage(client)
    
    val result = storage.getFilePreview(
        bucketId = "[BUCKET_ID]",
        fileId = "[FILE_ID]",
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Storage;
    
    Client client = new Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Storage storage = new Storage(client);
    
    storage.getFilePreview(
        "[BUCKET_ID]",
        "[FILE_ID]",
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let storage = Storage(client)
    
    let byteBuffer = try await storage.getFilePreview(
        bucketId: "[BUCKET_ID]",
        fileId: "[FILE_ID]"
    )
    
    
  • query {
        storageGetFilePreview(
            bucketId: "[BUCKET_ID]",
            fileId: "[FILE_ID]"
        ) {
            status
        }
    }
    
  • GET /v1/storage/buckets/{bucketId}/files/{fileId}/preview HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-Key: 919c2d18fb5d4...a2ae413da83346ad2
    X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...
    
    

Get File for Download

GET/v1/storage/buckets/{bucketId}/files/{fileId}/download

Get a file content by its unique ID. The endpoint response return with a 'Content-Disposition: attachment' header that tells the browser to start downloading the file to user downloads directory.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is created with the "files.read" scope. You can also authenticate using a valid JWT and perform actions on behalf of your user.

HTTP Request

Name Type Description
bucketId required string

Storage bucket ID. You can create a new storage bucket using the Storage service server integration.

fileId required string

File ID.

HTTP Response

Status Code Content Type Payload
200  OK */* -
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const storage = new sdk.Storage(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    const promise = storage.getFileDownload('[BUCKET_ID]', '[FILE_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let storage = new sdk.Storage(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = storage.getFileDownload('[BUCKET_ID]', '[FILE_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Storage;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $storage = new Storage($client);
    
    $result = $storage->getFileDownload('[BUCKET_ID]', '[FILE_ID]');
  • from appwrite.client import Client
    from appwrite.services.storage import Storage
    
    client = Client()
    
    (client
      .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    storage = Storage(client)
    
    result = storage.get_file_download('[BUCKET_ID]', '[FILE_ID]')
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    storage = Storage.new(client)
    
    response = storage.get_file_download(bucket_id: '[BUCKET_ID]', file_id: '[FILE_ID]')
    
    puts response.inspect
  • using Appwrite;
    using Appwrite.Models;
    
    var client = new Client()
        .SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .SetProject("5df5acd0d48c2") // Your project ID
        .SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    var storage = new Storage(client);
    
    byte[] result = await storage.GetFileDownload(
        bucketId: "[BUCKET_ID]",
        fileId: "[FILE_ID]");
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Storage storage = Storage(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = storage.getFileDownload(
        bucketId: '[BUCKET_ID]',
        fileId: '[FILE_ID]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Storage
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val storage = Storage(client)
    
    val result = storage.getFileDownload(
        bucketId = "[BUCKET_ID]",
        fileId = "[FILE_ID]"
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Storage;
    
    Client client = new Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Storage storage = new Storage(client);
    
    storage.getFileDownload(
        "[BUCKET_ID]",
        "[FILE_ID]"
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let storage = Storage(client)
    
    let byteBuffer = try await storage.getFileDownload(
        bucketId: "[BUCKET_ID]",
        fileId: "[FILE_ID]"
    )
    
    
  • query {
        storageGetFileDownload(
            bucketId: "[BUCKET_ID]",
            fileId: "[FILE_ID]"
        ) {
            status
        }
    }
    
  • GET /v1/storage/buckets/{bucketId}/files/{fileId}/download HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-Key: 919c2d18fb5d4...a2ae413da83346ad2
    X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...
    
    

Get File for View

GET/v1/storage/buckets/{bucketId}/files/{fileId}/view

Get a file content by its unique ID. This endpoint is similar to the download method but returns with no 'Content-Disposition: attachment' header.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is created with the "files.read" scope. You can also authenticate using a valid JWT and perform actions on behalf of your user.

HTTP Request

Name Type Description
bucketId required string

Storage bucket unique ID. You can create a new storage bucket using the Storage service server integration.

fileId required string

File ID.

HTTP Response

Status Code Content Type Payload
200  OK */* -
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const storage = new sdk.Storage(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    const promise = storage.getFileView('[BUCKET_ID]', '[FILE_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let storage = new sdk.Storage(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = storage.getFileView('[BUCKET_ID]', '[FILE_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Storage;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $storage = new Storage($client);
    
    $result = $storage->getFileView('[BUCKET_ID]', '[FILE_ID]');
  • from appwrite.client import Client
    from appwrite.services.storage import Storage
    
    client = Client()
    
    (client
      .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    storage = Storage(client)
    
    result = storage.get_file_view('[BUCKET_ID]', '[FILE_ID]')
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    storage = Storage.new(client)
    
    response = storage.get_file_view(bucket_id: '[BUCKET_ID]', file_id: '[FILE_ID]')
    
    puts response.inspect
  • using Appwrite;
    using Appwrite.Models;
    
    var client = new Client()
        .SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .SetProject("5df5acd0d48c2") // Your project ID
        .SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    var storage = new Storage(client);
    
    byte[] result = await storage.GetFileView(
        bucketId: "[BUCKET_ID]",
        fileId: "[FILE_ID]");
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Storage storage = Storage(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = storage.getFileView(
        bucketId: '[BUCKET_ID]',
        fileId: '[FILE_ID]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Storage
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val storage = Storage(client)
    
    val result = storage.getFileView(
        bucketId = "[BUCKET_ID]",
        fileId = "[FILE_ID]"
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Storage;
    
    Client client = new Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Storage storage = new Storage(client);
    
    storage.getFileView(
        "[BUCKET_ID]",
        "[FILE_ID]"
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let storage = Storage(client)
    
    let byteBuffer = try await storage.getFileView(
        bucketId: "[BUCKET_ID]",
        fileId: "[FILE_ID]"
    )
    
    
  • query {
        storageGetFileView(
            bucketId: "[BUCKET_ID]",
            fileId: "[FILE_ID]"
        ) {
            status
        }
    }
    
  • GET /v1/storage/buckets/{bucketId}/files/{fileId}/view HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-Key: 919c2d18fb5d4...a2ae413da83346ad2
    X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...
    
    

Update File

PUT/v1/storage/buckets/{bucketId}/files/{fileId}

Update a file by its unique ID. Only users with write permissions have access to update this resource.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is created with the "files.write" scope. You can also authenticate using a valid JWT and perform actions on behalf of your user.

Rate Limits

This endpoint is limited to 60 requests in every 1 minutes per IP address, method and user account. We use rate limits to avoid service abuse by users and as a security practice. Learn more about rate limiting.

HTTP Request

Name Type Description
bucketId required string

Storage bucket unique ID. You can create a new storage bucket using the Storage service server integration.

fileId required string

File unique ID.

permissions optional array

An array of permission string. By default, the current permissions are inherited. Learn more about permissions.

HTTP Response

Status Code Content Type Payload
200  OK application/json File Object
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const storage = new sdk.Storage(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    const promise = storage.updateFile('[BUCKET_ID]', '[FILE_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let storage = new sdk.Storage(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = storage.updateFile('[BUCKET_ID]', '[FILE_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Storage;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $storage = new Storage($client);
    
    $result = $storage->updateFile('[BUCKET_ID]', '[FILE_ID]');
  • from appwrite.client import Client
    from appwrite.services.storage import Storage
    
    client = Client()
    
    (client
      .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    storage = Storage(client)
    
    result = storage.update_file('[BUCKET_ID]', '[FILE_ID]')
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    storage = Storage.new(client)
    
    response = storage.update_file(bucket_id: '[BUCKET_ID]', file_id: '[FILE_ID]')
    
    puts response.inspect
  • using Appwrite;
    using Appwrite.Models;
    
    var client = new Client()
        .SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .SetProject("5df5acd0d48c2") // Your project ID
        .SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    var storage = new Storage(client);
    
    File result = await storage.UpdateFile(
        bucketId: "[BUCKET_ID]",
        fileId: "[FILE_ID]");
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Storage storage = Storage(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = storage.updateFile(
        bucketId: '[BUCKET_ID]',
        fileId: '[FILE_ID]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Storage
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val storage = Storage(client)
    
    val response = storage.updateFile(
        bucketId = "[BUCKET_ID]",
        fileId = "[FILE_ID]",
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Storage;
    
    Client client = new Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Storage storage = new Storage(client);
    
    storage.updateFile(
        "[BUCKET_ID]",
        "[FILE_ID]",
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let storage = Storage(client)
    
    let file = try await storage.updateFile(
        bucketId: "[BUCKET_ID]",
        fileId: "[FILE_ID]"
    )
    
    
  • mutation {
        storageUpdateFile(
            bucketId: "[BUCKET_ID]",
            fileId: "[FILE_ID]"
        ) {
            _id
            bucketId
            _createdAt
            _updatedAt
            _permissions
            name
            signature
            mimeType
            sizeOriginal
            chunksTotal
            chunksUploaded
        }
    }
    
  • PUT /v1/storage/buckets/{bucketId}/files/{fileId} HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-Key: 919c2d18fb5d4...a2ae413da83346ad2
    X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...
    
    {
      "permissions": ["read(\"any\")"]
    }
    

Delete File

DELETE/v1/storage/buckets/{bucketId}/files/{fileId}

Delete a file by its unique ID. Only users with write permissions have access to delete this resource.

Authentication

To access this route, init your SDK with your project unique ID and an API Key. Make sure your API Key is created with the "files.write" scope. You can also authenticate using a valid JWT and perform actions on behalf of your user.

Rate Limits

This endpoint is limited to 60 requests in every 1 minutes per IP address, method and user account. We use rate limits to avoid service abuse by users and as a security practice. Learn more about rate limiting.

HTTP Request

Name Type Description
bucketId required string

Storage bucket unique ID. You can create a new storage bucket using the Storage service server integration.

fileId required string

File ID.

HTTP Response

Status Code Content Type Payload
204  No Content - -
Example Request
  • const sdk = require('node-appwrite');
    
    // Init SDK
    const client = new sdk.Client();
    
    const storage = new sdk.Storage(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    const promise = storage.deleteFile('[BUCKET_ID]', '[FILE_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • import * as sdk from "https://deno.land/x/appwrite/mod.ts";
    
    // Init SDK
    let client = new sdk.Client();
    
    let storage = new sdk.Storage(client);
    
    client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    
    let promise = storage.deleteFile('[BUCKET_ID]', '[FILE_ID]');
    
    promise.then(function (response) {
        console.log(response);
    }, function (error) {
        console.log(error);
    });
  • <?php
    
    use Appwrite\Client;
    use Appwrite\Services\Storage;
    
    $client = new Client();
    
    $client
        ->setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        ->setProject('5df5acd0d48c2') // Your project ID
        ->setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
    ;
    
    $storage = new Storage($client);
    
    $result = $storage->deleteFile('[BUCKET_ID]', '[FILE_ID]');
  • from appwrite.client import Client
    from appwrite.services.storage import Storage
    
    client = Client()
    
    (client
      .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
      .set_project('5df5acd0d48c2') # Your project ID
      .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    )
    
    storage = Storage(client)
    
    result = storage.delete_file('[BUCKET_ID]', '[FILE_ID]')
    
  • require 'Appwrite'
    
    include Appwrite
    
    client = Client.new
        .set_endpoint('https://cloud.appwrite.io/v1') # Your API Endpoint
        .set_project('5df5acd0d48c2') # Your project ID
        .set_key('919c2d18fb5d4...a2ae413da83346ad2') # Your secret API key
    
    storage = Storage.new(client)
    
    response = storage.delete_file(bucket_id: '[BUCKET_ID]', file_id: '[FILE_ID]')
    
    puts response.inspect
  • using Appwrite;
    using Appwrite.Models;
    
    var client = new Client()
        .SetEndPoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .SetProject("5df5acd0d48c2") // Your project ID
        .SetKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    var storage = new Storage(client);
    
    await storage.DeleteFile(
        bucketId: "[BUCKET_ID]",
        fileId: "[FILE_ID]");
  • import 'package:dart_appwrite/dart_appwrite.dart';
    
    void main() { // Init SDK
      Client client = Client();
      Storage storage = Storage(client);
    
      client
        .setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
        .setProject('5df5acd0d48c2') // Your project ID
        .setKey('919c2d18fb5d4...a2ae413da83346ad2') // Your secret API key
      ;
    
      Future result = storage.deleteFile(
        bucketId: '[BUCKET_ID]',
        fileId: '[FILE_ID]',
      );
    
      result
        .then((response) {
          print(response);
        }).catchError((error) {
          print(error.response);
      });
    }
  • import io.appwrite.Client
    import io.appwrite.services.Storage
    
    val client = Client(context)
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    val storage = Storage(client)
    
    val response = storage.deleteFile(
        bucketId = "[BUCKET_ID]",
        fileId = "[FILE_ID]"
    )
    
  • import io.appwrite.Client;
    import io.appwrite.coroutines.CoroutineCallback;
    import io.appwrite.services.Storage;
    
    Client client = new Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2"); // Your secret API key
    
    Storage storage = new Storage(client);
    
    storage.deleteFile(
        "[BUCKET_ID]",
        "[FILE_ID]"
        new CoroutineCallback<>((result, error) -> {
            if (error != null) {
                error.printStackTrace();
                return;
            }
    
            System.out.println(result);
        })
    );
    
  • import Appwrite
    
    let client = Client()
        .setEndpoint("https://cloud.appwrite.io/v1") // Your API Endpoint
        .setProject("5df5acd0d48c2") // Your project ID
        .setKey("919c2d18fb5d4...a2ae413da83346ad2") // Your secret API key
    
    let storage = Storage(client)
    
    let result = try await storage.deleteFile(
        bucketId: "[BUCKET_ID]",
        fileId: "[FILE_ID]"
    )
    
    
  • mutation {
        storageDeleteFile(
            bucketId: "[BUCKET_ID]",
            fileId: "[FILE_ID]"
        ) {
            status
        }
    }
    
  • DELETE /v1/storage/buckets/{bucketId}/files/{fileId} HTTP/1.1
    Host: HOSTNAME
    Content-Type: application/json
    X-Appwrite-Response-Format: 1.0.0
    X-Appwrite-Project: 5df5acd0d48c2
    X-Appwrite-Key: 919c2d18fb5d4...a2ae413da83346ad2
    X-Appwrite-JWT: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ...