tencent cloud

Feedback

GetCallerIdentity

Last updated: 2022-08-16 10:31:44

1. API Description

Domain name for API request: sts.tencentcloudapi.com.

This API is used to get the identity information of the current caller.
The persistent keys of the root account and sub-account as well as the temporary credentials generated by AssumeRole and GetFederationToken can be used to get the identity information.

A maximum of 20 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: GetCallerIdentity.
Version Yes String Common Params. The value used for this API: 2018-08-13.
Region Yes String Common Params. For more information, please see the list of regions supported by the product.

3. Output Parameters

Parameter Name Type Description
Arn String ARN of the current caller.
AccountId String Root account UIN of the current caller.
UserId String User ID.
1. If the caller is a Tencent Cloud account, the UIN of the current account is returned.
2. If the caller is a role, roleId:roleSessionName is returned.
3. If the caller is a federated user, uin:federatedUserName is returned.
PrincipalId String Account UIN.
1. If the caller is a Tencent Cloud account, the UIN of the current account is returned.
2. If the caller is a role, the UIN of the account that applies for the role is returned.
Type String Identity type.
RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Example

Example1 Calling this API with the temporary credential generated by AssumeRole

Input Example

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

Output Example

{
  "Response": {
    "Type": "CAMRole",
    "AccountId": "1000262***",
    "UserId": "461168601842741***:roleSessionName",
    "PrincipalId": "1000261****",
    "Arn": "qcs::sts:1000262***:assumed-role/461168601842741***",
    "RequestId": "1c875b55-128b-4152-9e73-0984fd489ba2"
  }
}

Example2 Calling this API with the temporary credential generated by GetFederationToken

Input Example

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

Output Example

{
  "Response": {
    "Type": "CAMUser",
    "AccountId": "1000262***",
    "UserId": "1000261****:federatedUserName",
    "PrincipalId": "1000261****",
    "Arn": "qcs::sts:1000262***:federated-user/1000261****",
    "RequestId": "1c875b55-128b-4152-9e73-0984fd489ba2"
  }
}

Example3 Calling this API with the persistent key of the sub-account

Input Example

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

Output Example

{
  "Response": {
    "Type": "CAMUser",
    "AccountId": "1000262***",
    "UserId": "1000261***",
    "PrincipalId": "1000261****",
    "Arn": "qcs::cam:1000262***:uin/1000261***",
    "RequestId": "1c875b55-128b-4152-9e73-0984fd489ba2"
  }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
AuthFailure.AccessKeyIllegal Invalid key.
InternalError.GetSeedTokenError Failed to obtain the token.
InvalidParameter.AccessKeyNotSupport This type of key is not supported.
Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support