Queries the identity of the user who is making the API request.

Request parameters

Parameter Type Required Example Description
Action String Yes GetCallerIdentity The operation that you want to perform. Set the value to GetCallerIdentity.

Response parameters

Parameter Type Example Description
RequestId String 2C9BE469-4A35-44D5-9529-CAA280B11603 The ID of the request.
Arn String acs:ram::196813200012****:user/admin The Alibaba Cloud Resource Name (ARN) of the user who is calling the API operation.
AccountId String 196813200012**** The ID of the Alibaba Cloud account that is used to call the API operation, or the ID of the Alibaba Cloud account to which the RAM user who is calling the API operation belongs. The ID only consists of digits.
UserId String 216959339000****
  • The ID of the RAM user if a RAM user is calling the API operation.
  • The ID of the Alibaba Cloud account if an Alibaba Cloud account user is calling the API operation.
RoleId String 33537620082992**** The ID of the RAM role. This parameter is returned only if the user who is calling the API operation assumes a RAM role.
PrincipalId String 28877424437521**** The ID of the principal.
IdentityType String RAMUser The type of the identity.

Examples

Sample requests

https://sts.aliyuncs.com?Action=GetCallerIdentity
&<Common request parameters>        

Sample success responses

XML format

<GetCallerIdentityResponse>
    <RequestId>2C9BE469-4A35-44D5-9529-CAA280B11603</RequestId>
    <AccountId>196813200012****</AccountId>
    <UserId>216959339000****</UserId>
    <IdentityType>RAMUser</IdentityType>
    <PrincipalId>28877424437521****</PrincipalId>
    <Arn>acs:ram::196813200012****:user/admin</Arn>
</GetCallerIdentityResponse>

JSON format

{
    "RequestId": "2C9BE469-4A35-44D5-9529-CAA280B11603",
    "AccountId": "196813200012****",
    "UserId": "216959339000****",
    "IdentityType": "RAMUser",
    "PrincipalId": "28877424437521****",
    "Arn": "acs:ram::196813200012****:user/admin"
}

Error codes

None.