Updated on 2026-07-22 GMT+08:00

Creating an Access Preview

Function

This API is used to create an access preview.

Authorization Information

Each account root user has all the permissions required to call all APIs, but IAM users must be assigned the following required identity policy-based permissions. For details about the required permissions, see Permissions Policies and Supported Actions.

Action

Access Level

Resource Type (*: required)

Condition Key

Alias

Dependencies

AccessAnalyzer:analyzer:createPreview

Write

analyzer *

g:ResourceTag/<tag-key>

-

-

URI

POST /v5/analyzers/{analyzer_id}/access-previews

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

analyzer_id

Yes

String

Definition:

Unique identifier of an analyzer.

You can call the ListAnalyzers API to obtain the analyzer ID. The response parameters of this API return an analyzer list. The id field of each analyzer object is the analyzer ID.

Range:

1 to 36 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed.

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

configurations

Yes

Configuration object

Definition:

Preview access settings.

Constraints:

N/A

Range:

N/A

Default Value:

N/A

resource_urn

Yes

String

Definition:

Unique identifier of a resource.

Constraints:

N/A

Range:

The value can contain up to 1,500 characters.

Default Value:

N/A

Table 3 Configuration

Parameter

Mandatory

Type

Description

iam_agency

No

IAMAgency object

Definition:

IAM trust agency.

Constraints:

N/A

Range:

N/A

Default Value:

N/A

obs_bucket

No

OBSBucket object

Definition:

OBS bucket.

Constraints:

N/A

Range:

N/A

Default Value:

N/A

kms_cmk

No

KMSCmk object

Definition:

KMS key.

Constraints:

N/A

Range:

N/A

Default Value:

N/A

Table 4 IAMAgency

Parameter

Mandatory

Type

Description

trust_policy

Yes

String

Definition:

JSON policy document.

Constraints:

N/A

Range:

The value contains 0 to 131,072 characters.

Default Value:

N/A

Table 5 OBSBucket

Parameter

Mandatory

Type

Description

bucket_acl

No

String

Definition:

String format of the bucket ACL XML file.

Constraints:

N/A

Range:

N/A

Default Value:

N/A

bucket_policy

No

String

Definition:

JSON policy document.

Constraints:

N/A

Range:

The value contains 0 to 131,072 characters.

Default Value:

N/A

Table 6 KMSCmk

Parameter

Mandatory

Type

Description

grants

Yes

String

Definition:

Used to authorize encryption keys.

Constraints:

N/A

Range:

N/A

Default Value:

N/A

Response Parameters

Status code: 201

Table 7 Response body parameters

Parameter

Type

Description

access_preview_id

String

Definition:

Unique identifier of an access preview.

Range:

1 to 36 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed.

Example Requests

Creating an access preview

POST https://{hostname}/v5/analyzers/{analyzer_id}/access-previews

{
  "resource_urn" : "iam::{domain_id}:agency:{agency_name}",
  "configurations" : {
    "iam_agency" : {
      "trust_policy" : "{\"Version\":\"5.0\",\"Statement\":[{\"Condition\":{\"StringMatch\":{\"g:PrincipalOrgId\":[\"org_id\"]}},\"Action\":[\"sts:agencies:assume\",\"sts::tagSession\",\"sts::setSourceIdentity\"],\"Effect\":\"Allow\",\"Principal\":{\"IAM\":[\"dd...\"]}}]}"
    }
  }
}

Example Responses

Status code: 201

Created

{
  "access_preview_id" : "{access_preview_id}"
}

Status Codes

Status Code

Description

201

Created

Error Codes

See Error Codes.