tencent cloud

安全凭证服务

产品简介
产品概述
产品优势
购买指南
快速入门
基于 SAML 2.0 联合身份
跨账号访问角色
API文档
History
Introduction
API Category
Making API Requests
STS APIs
Data Types
Error Codes

GetCallerIdentity

PDF
聚焦模式
字号
最后更新时间: 2025-10-30 21:56:17

1. API Description

Domain name for API request: sts.intl.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.intl.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.intl.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.intl.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.

帮助和支持

本页内容是否解决了您的问题?

填写满意度调查问卷,共创更好文档体验。

文档反馈