Overview
The Supabase Storage API provides RESTful endpoints for managing files in your storage buckets. Upload, download, list, and delete files with simple HTTP requests.Base URL
Storage endpoints are available at:Buckets
List Buckets
Get all storage buckets.Response
string
Unique identifier for the bucket.
string
Bucket name.
boolean
Whether the bucket is publicly accessible.
Get Bucket
Get details of a specific bucket.Create Bucket
Create a new storage bucket.string
required
Unique name for the bucket.
boolean
default:"false"
Whether the bucket is publicly accessible.
integer
Maximum file size in bytes (default: 50MB).
array
List of allowed MIME types. If null, all types are allowed.
Update Bucket
Update bucket configuration.Delete Bucket
Delete an empty bucket.Empty Bucket
Delete all files in a bucket.Objects
Upload File
Upload a file to a storage bucket.string
required
The bucket name (in the URL path).
string
required
The file path within the bucket (in the URL path).
string
required
MIME type of the file.
string
Cache control header value (in seconds).
Response
Upload with Upsert
Overwrite existing files by adding thex-upsert header.
boolean
When true, overwrites existing file with the same path.
Download File
Download a file from storage.Download with Transformation
Transform images on-the-fly (resize, format conversion).integer
Width in pixels.
integer
Height in pixels.
string
Resize mode:
cover, contain, fill.string
Output format:
webp, jpeg, png, avif.integer
Quality (1-100) for lossy formats.
List Files
List all files in a folder.string
Folder path to list files from.
integer
default:"100"
Maximum number of files to return.
integer
default:"0"
Number of files to skip.
object
Sort options.
Response
Search Files
Search for files matching a pattern.string
Search term to match against file names.
Move File
Move or rename a file.string
required
The bucket containing the file.
string
required
Current path of the file.
string
required
New path for the file.
Copy File
Copy a file to a new location.Delete Files
Delete one or more files.array
required
Array of file paths to delete.
Public URLs
Get Public URL
For public buckets, files are accessible via a public URL.Signed URLs
Create temporary signed URLs for private files.integer
required
Time in seconds until the URL expires (max: 604800 = 7 days).
Response
Create Signed Upload URL
Generate a signed URL for uploading files.Storage Policies
Control access to storage buckets using policies.Example Policy (SQL)
Image Transformations
Supabase Storage supports on-the-fly image transformations:Resize
Format Conversion
Quality
Best Practices
Use appropriate bucket types
Use appropriate bucket types
- Use public buckets for assets that don’t need authentication
- Use private buckets with RLS for user-specific files
Implement file size limits
Implement file size limits
Set appropriate file size limits on your buckets:
Use image transformations
Use image transformations
Transform images on-the-fly to reduce bandwidth and improve performance.
Implement proper RLS policies
Implement proper RLS policies
Always use Row Level Security policies to control file access:
Use signed URLs for temporary access
Use signed URLs for temporary access
Generate short-lived signed URLs for secure temporary access to private files.
Next Steps
Edge Functions
Learn about serverless functions
Client Libraries
Use Storage with client SDKs
