Help Center/ ModelArts/ API Reference/ Authorization Management/ Viewing an Authorization List
Updated on 2025-08-20 GMT+08:00

Viewing an Authorization List

Function

This API is used to view the authorization information.

This API applies to the following scenarios: When you need to know the current authorization status, review permission assignment, or manage permissions, you can use this API to view the authorization list. Before using this API, ensure that you have the permission to view authorization. After the query is complete, the authorization list is returned, including the authorized resources, authorization type, and authorization content. If you do not have the permission to view the authorization list or the authorization list does not exist, the API will return an error message.

Debugging

You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.

URI

GET /v2/{project_id}/authorizations

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition: Project ID. For details, see Obtaining a Project ID and Name.

Constraints: N/A

Range: N/A

Default Value: N/A

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

sort_by

No

String

Definition: Sorting field

Constraints: N/A

Range: Enums:

  • user_name: IAM user

  • create_time: creation time

Default Value: user_name

order

No

String

Definition: Sorting mode

Constraints: N/A

Range: Enums:

  • ASC: ascending order

  • DESC: descending order

Default Value: ASC

limit

No

Integer

Definition: Maximum number of records returned on each page

Constraints: N/A

Range: [1, 1000]

Default Value: 1000

offset

No

Integer

Definition: Start page for pagination display

Constraints: N/A

Range: Non-negative integers

Default Value: 0

Request Parameters

None

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

total_count

Number

Definition: Total number of authorizations.

Range: N/A

auth

Array of AuthorizationResponse objects

Definition: Authorization information list.

Table 4 AuthorizationResponse

Parameter

Type

Description

user_id

String

Definition: user ID. For details, see Obtaining a Username and ID. If user_id is set to all, all IAM users are authorized. If some IAM users have been authorized, the authorization setting will be updated. This parameter is mandatory only if the authorization method is set to Agency.

Constraints: N/A

Range: The value must contain 3 to 32 characters. Letters, digits, and hyphens (-) are allowed.

Default Value: N/A

type

String

Definition: Authorization type. Agency is recommended.

Constraints: N/A

Range:

  • AGENCY: agency

  • CREDENTIAL: access keys (AK/SK)

Default Value: N/A

content

String

Definition: Authorization content.

Constraints:

  • When the authorization type is agency, this field is the agency name.

  • When the authorization type is access key, this field is the access key ID (AK).

Range: 0 to 64

Default Value: N/A

secret_key

String

Definition: Secret access key (SK).

Constraints: This field is required only when the authorization type is access key.

Range: The value must contain 40 characters. Letters and digits are allowed.

Default Value: N/A

user_name

String

Definition: Username.

Constraints: If user_id is set to all-users, all users will be displayed.

Range: N/A

Default Value: N/A

user_type

String

Definition: User type.

Constraints: N/A

Range:

  • IAM: IAM user. The user_id field is mandatory.

  • FEDERATE: federated user. The user_name field is mandatory, and the user_id field is not needed.

  • GRANT: agency. The user_id field is mandatory, and its value is the agency ID.

  • ALL-USERS: all users. The user_id field is mandatory, and its value is all.

Default Value: IAM.

create_time

Long

Definition: Creation timestamp.

Range: N/A

Example Requests

View an authorization list.

GET https://{endpoint}/v2/{project_id}/authorizations

Example Responses

Status code: 200

OK

{
  "total_count" : 1,
  "auth" : [ {
    "user_id" : "****d80fb058844ae8b82aa66d9fe****",
    "user_name" : "iam-user01",
    "type" : "agency",
    "content" : "modelarts_agency",
    "create_time" : 15657747821288
  } ]
}

Status Codes

Status Code

Description

200

OK

400

Bad request

401

Unauthorized

403

Forbidden

404

Not found

Error Codes

See Error Codes.