tencent cloud

Security Token Service

GetSessionToken

Baixar
Modo Foco
Tamanho da Fonte
Última atualização: 2026-11-03 20:19:42

1. API Description

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

Obtain the MFA temporary certificate.

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: GetSessionToken.
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.
SerialNumber Yes String MFA serial number, the identifier of the MFA device associated with the CAM user making the call. Format: qcs::CAM:uin/${ownerUin}::MFA/${mfaType}. mfaType supports softToken.
TokenCode Yes String mfa identity verification code.
DurationSeconds No Integer Validity period of the specified temporary certificate. Unit: second. Default value: 1800 seconds. The root account can set a validity period of up to 7200 seconds, and a sub-account can set a validity period of up to 129600 seconds.

3. Output Parameters

Parameter Name Type Description
Credentials Credentials Temporary access credentials.
ExpiredTime Integer The time when the certificate is invalid, return Unix timestamp, accurate to second
Expiration String Expiration time of the temporary access credential in UTC time in iso 8601 format
RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

4. Example

Example1 Obtain the MFA Temporary Certificate

Input Example

POST / HTTP/1.1
Host: sts.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: GetSessionToken
<Common request parameters>

{
    "SerialNumber": "qcs::cam:uin/10001::mfa/softToken",
    "TokenCode": "102342"
}

Output Example

{
    "Response": {
        "Credentials": {
            "Token": "da1e***",
            "TmpSecretId": "AKID***",
            "TmpSecretKey": "q95K***"
        },
        "ExpiredTime": 1744271441,
        "Expiration": "2025-04-10T07:50:41Z",
        "RequestId": "4rkgc443-9cd2-4f09-9e7a-7d4c43b2a74c"
    }
}

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
FailedOperation.CheckMFAError MFA validation failed
FailedOperation.MFATypeNotSupported MFA type not supported
FailedOperation.TempKeyNotAllowed This API does not support temporary key calls.
InternalError.DbError Database error.
InternalError.EncryptError Encryption failed.
InternalError.GetSeedTokenError Failed to obtain the token.
InternalError.PbSerializeError pb packaging failed.
InternalError.SystemError Internal system error, such as network error.
InternalError.UnknownError Unknown error.
InvalidParameter.AccountNotAvaliable The account does not exist or is unavailable.
InvalidParameter.OverTimeError The expiration time exceeds the threshold.
InvalidParameter.ParamError Invalid parameter.
UnauthorizedOperation Unauthorized operation.

Ajuda e Suporte

Esta página foi útil?

comentários