QueryToken

更新时间: 2026-06-03 19:06:40

Verifies whether a token is valid.

Scenarios

Call QueryToken from the application server to check whether a token is valid. Token-based authentication overview.

Limits

Each user is limited to 100 requests per second. To request a higher limit, submit a ticket.

Debugging

Run this operation in OpenAPI Explorer to skip manual signature calculation. OpenAPI Explorer also generates SDK code examples.

Request parameters

Name Type Required Example Description
Action String Yes QueryToken

Set to QueryToken.

InstanceId String Yes post-cn-0pp12gl****

The ApsaraMQ for MQTT instance ID. Must match the client's instance ID. Find it on the Instance Details page in the console.

RegionId String Yes mq-internet-access

The region where the ApsaraMQ for MQTT instance resides.

Token String Yes LzMT+XLFl5s/YWJ/MlDz4t/Lq5HC1iGU1P28HAMaxYxn8aQbALNtml7QZKl9L9kPe6LqUb95tEVo+zUqOogs9+jZwDUSzsd4X4qaD3n2TrBEuMOqKkk1Xdrvu9VBQQvIYbz7MJWZDYC3DlW7gLEr33Cuj54iIhagtBi3epStJitsssWs7otY9zhKOSZxhr49G3d0bh35mwyP18EMvDas8UlzeSozsSrujNUqZXOGK0PEBSd+rWMGDJlCt6GFmJgm2JFY7PJwf/7OOSmUYIYFs5o/PuPpoTMF+hcVXMs+0yDukIMTOzG9m3t8k36PVrghFmnK6pC3Rt3mibjW****ng==

The token to query.

Note Other parameters: Common parameters and Call an operation.

Returned data

Name Type Example Description
RequestId String 5C8AADD0-6A95-436D-AFA0-3405CCE36A24

The unique request ID.

TokenStatus Boolean true

Indicates whether the token is valid. Valid values:

  • true: The token is valid.
  • false: The token is invalid.

Examples

Sample request

http(s)://onsmqtt.cn-hangzhou.aliyuncs.com/?Action=QueryToken
&InstanceId=post-cn-0pp12gl****
&RegionId=mq-internet-access
&Token=LzMT+XLFl5s/YWJ/MlDz4t/Lq5HC1iGU1P28HAMaxYxn8aQbALNtml7QZKl9L9kPe6LqUb95tEVo+zUqOogs9+jZwDUSzsd4X4qaD3n2TrBEuMOqKkk1Xdrvu9VBQQvIYbz7MJWZDYC3DlW7gLEr33Cuj54iIhagtBi3epStJitsssWs7otY9zhKOSZxhr49G3d0bh35mwyP18EMvDas8UlzeSozsSrujNUqZXOGK0PEBSd+rWMGDJlCt6GFmJgm2JFY7PJwf/7OOSmUYIYFs5o/PuPpoTMF+hcVXMs+0yDukIMTOzG9m3t8k36PVrghFmnK6pC3Rt3mibjW****ng==
&<Common request parameters>

Sample success response

XML format

<QueryTokenResponse>
  <RequestId>5C8AADD0-6A95-436D-AFA0-3405CCE36A24</RequestId>
  <TokenStatus>true</TokenStatus>
</QueryTokenResponse>

JSON format

{
  "RequestId": "5C8AADD0-6A95-436D-AFA0-3405CCE36A24",
  "TokenStatus": true
}

Error codes

HttpCode Error code Error message Description
404 ApiNotSupport The specified API is not supported. The API is not supported. Check your request.
400 CheckAccountInfoFailed An error occurred while checking the account information by the STS token. Failed to parse the account information from the Security Token Service (STS) token.
400 InstancePermissionCheckFailed An error occurred while validating the permissions of the instance. Please verify the account that created the instance and its permissions settings. The instance permission verification failed. Confirm the ownership of the MQTT instance and the authorization policy.
500 InternalError An error occurred while processing your request. Try again later. An error occurred in the MQTT backend service. Try again.
400 ParameterCheckFailed An error occurred while validating the parameters. The parameters may be missing or invalid. Parameter verification failed. A parameter may be missing or invalid.
400 PermissionCheckFailed An error occurred while validating the resource permissions. Please check the account that created the instance, topic, and GroupId, and check their permission settings. The resource permission verification failed. Check the ownership and authorization policies of the instance, topic, and Group ID.
400 QueryTokenOverFlow You have queried tokens too many times. Please try again later. The frequency of token queries is too high. The system is throttling the requests. Try again later.
500 SystemOverFlow An error occurred while processing your request. Please try again. The system is throttling the requests. Try again.
400 InvalidParameter.%s An error occurred while validating the parameter. The parameter may be missing or invalid. Parameter verification failed. A parameter may be missing or invalid.

Find other error codes in the Error Center.

上一篇: ApplyToken 下一篇: RevokeToken