createBucket()

Creates a new Storage bucket

1const { data, error } = await supabase
2  .storage
3  .createBucket('avatars', { public: false })

Parameters#

  • idrequired
    string

    A unique identifier for the bucket you are creating.

  • optionsrequired
    object

    No description provided.

      Properties
    • publicrequired
      boolean

      The visibility of the bucket. Public buckets don't require an authorization token to download objects, but still require a valid token for all other operations. By default, buckets are private.

Notes#

  • RLS policy permissions required:
    • buckets table permissions: insert
    • objects table permissions: none
  • Refer to the Storage guide on how access control works

Examples#

Create bucket#

1const { data, error } = await supabase
2  .storage
3  .createBucket('avatars', { public: false })