Queries the identity of the current requester.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

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
IdentityType String RAMUser

The type of the identity. Valid values:

  • Account: an Alibaba Cloud account
  • RamUser: a RAM user
  • AssumedRoleUser: a RAM role
AccountId String 196813200012****

The ID of the Alibaba Cloud account to which the current requester belongs.

RequestId String 3C87BF47-3724-5443-ADC1-5AEAD9A03EB1

The ID of the request.

PrincipalId String 28877424437521****

The ID of the principal.

UserId String 216959339000****

The ID of the current requester.

  • If the requester uses an Alibaba Cloud account to call the operation, the ID of the Alibaba Cloud account is returned.
  • If the requester uses a RAM user to call the operation, the ID of the RAM user is returned.
    Note This parameter is returned only when the current requester uses an Alibaba Cloud account or a RAM user.
Arn String acs:ram::196813200012****:user/admin

The Alibaba Cloud Resource Name (ARN) of the current requester.

RoleId String 33537620082992****

The ID of the RAM role.

Note This parameter is returned only when the current requester uses a RAM role.

Examples

Sample requests

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

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<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

HTTP/1.1 200 OK
Content-Type:application/json

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

Error codes

For a list of error codes, visit the API Error Center.