All Products
Search
Document Center

Object Storage Service:GetBucketPolicy

Last Updated:Jun 03, 2026

GetBucketPolicy retrieves the access policy of a bucket or vector bucket.

Request syntax

GET /?policy
Host: Host
Date: GMT Date
Authorization: SignatureValue

Request headers

DescribeRegions uses only common request headers. For more information, see Common request headers.

Response headers

The response contains only common response headers. For more information, see Common response headers.

Examples

Bucket example

  • Request example

    GET /?policy
    Host: oss-example.oss-cn-hangzhou.aliyuncs.com
    Date: Thu, 17 Apr 2025 09:09:13 GMT
    Authorization: OSS4-HMAC-SHA256 Credential=LTAI********************/20250417/cn-hangzhou/oss/aliyun_v4_request,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c218e
  • Response example

    HTTP/1.1 200 OK
    server: AliyunOSS
    x-oss-server-time: 24
    connection: keep-alive
    x-oss-request-id: 5C6E9847BE0EBCD13DA90C11
    date: Thu, 21 Feb 2019 12:23:35 GMT
    content-type: application/json
    {
      "Version":"1",
      "Statement":[
        {
          "Action":[
            "oss:PutObject",
            "oss:GetObject"
          ],
          "Effect":"Deny",
          "Principal":["1234567890"],
          "Resource":["acs:oss:*:1234567890:*/*"]
        }
      ]
    }

Vector bucket example

For vector buckets, the Host header must use a standard Alibaba Cloud region ID such as cn-hangzhou. Legacy OSS region IDs such as oss-cn-hangzhou are not supported.
  • Request example

    GET /?policy
    Host: exampebucket-123***456.cn-hangzhou-internal.oss-vectors.aliyuncs.com
    Date: Thu, 17 Apr 2025 09:09:13 GMT
    Authorization: OSS4-HMAC-SHA256 Credential=LTAI********************/20250417/cn-hangzhou/oss/aliyun_v4_request,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c218e
  • Response example

    HTTP/1.1 200 OK
    server: AliyunOSS
    x-oss-server-time: 24
    connection: keep-alive
    x-oss-request-id: 5C6E9847BE0EBCD13DA90C11
    date: Thu, 21 Feb 2019 12:23:35 GMT
    content-type: application/json
    {
       "Version":"1",
       "Statement":[
       {
         "Action":[
           "oss:PutVectors",
           "oss:GetVectors"
        ],
        "Effect":"Deny",
        "Principal":["1234567890"],
        "Resource":["acs:ossvector:cn-hangzhou:1234567890:bucket/vector-example/*"]
       }
      ]
    }

SDK

Supported SDKs:

ossutil command-line tool

The corresponding ossutil command is get-bucket-policy.

Error codes

Error code

HTTP status code

Description

NoSuchBucketPolicy

404

The bucket does not have an access policy configured.