--- id: usage slug: /usage title: Usage toc_max_heading_level: 3 --- import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; API documentation for Supabase Storage ## Object {#object} Object end-points ### Delete an object {#delete-an-object} ``` DELETE /object/{bucketName}/{wildcard} ``` #### Path Parameters #### Header Parameters #### Responses Successful response ```json { "schema": { "description": "Successful response", "type": "object", "properties": { "message": { "type": "string", "example": "Successfully deleted" } } } } ``` Error response ```json { "schema": { "description": "Error response", "type": "object", "properties": { "statusCode": { "type": "string" }, "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "statusCode", "error", "message" ], "title": "errorSchema" } } ```
### Update the object at an existing key {#update-the-object-at-an-existing-key} ``` PUT /object/{bucketName}/{wildcard} ``` #### Path Parameters #### Header Parameters #### Responses Successful response ```json { "schema": { "description": "Successful response", "type": "object", "properties": { "Key": { "type": "string", "example": "projectref/avatars/folder/cat.png" } }, "required": [ "Key" ] } } ``` Error response ```json { "schema": { "description": "Error response", "type": "object", "properties": { "statusCode": { "type": "string" }, "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "statusCode", "error", "message" ], "title": "errorSchema" } } ```
### Upload a new object {#upload-a-new-object} ``` POST /object/{bucketName}/{wildcard} ``` #### Path Parameters #### Header Parameters #### Responses Successful response ```json { "schema": { "description": "Successful response", "type": "object", "properties": { "Key": { "type": "string", "example": "avatars/folder/cat.png" } }, "required": [ "Key" ] } } ``` Error response ```json { "schema": { "description": "Error response", "type": "object", "properties": { "statusCode": { "type": "string" }, "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "statusCode", "error", "message" ], "title": "errorSchema" } } ```
### Delete multiple objects {#delete-multiple-objects} ``` DELETE /object/{bucketName} ``` #### Path Parameters #### Header Parameters #### Body Parameters ```json { "schema": { "type": "object", "properties": { "prefixes": { "type": "array", "items": { "type": "string" }, "minItems": 1, "example": [ "folder/cat.png", "folder/morecats.png" ] } }, "required": [ "prefixes" ] } } ``` #### Responses Successful response ```json { "schema": { "description": "Successful response", "type": "array", "items": { "type": "object", "properties": { "name": { "type": "string" }, "bucket_id": { "type": "string" }, "owner": { "type": "string" }, "id": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "updated_at": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "created_at": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "last_accessed_at": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "metadata": { "anyOf": [ { "type": "object", "additionalProperties": true }, { "type": "null" } ] }, "buckets": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "owner": { "type": "string" }, "public": { "type": "boolean" }, "created_at": { "type": "string" }, "updated_at": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false, "example": { "id": "bucket2", "name": "bucket2", "owner": "4d56e902-f0a0-4662-8448-a4d9e643c142", "created_at": "2021-02-17T04:43:32.770206+00:00", "updated_at": "2021-02-17T04:43:32.770206+00:00" } } }, "required": [ "name" ], "additionalProperties": false, "title": "objectSchema", "example": { "name": "folder/cat.png", "bucket_id": "avatars", "owner": "317eadce-631a-4429-a0bb-f19a7a517b4a", "id": "eaa8bdb5-2e00-4767-b5a9-d2502efe2196", "updated_at": "2021-04-06T16:30:35.394674+00:00", "created_at": "2021-04-06T16:30:35.394674+00:00", "last_accessed_at": "2021-04-06T16:30:35.394674+00:00", "metadata": { "size": 1234 } } } } } ``` Error response ```json { "schema": { "description": "Error response", "type": "object", "properties": { "statusCode": { "type": "string" }, "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "statusCode", "error", "message" ], "title": "errorSchema" } } ```
### Retrieve an object {#retrieve-an-object} ``` GET /object/authenticated/{bucketName}/{wildcard} ``` #### Path Parameters #### Header Parameters #### Responses Error response ```json { "schema": { "description": "Error response", "type": "object", "properties": { "statusCode": { "type": "string" }, "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "statusCode", "error", "message" ], "title": "errorSchema" } } ```
### Generate a presigned url to retrieve an object {#generate-a-presigned-url-to-retrieve-an-object} ``` POST /object/sign/{bucketName}/{wildcard} ``` #### Path Parameters #### Header Parameters #### Body Parameters ```json { "schema": { "type": "object", "properties": { "expiresIn": { "type": "integer", "minimum": 1, "example": 60000 } }, "required": [ "expiresIn" ] } } ``` #### Responses Successful response ```json { "schema": { "description": "Successful response", "type": "object", "properties": { "signedURL": { "type": "string", "example": "/object/sign/avatars/folder/cat.png?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1cmwiOiJhdmF0YXJzL2ZvbGRlci9jYXQucG5nIiwiaWF0IjoxNjE3NzI2MjczLCJleHAiOjE2MTc3MjcyNzN9.s7Gt8ME80iREVxPhH01ZNv8oUn4XtaWsmiQ5csiUHn4" } }, "required": [ "signedURL" ] } } ``` Error response ```json { "schema": { "description": "Error response", "type": "object", "properties": { "statusCode": { "type": "string" }, "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "statusCode", "error", "message" ], "title": "errorSchema" } } ```
### Retrieve an object via a presigned URL {#retrieve-an-object-via-a-presigned-url} ``` GET /object/sign/{bucketName}/{wildcard} ``` #### Path Parameters #### Responses Error response ```json { "schema": { "description": "Error response", "type": "object", "properties": { "statusCode": { "type": "string" }, "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "statusCode", "error", "message" ], "title": "errorSchema" } } ```
### Generate presigned urls to retrieve objects {#generate-presigned-urls-to-retrieve-objects} ``` POST /object/sign/{bucketName} ``` #### Path Parameters #### Header Parameters #### Body Parameters ```json { "schema": { "type": "object", "properties": { "expiresIn": { "type": "integer", "minimum": 1, "example": 60000 }, "paths": { "type": "array", "items": { "type": "string" }, "minItems": 1, "example": [ "folder/cat.png", "folder/morecats.png" ] } }, "required": [ "expiresIn", "paths" ] } } ``` #### Responses Successful response ```json { "schema": { "description": "Successful response", "type": "array", "items": { "type": "object", "properties": { "error": { "error": [ "string", "null" ], "example": "Either the object does not exist or you do not have access to it" }, "path": { "type": "string", "example": "folder/cat.png" }, "signedURL": { "type": [ "string", "null" ], "example": "/object/sign/avatars/folder/cat.png?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1cmwiOiJhdmF0YXJzL2ZvbGRlci9jYXQucG5nIiwiaWF0IjoxNjE3NzI2MjczLCJleHAiOjE2MTc3MjcyNzN9.s7Gt8ME80iREVxPhH01ZNv8oUn4XtaWsmiQ5csiUHn4" } }, "required": [ "error", "path", "signedURL" ] } } } ``` Error response ```json { "schema": { "description": "Error response", "type": "object", "properties": { "statusCode": { "type": "string" }, "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "statusCode", "error", "message" ], "title": "errorSchema" } } ```
### Moves an object {#moves-an-object} ``` POST /object/move ``` #### Header Parameters #### Body Parameters ```json { "schema": { "type": "object", "properties": { "bucketId": { "type": "string", "example": "avatars" }, "sourceKey": { "type": "string", "example": "folder/cat.png" }, "destinationKey": { "type": "string", "example": "folder/newcat.png" } }, "required": [ "bucketId", "sourceKey", "destinationKey" ] } } ``` #### Responses Successful response ```json { "schema": { "description": "Successful response", "type": "object", "properties": { "message": { "type": "string", "example": "Successfully moved" } }, "required": [ "message" ] } } ``` Error response ```json { "schema": { "description": "Error response", "type": "object", "properties": { "statusCode": { "type": "string" }, "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "statusCode", "error", "message" ], "title": "errorSchema" } } ```
### Search for objects under a prefix {#search-for-objects-under-a-prefix} ``` POST /object/list/{bucketName} ``` #### Path Parameters #### Header Parameters #### Body Parameters ```json { "schema": { "type": "object", "properties": { "prefix": { "type": "string", "example": "folder/subfolder" }, "limit": { "type": "integer", "minimum": 1, "example": 10 }, "offset": { "type": "integer", "minimum": 0, "example": 0 }, "sortBy": { "type": "object", "properties": { "column": { "type": "string", "enum": [ "name", "updated_at", "created_at", "last_accessed_at" ] }, "order": { "type": "string", "enum": [ "asc", "desc" ] } }, "required": [ "column" ] }, "search": { "type": "string" } }, "required": [ "prefix" ] } } ``` #### Responses Successful response ```json { "schema": { "description": "Successful response", "type": "array", "items": { "type": "object", "properties": { "name": { "type": "string" }, "bucket_id": { "type": "string" }, "owner": { "type": "string" }, "id": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "updated_at": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "created_at": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "last_accessed_at": { "anyOf": [ { "type": "string" }, { "type": "null" } ] }, "metadata": { "anyOf": [ { "type": "object", "additionalProperties": true }, { "type": "null" } ] }, "buckets": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "owner": { "type": "string" }, "public": { "type": "boolean" }, "created_at": { "type": "string" }, "updated_at": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false, "example": { "id": "bucket2", "name": "bucket2", "owner": "4d56e902-f0a0-4662-8448-a4d9e643c142", "created_at": "2021-02-17T04:43:32.770206+00:00", "updated_at": "2021-02-17T04:43:32.770206+00:00" } } }, "required": [ "name" ], "additionalProperties": false, "example": { "name": "folder/cat.png", "bucket_id": "avatars", "owner": "317eadce-631a-4429-a0bb-f19a7a517b4a", "id": "eaa8bdb5-2e00-4767-b5a9-d2502efe2196", "updated_at": "2021-04-06T16:30:35.394674+00:00", "created_at": "2021-04-06T16:30:35.394674+00:00", "last_accessed_at": "2021-04-06T16:30:35.394674+00:00", "metadata": { "size": 1234 } } } } } ``` Error response ```json { "schema": { "description": "Error response", "type": "object", "properties": { "statusCode": { "type": "string" }, "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "statusCode", "error", "message" ], "title": "errorSchema" } } ```
### Copies an object {#copies-an-object} ``` POST /object/copy ``` #### Header Parameters #### Body Parameters ```json { "schema": { "type": "object", "properties": { "sourceKey": { "type": "string", "example": "folder/source.png" }, "bucketId": { "type": "string", "example": "avatars" }, "destinationKey": { "type": "string", "example": "folder/destination.png" } }, "required": [ "sourceKey", "bucketId", "destinationKey" ] } } ``` #### Responses Successful response ```json { "schema": { "description": "Successful response", "type": "object", "properties": { "Key": { "type": "string", "example": "folder/destination.png" } }, "required": [ "Key" ] } } ``` Error response ```json { "schema": { "description": "Error response", "type": "object", "properties": { "statusCode": { "type": "string" }, "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "statusCode", "error", "message" ], "title": "errorSchema" } } ```
### Retrieve an object from a public bucket {#retrieve-an-object-from-a-public-bucket} ``` GET /object/public/{bucketName}/{wildcard} ``` #### Path Parameters #### Responses Error response ```json { "schema": { "description": "Error response", "type": "object", "properties": { "statusCode": { "type": "string" }, "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "statusCode", "error", "message" ], "title": "errorSchema" } } ```
## Bucket {#bucket} Bucket end-points ### Create a bucket {#create-a-bucket} ``` POST /bucket/ ``` #### Header Parameters #### Body Parameters ```json { "schema": { "type": "object", "properties": { "name": { "type": "string", "example": "avatars" }, "id": { "type": "string", "example": "avatars" }, "public": { "type": "boolean", "example": false } }, "required": [ "name" ] } } ``` #### Responses Successful response ```json { "schema": { "description": "Successful response", "type": "object", "properties": { "name": { "type": "string", "example": "avatars" } }, "required": [ "name" ] } } ``` Error response ```json { "schema": { "description": "Error response", "type": "object", "properties": { "statusCode": { "type": "string" }, "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "statusCode", "error", "message" ], "title": "errorSchema" } } ```
### Gets all buckets {#gets-all-buckets} ``` GET /bucket/ ``` #### Header Parameters #### Responses Successful response ```json { "schema": { "description": "Successful response", "type": "array", "items": { "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "owner": { "type": "string" }, "public": { "type": "boolean" }, "created_at": { "type": "string" }, "updated_at": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false, "title": "bucketSchema", "example": { "id": "bucket2", "name": "bucket2", "owner": "4d56e902-f0a0-4662-8448-a4d9e643c142", "created_at": "2021-02-17T04:43:32.770206+00:00", "updated_at": "2021-02-17T04:43:32.770206+00:00" } }, "example": [ { "id": "bucket2", "name": "bucket2", "owner": "4d56e902-f0a0-4662-8448-a4d9e643c142", "created_at": "2021-02-17T04:43:32.770206+00:00", "updated_at": "2021-02-17T04:43:32.770206+00:00" } ] }, "example": [ { "id": "bucket2", "name": "bucket2", "owner": "4d56e902-f0a0-4662-8448-a4d9e643c142", "created_at": "2021-02-17T04:43:32.770206+00:00", "updated_at": "2021-02-17T04:43:32.770206+00:00" } ] } ``` Error response ```json { "schema": { "description": "Error response", "type": "object", "properties": { "statusCode": { "type": "string" }, "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "statusCode", "error", "message" ], "title": "errorSchema" } } ```
### Empty a bucket {#empty-a-bucket} ``` POST /bucket/{bucketId}/empty ``` #### Path Parameters #### Header Parameters #### Responses Successful response ```json { "schema": { "description": "Successful response", "type": "object", "properties": { "message": { "type": "string", "example": "Successfully emptied" } } } } ``` Error response ```json { "schema": { "description": "Error response", "type": "object", "properties": { "statusCode": { "type": "string" }, "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "statusCode", "error", "message" ], "title": "errorSchema" } } ```
### Get details of a bucket {#get-details-of-a-bucket} ``` GET /bucket/{bucketId} ``` #### Path Parameters #### Header Parameters #### Responses Successful response ```json { "schema": { "description": "Successful response", "type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, "owner": { "type": "string" }, "public": { "type": "boolean" }, "created_at": { "type": "string" }, "updated_at": { "type": "string" } }, "required": [ "id", "name" ], "additionalProperties": false, "example": { "id": "bucket2", "name": "bucket2", "owner": "4d56e902-f0a0-4662-8448-a4d9e643c142", "created_at": "2021-02-17T04:43:32.770206+00:00", "updated_at": "2021-02-17T04:43:32.770206+00:00" } }, "example": { "id": "bucket2", "name": "bucket2", "owner": "4d56e902-f0a0-4662-8448-a4d9e643c142", "created_at": "2021-02-17T04:43:32.770206+00:00", "updated_at": "2021-02-17T04:43:32.770206+00:00" } } ``` Error response ```json { "schema": { "description": "Error response", "type": "object", "properties": { "statusCode": { "type": "string" }, "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "statusCode", "error", "message" ], "title": "errorSchema" } } ```
### Update properties of a bucket {#update-properties-of-a-bucket} ``` PUT /bucket/{bucketId} ``` #### Header Parameters #### Body Parameters ```json { "schema": { "type": "object", "properties": { "public": { "type": "boolean", "example": false } } } } ``` #### Responses Successful response ```json { "schema": { "description": "Successful response", "type": "object", "properties": { "message": { "type": "string", "example": "Successfully updated" } }, "required": [ "message" ] } } ``` Error response ```json { "schema": { "description": "Error response", "type": "object", "properties": { "statusCode": { "type": "string" }, "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "statusCode", "error", "message" ], "title": "errorSchema" } } ```
### Delete a bucket {#delete-a-bucket} ``` DELETE /bucket/{bucketId} ``` #### Path Parameters #### Header Parameters #### Responses Successful response ```json { "schema": { "description": "Successful response", "type": "object", "properties": { "message": { "type": "string", "example": "Successfully deleted" } } } } ``` Error response ```json { "schema": { "description": "Error response", "type": "object", "properties": { "statusCode": { "type": "string" }, "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "statusCode", "error", "message" ], "title": "errorSchema" } } ```
## Deprecated {#deprecated} Deprecated end-points ### Get object {#get-object} ``` GET /object/{bucketName}/{wildcard} ``` #### Path Parameters #### Header Parameters #### Responses Default Response ```json { "schema": { "type": "object", "properties": { "statusCode": { "type": "string" }, "error": { "type": "string" }, "message": { "type": "string" } }, "required": [ "statusCode", "error", "message" ], "title": "errorSchema" } } ```