Microsoft Azure Docs

REST API Reference for Azure Blob Storage

This document provides a comprehensive reference for the Azure Blob Storage REST API. The Blob Storage service is an object storage solution for saving and retrieving massive amounts of unstructured data like text or binary data.

You can interact with the Blob Storage service by using the REST API directly, or by using one of the Azure Storage client libraries, which provide convenient wrappers for the REST API.

General Information

  • Base URL: https://{account-name}.blob.core.windows.net
  • Authentication: Shared Key or Azure Active Directory.
  • API Version: Always specify the API version in your requests. The current stable version is typically denoted as api-version=2020-08-04 or later.

Core Resources

The Azure Blob Storage service organizes data hierarchically: Storage Account > Container > Blob.

GET /{account-name}/?comp=list

List Containers

This operation lists all containers within a storage account.

Request Headers

Name Description Required
x-ms-version Specifies the version of the Blob service API to use for this request. Yes
Authorization Specifies the shared key or bearer token for authentication. Yes

Query Parameters

Name Type Description Required
comp String Must be set to list. Yes
prefix String Filters the results to return only containers whose names begin with the specified prefix. No
marker String A string value that identifies the position in the list of all containers to begin the listing. No
maxresults Integer Specifies the maximum number of containers to return. No

Responses

Status Code Description
200 OK Success. Returns a list of containers.
403 Forbidden Authentication or authorization failure.
404 Not Found Storage account not found.

Example Response (JSON)


{
  "Container": [
    {
      "Name": "mycontainer1",
      "Properties": {
        "LastModified": "2023-10-27T10:00:00Z",
        "Etag": "\"0x8D9A1B2C3D4E5F6\""
      }
    },
    {
      "Name": "anothercontainer",
      "Properties": {
        "LastModified": "2023-10-26T15:30:00Z",
        "Etag": "\"0x8D9A1B2C3D4E5F7\""
      }
    }
  ]
}
                    
PUT /{account-name}/{container-name}

Create Container

This operation creates a new container within a storage account.

Request Headers

Name Description Required
x-ms-version Specifies the version of the Blob service API to use for this request. Yes
x-ms-blob-public-access Specifies whether data in the container may be accessed publicly and the level of access. Values: blob, container, or off (default). No
Authorization Specifies the shared key or bearer token for authentication. Yes

Responses

Status Code Description
201 Created Success. The container was created.
403 Forbidden Authentication or authorization failure.
409 Conflict Container with the same name already exists.
PUT /{account-name}/{container-name}/{blob-name}

Put Blob

This operation creates a new block blob, or updates an existing block blob.

Request Headers

Name Description Required
x-ms-version Specifies the version of the Blob service API to use for this request. Yes
Content-Length The size of the blob in bytes. Yes
x-ms-blob-type Specifies the type of blob. Must be BlockBlob. Yes
Authorization Specifies the shared key or bearer token for authentication. Yes

Request Body

The content of the blob.

Responses

Status Code Description
201 Created Success. The blob was created or updated.
403 Forbidden Authentication or authorization failure.
404 Not Found Container or account not found.
GET /{account-name}/{container-name}/{blob-name}

Get Blob

This operation retrieves a blob.

Request Headers

Name Description Required
x-ms-version Specifies the version of the Blob service API to use for this request. Yes
Authorization Specifies the shared key or bearer token for authentication. Yes

Query Parameters

Name Type Description Required
snapshot String Specifies a snapshot time for the blob. No

Responses

Status Code Description
200 OK Success. Returns the blob content.
403 Forbidden Authentication or authorization failure.
404 Not Found Blob or container not found.

Example Response (Blob Content)

This is the content of my blob file.
DELETE /{account-name}/{container-name}/{blob-name}

Delete Blob

This operation deletes a blob.

Request Headers

Name Description Required
x-ms-version Specifies the version of the Blob service API to use for this request. Yes
x-ms-lease-id Specifies the lease ID for the blob, if the blob has an active lease. No
Authorization Specifies the shared key or bearer token for authentication. Yes

Query Parameters

Name Type Description Required
snapshot String Specifies a snapshot time for the blob to delete. No

Responses

Status Code Description
204 No Content Success. The blob was deleted.
403 Forbidden Authentication or authorization failure.
404 Not Found Blob or container not found.