Microsoft Docs

Azure Blob Storage REST API Reference

The Azure Blob Storage service offers a RESTful API that allows you to programmatically interact with your blob data. This API supports common HTTP operations for managing containers and blobs.

This documentation provides detailed information on the various REST operations, their request and response formats, parameters, and error codes. You can use this API directly or via one of the Azure SDKs.

Core Concepts

Common REST Operations

Operation HTTP Method Description Resource
List Containers GET Lists all containers in a storage account. /<storage-account-name>/<container-name>
Create Container PUT Creates a new container in a storage account. /<storage-account-name>/<container-name>
Delete Container DELETE Deletes a container and all its blobs. /<storage-account-name>/<container-name>
List Blobs GET Lists all blobs within a container. /<storage-account-name>/<container-name>?comp=list
Upload Blob PUT Uploads a block blob. /<storage-account-name>/<container-name>/<blob-name>
Download Blob GET Downloads a blob. /<storage-account-name>/<container-name>/<blob-name>
Delete Blob DELETE Deletes a blob. /<storage-account-name>/<container-name>/<blob-name>
Get Blob Properties HEAD Retrieves metadata and properties for a blob. /<storage-account-name>/<container-name>/<blob-name>

Authentication

All REST API requests to Azure Blob Storage must be authenticated. Common authentication methods include:

Refer to the Azure Storage authentication documentation for detailed guidance.

Request and Response Headers

Key request headers include:

Common response headers include:

Error Handling

Azure Blob Storage returns standard HTTP status codes. Specific error details are provided in the response body, often in an XML format, including an error code and a description.

Common status codes:

List Containers

Lists all containers in the specified storage account.

Method: GET

Resource URI:

https://<storage-account-name>.blob.core.windows.net/?comp=list

Query Parameters:

  • prefix: Filters results to containers whose names begin with the specified string.
  • include=metadata: Includes container metadata in the response.
  • maxresults: Specifies the maximum number of containers to return.
  • marker: A string value that identifies the position in the list of containers at which to begin the listing.

Create Container

Creates a new container within the specified storage account.

Method: PUT

Resource URI:

https://<storage-account-name>.blob.core.windows.net/<container-name>

Request Headers:

  • x-ms-blob-public-access: Specifies the public access level for the container (e.g., blob, container, or none).
  • x-ms-meta-<name>: User-defined metadata key-value pairs.

Delete Container

Deletes the specified container and all the blobs within it.

Method: DELETE

Resource URI:

https://<storage-account-name>.blob.core.windows.net/<container-name>

Query Parameters:

  • x-ms-lease-id: If the container has an active lease, you must specify the valid lease ID to delete the container.

List Blobs

Lists the blobs within the specified container.

Method: GET

Resource URI:

https://<storage-account-name>.blob.core.windows.net/<container-name>?comp=list

Query Parameters:

  • prefix: Filters results to blobs whose names begin with the specified string.
  • delimiter: Used to group blobs by logical folder.
  • include: Optional. Can be one or more of the following comma-separated values: copy, deleted, metadata, snapshots, uncommittedblobs.
  • maxresults: Specifies the maximum number of blobs to return.
  • marker: A string value that identifies the position in the list of blobs at which to begin the listing.

Upload Blob

Uploads a block blob to the specified container.

Method: PUT

Resource URI:

https://<storage-account-name>.blob.core.windows.net/<container-name>/<blob-name>

Request Headers:

  • x-ms-blob-type: Specifies the type of blob to upload (BlockBlob, AppendBlob, PageBlob).
  • Content-Type: The MIME type of the blob.
  • x-ms-blob-content-encoding, x-ms-blob-content-language, x-ms-blob-content-md5, x-ms-blob-content-type, x-ms-blob-cache-control: Blob system properties.
  • x-ms-meta-<name>: User-defined metadata.

Download Blob

Downloads a blob from the specified container.

Method: GET

Resource URI:

https://<storage-account-name>.blob.core.windows.net/<container-name>/<blob-name>

Query Parameters:

  • snapshot: Specifies a snapshot time for the blob.
  • format: For page blobs, specifies the format of the blob (page or block).

Request Headers:

  • x-ms-range: Specifies a byte range to download.
  • If-Match, If-None-Match, If-Modified-Since, If-Unmodified-Since: Conditional headers for the download.

Delete Blob

Deletes the specified blob.

Method: DELETE

Resource URI:

https://<storage-account-name>.blob.core.windows.net/<container-name>/<blob-name>

Query Parameters:

  • snapshot: Specifies a snapshot time for the blob to delete.
  • x-ms-lease-id: If the blob has an active lease, you must specify the valid lease ID.
  • x-ms-delete-snapshots: Specifies whether to delete blobs snapshots along with the blob. Allowed values: include or only.

Get Blob Properties

Retrieves system properties for the specified blob. This operation does not return the blob's content.

Method: HEAD

Resource URI:

https://<storage-account-name>.blob.core.windows.net/<container-name>/<blob-name>

Query Parameters:

  • snapshot: Specifies a snapshot time for the blob.

Further Reading