Get the RequestId of an API request

Updated at:

Every Alibaba Cloud API request returns a unique RequestId. Use it in OpenAPI Troubleshoot to diagnose errors or in ActionTrail to audit requests.

Note

Applies only to APIs available on OpenAPI Portal.

Methods

Use any of the following methods to find the RequestId. If a request fails, enter the RequestId on the OpenAPI Troubleshoot page to diagnose the error. For permission errors, the response also includes AccessDeniedDetail, which contains the unauthorized action (AuthAction) and an encrypted diagnostic message (EncodedDiagnosticMessage).

Use browser developer tools in the console

Open browser developer tools (F12) while using the console. Filter network activity by api.json? to locate the API call. The RequestId appears in the response headers or payload.

For example, if a sub-user lacks the necessary permissions, a Forbidden.RAM error is triggered and the console displays an Access Denied dialog box. This dialog box contains fields such as Error code, Request ID, Action, and Identity principal type. In the network panel, filter for the api.json?action=ModifySecurityGroupAttribute request. You can find the corresponding requestId and error details in the accessDeniedDetail field of the JSON response. These details include fields such as AuthAction, AuthPrincipalType, NoPermissionType, and PolicyType.

Use the OpenAPI Portal

Make a test call in OpenAPI Explorer. The RequestId appears in the response.

The JSON response also contains the following fields:

  • HostId: The service host.

  • Code: The error code. For example, Forbidden.RAM indicates that the RAM user is not authorized to operate on the specified resource.

  • Message: The error message.

  • Recommend: A link with diagnostic information for troubleshooting.

  • AccessDeniedDetail: Details about the permission denial, including the policy type.

Use SDKs

The RequestId appears in the API response object. If an error occurs, catch the exception to access error details, including the RequestId.

    try {
        ModifySecurityGroupAttributeRequest modifySecurityGroupAttributeRequest = new ModifySecurityGroupAttributeRequest()
                .setRegionId("cn-chengdu")
                .setSecurityGroupId("sg-2xxx")
                .setDescription("only test");
        ModifySecurityGroupAttributeResponse response = client.modifySecurityGroupAttributeWithOptions(modifySecurityGroupAttributeRequest, runtimeOptions);
        System.out.println(new Gson().toJson(response));
    } catch (Exception e) {
        if (e instanceof TeaException) {
            TeaException teaException = (TeaException) e;
            System.err.println("Error Code: " + teaException.getCode());
            System.err.println("Error Message: " + teaException.getMessage());
            System.err.println("Error Data: " + teaException.getData());
            throw new RuntimeException("API call failed", teaException);
        }
    }
        } else {
            //
            System.err.println("Unexpected error occurred: " + e.getMessage());
            throw new RuntimeException("Unexpected error", e);
        }
    }
}
You can use the RequestId in the error output to troubleshoot the issue. text Error Code: Forbidden.RAM Error Message: code: 403, User not authorized to operate on the specified resource, or this API doesn't support RAM. request id: EB2D2E3C-DE2D-5ABD-8F40-7FA3E6D31AF4 Error Data: {RequestId=EB2D2E3C-DE2D-5ABD-8F40-7FA3E6D31AF4, HostId=ecs-cn-hangzhou.aliyuncs.com, Code=Forbidden.RAM, Message=User not authorized to operate on the specified resource, or this API doesn't support RAM., Recommend=https://api.aliyun.com/troubleshoot?q=Forbidden.RAM&product=Ecs&requestId=EB2D2E3C-DE2D-5ABD-8F40-7FA3E6D31AF4, AccessDeniedDetail={PolicyType=ResourceGroupLevelIdentityBasedPolicy, AuthPrincipalOwnerId=1xxx6, EncodedDiagnosticMessage=AQIBIAAAAH13IrZA790Zkpi90wMZV/djLrVZYZ095+ad/t9KTHUamUspajhw3fLk2bPC33jhm9N7YhLxJBLwB4TzYmXq/afb6N916JVS3yCOw+TECTGjZr4QglIZsFA+h+ReEbwG+LpVFh12zZJrS8kkCW+8VNSLM1cfBKkNon9hAUyA5WK3ONRSCPFoDPplynjQ3qsYUTdtXHgsAxIEOZa6xCr+e56B0wmhm3x3ZjcRznY1D8u0Yfwn0cPf1oLFC4F1A1B2UeJBxzhn2t7s8NTAYcNBZp03zLu8VuL6gkAwJyZSEabaXs1bhidwZDrTc/JkToX/0AhHh0b8j/qqTZ6K9KtcZ7PJT0bESMPjXxezm4fr0CvozoHb9zAcyZkoRg1XkJfV9bcxvoWPaRcOdbyQSHMbRV089VUY4h8Cb5L8IblQt8TKREwrJJijrF80HfFiAfYORLQWCptgA/LeTZJisebTTNNcwmhdOy23NhFFWORjL9t4uhygqRWZqgwLb7FZMenr9PiTP4xVYcYELs/fsHKAbnIcn+XAKjaucIxqFucbmMLi1fuaeYJa0YY7FyAuxyuiCRwFHMtCRj191R1R2FSin3OXfsPd0K1u30m1Zi10XTaOmn69mScRe/NYGw5WW+pC/y7itJyLztHZp+S2o9kTEH6e1kNSV4FwsSwf4/+SKWa}}

Use the Alibaba Cloud CLI

The RequestId appears in the standard output of CLI API calls.

shell@Alicloud:~$ aliyun ecs ModifySecurityGroupAttribute --region cn-chengdu --RegionId 'cn-chengdu' --SecurityGroupId 'sg-2xxx' xxx 'k' --De
scription 'test sg'
ERROR: SDK.ServerError
ErrorCode: Forbidden.RAM
Recommend: https://api.aliyun.com/troubleshoot?q=Forbidden.RAM&product=Ecs&requestId=9F1F4997-A1E7-5B35-A5B7-7D668F4F4A51
RequestId: 9F1F4997-A1E7-5B35-A5B7-7D668F4F4A51
Message: User not authorized to operate on the specified resource, or this API doesn't support RAM.
RespHeaders: map[Access-Control-Allow-Origin:[*] Access-Control-Expose-Headers:[*] Connection:[keep-alive] Content-Length:[1898] Content-Type:[applica
tion/json;charset=utf-8] Date:[Mon, 22 Sep 2025 06:09:05 GMT] Keep-Alive:[timeout=25] Vary:[Accept-Encoding] X-Acs-Request-Id:[9F1F4997-A1E7-5B35-A5B7
-7D668F4F4A51] X-Acs-Trace-Id:[06140130ef99e54579652c9ced2e0a79]]
AccessDeniedDetail: map[AuthAction:ecs:ModifySecurityGroupAttribute AuthPrincipalDisplayName:2xxx    4 AuthPrincipalOwnerId:14xxx      6
AuthPrincipalType:SubUser EncodedDiagnosticMessage:AQIBIAAAAHuT4vB154DXED4KADE6tXWFYoyd8scM82aU3wC8JzzunFbX8kwIN/xENJ1WATBDNUtY78L36rFULZW8rdyVWUFz
bCH7x5h2xWFfHyDPKCdt2ZHzedv7omxldyK4Km22h0MbxxlWXee5VCd3nbBSB53GWs/DQ8R20fUcTs7nBQ6qq/LC/0PMtqwPnuQFr1s92ZrwXX6LoooqJtq7V5BsIgnUItjqqc6x4m6xZLr9PHEVDnN
RfLOWKPNq+tUEDgsamChTuvV/JZqwxsszCt7KShc9igo0UNfdH3mhO6Fr9w9ohG0YNcpjyiUJeWvNkOmHrXPznbSFmCqNLDeOtGevBy8iMyha/gRG8G9HBHc6pRJBhI1i9qq4tSR6R2DkWZBG7MhPLGfey6
dbEyRlMhvrpT1HODx+3JMJY0gyQ6li9XtKuttioWKkXV4LVANK6sx0U5I1BJUOJCFaPstPOxBk8x8zUEdAQxkgpQ1M9zrw/HAZlaIzwp/r969SryaKEwSkUsVUbcMyr8Y23ertzD16I185p998eOSLM
Y4q1Lnc9d5zxuuRh12eHWZSGNczpAGRY7qpYAYuPnWQ0/Mi0HfBbb5+pf1obhd5hml5TShcDbhMhy2j/GtoBoh/9KPpv57rk7baub0C/FRRs/CeKUciG0KtBTO1oTx6YHiv/vTOuSbBzAzh+Njrg+HoPS
c1iE9jgymUB4YGr7QoMay0BBD8CkPIvj7j3xNLeNlKNKNlAnxGtB4KXlA2OZqxolWXlavWPmVDzYP80Ux8R+uPbBhG+oZhJblWQ62igP8bkBtt83ifGSPtVQq5D7/U4w1DHjBAKS3YOPsvGtJBUbNNs
jSZUALRBeLe+0SQIud/mTPXIMkP6DiPa6nIObsWi0c8Na3nTVsYcsWpMtsXiX4SXmmtVGo9Xh3ti/+v/Aou6X9FuG+J67D/sD73D1ifAoDx2yWdA5W1/7BqCtWr1l01lJs5W51gyNd36SCnwLQHfmht
NLiaZOv4U7VUB1G31mR0fMVVC29VQ6Yq/QjtSZI3HQwILWlrzSE+4ShbqdJrOT2ifDma4CJWmj274NsaxzCpTc/nlExiWhn1nHMJVQ7OtssRCsrEcxyaknzqMZBLWDdOWJ1j9JWJ+HtaKZXPjLU+03
GJ5JZ4o97YutOwBtPi4Q9A4b0v+nCahKPLbOHLtGSeJOVnxFk1PIQGK/h6a6dabJPF8XXwNww9hJsgcK2+huCjsB1NcDq7/uI= NoPermissionType:ImplicitDeny PolicyType:Resource
GroupLevelIdentityBasedPolicy]
shell@Alicloud:~$

Use Terraform

Terraform orchestrates multiple API calls, so a successful apply does not display a single RequestId. If an API call fails, the error output includes the RequestId.

Error: [ERROR] terraform-provider-alicloud/alicloud/resource_alicloud_security_group_rule.go:209:
SDK.ServerError
ErrorCode: Forbidden.RAM
Recommend: https://api.aliyun.com/troubleshoot?q=Forbidden.RAM&product=Ecs&requestId=F7A01BD7-5771-544D-A80F-CD290806BBFA
RequestId: F7A01BD7-5771-544D-A80F-CD290806BBFA
Message: User not authorized to operate on the specified resource, or this API doesn't support RAM.
RespHeaders: map[Access-Control-Allow-Origin:[*] Access-Control-Expose-Headers:[*] Connection:[keep-alive] Content-Type:[application/json;charset=utf-8] Date:[Mon, 22 Sep 2025 06:28:49 GMT] Keep-Alive:[timeout=25] Vary:[Accept-Encoding Accept-Encoding] X-Acs-Request-Id:[F7A01BD7-5771-544D-A80F-CD290806BBFA] X-Acs-Trace-Id:[56259f4ddd3121273aedd3539554b295]]
AccessDeniedDetail: map[AuthAction:ecs:DescribeSecurityGroupAttribute AuthPrincipalDisplayName:2                    ]44 AuthPrincipalOwnerId:1      1
6 AuthPrincipalType:SubUser EncodedDiagnosticMessage:AQIBIAAAAMAMz25m9UV+V73fYm+VwVpWAWalMx3dMLYLsDdvHje27uM8nS3Cfm+foIiXEIK+O0WPs41Aaw6QjwBXBjhN7c+N1A
g2FtPaTVWqa8gcqjDQUMO2nzu2orWnfdi12kFfrOZTOQQ1HU97svdvaB+dqur96J8MycNt5UBfp2Afq2H2loKzgNKftodLq6Bcpvxpax76L2MwQD2WpInUU/7i2DfrsI29NehSsDorBmnB+/z9Vjx
l19FZ2yUYQmj/Mbzdsn8aOxkeNwggYEJHnwEgNc9ZcklkEONxzthR/g/plHkRwCjWFjTpUm4i09ss/hMcQW4Z7OiubloCS93JtdP1A1IMTwSD7z5/hjWRHVa1Ud00hI73Sg+iZEb0gaf970xSQ
k+Bdzu7+RXMsP0LYd9VDjmShlTT5Mw65yGPeYKFLA/iweIaeMiBf4LoVorY+3RYZglqW2qEcHVdhb8tLDMMp0/7KRiLAOpKyYb4tCyVUaOC9E14Xda0UxJNBGVKJFCZwaHK9q2p0Yu6MrJkDB2g3kx
mt54nm9e5W1gnm/Ub4tqeOCrte6JOWkFNQyW8tscoxon/aeYBB1pxsf+Mj1Ah2gNQ2/7DjOeZvR8IgNIN9gj5asSy1XxyevVjcS+EJYdX8OWeuIq93kPItw/+u9CGIJVNcl1vMJaBIrJ1fqf+/z0QN
Z5Ivd5gr4VwUGk7bghwkzNCArirvMfsgGrSa7UHRtjooNdwteFAuxH92UPpiaqhx0/uf3n3Hn3AKLQWsnRZtBsapDv4KQP0Qe/r0WXWAgz2/4dBckU5LItHaOEjB8qFmfH8xoHh7infBnfe7injUafTkT
X1wfv1g+0PTTEmpb8xNAd7rY2LTZ/mzAxUOWKmst6KmgXyAMLBrkyw2q+FkmnTBnCf3P9G6l7yfj2jI/OSUULdIC1RkdVocxALi1IHXOEP8IA41L2nV+IWBh38OOzXXP2E7y7+sT9miDxiwrbatbrL
UGkTCMcNAtBD84Xg7QKuzi7Kxev9uuOq36DLOSObzbfMzurts2Kxivq3syaIVVxVaI1gSz2OhEiov3qC5MWOhAWqHdzJVVwJX3zeYwp54XH5IGBnjDi3Fqi1DcD7hw/Ga/5JsSUrLC8hcOu3ahdPvfq
66TTX+k07FgWKTyScGf1ybj2XZnTus9dwcWbKYK3muAxb5vQnYGoP6LLMj5biUZToDKd8yVsZDRguiSurCD/ONULjA511JdM3Z4= NoPermissionType:ImplicitDeny PolicyType:Resource
eGroupLevelIdentityBasedPolicy]

Other API clients

For other clients such as cURL or Postman, the RequestId is included in the response headers. If a Signature V3 API call fails, the RequestId appears in the error response.

The following Java sample code calls the ECS ModifySecurityGroupAttribute action by using Signature V3:

private static final String ALGORITHM = "ACS3-HMAC-SHA256";
public static void main(String[] args) {
    String httpMethod = "POST";
    String canonicalUri = "/";
    String host = "ecs.cn-chengdu.aliyuncs.com";
    String xAcsAction = "ModifySecurityGroupAttribute";
    String xAcsVersion = "2014-05-26";
    SignatureRequest signatureRequest = new SignatureRequest(httpMethod, canonicalUri, host, xAcsAction, xAcsVersion);
    signatureRequest.queryParam.put("SecurityGroupId", "sg-2vxxx");
    signatureRequest.queryParam.put("Description", "test sg");
    signatureRequest.queryParam.put("RegionId", "cn-chengdu");
}

The call returns a Forbidden.RAM error. You can use the RequestId E172420D-62F4-5B54-879B-6926F779ED38 to troubleshoot the issue. The following is the complete output:

authorization========>ACS3-HMAC-SHA256 Credential=LTAxxx                    ,SignedHeaders=host;x-acs-action;x-acs-content-sha256;x-acs-date;x-acs-signature-nonce;x-acs-version,Signature=fd3ba03422d195df95992f351cbe8bdc73de34cee61c6d94e1cf720406cfdbe4
V3 signature invoke result:
{"RequestId":"E172420D-62F4-5B54-879B-6926F779ED38","HostId":"ecs.cn-chengdu.aliyuncs.com","Code":"Forbidden.RAM","Message":"User not authorized to operate on the specified resource, or this API doesn't support RAM.","Recommend":"https://api.aliyun.com/troubleshoot?q=Forbidden.RAM&product=Ecs&requestId=E172420D-62F4-5B54-879B-6926F779ED38","AccessDeniedDetail":{"PolicyType":"ResourceGroupLevelIdentityBasedPolicy","AuthPrincipalOwnerId":"1xxx","EncodedDiagnosticMessage":"AQBIAAAAAQBSngosi X6fJmgifT84XorhK4BRg2Sou2s7OrXC9gig3UsY8fkC1px/q5sZZaE8SQv+FJtVx+ltT8dX11y2rIqnsfTIQtXqtCN3oFWFzs2TVg64/YnzemB0e/r4zyRuGT98DajQhDtfv2J/ua9WmgLpdv90n5OA4hctr/zabwYW1VokhLwLWfCvmYm6Q/A2/9hXf9EVSxqASL09qyAdafRBw6WTWOYh6o0+sJK6Cd17eXYJUEwKRtdXY8he0nXCO0SKzgghrhm/Qc58JqryqdgZ66RXqRKDK3oippMDc+4bQzkUEsOw1QPjmDGEsTWUC9eHtkRSgcMtVotMUzjViB30I2M5x5bRANHRHKCAzn0gA2vxMo9y+Dvyc8o6GdRo2x51kzZh/0Ij2Vio9KtbSUr2qpFyo4Fi+5Z/pLGPen9ucKAVBTKb5FS1znrbiuFsoK5izdz27SwRTjngwO/WmOdficf0OtRkVfEmrERkZX4k20WYeL0Ze62L+yD35c0y6Uof4pUb4+hMw870k3f3OZq4ffAT3eQW7G6qRxrKNzd9mBWUU/wESttsX2/FI//A1FP/FV40dvmvKJnUH/gNwxPTbiz5tzhMHM0LM0iq3V1xM9U/N/6ifZMfN11e8
+k3JZkg0ij9yraOgy3kR2RBNQbRewV7euGsWk8G3KCCKEhBgo6GkadmFf7tLA5vUkfBUnxaU0ZwWb3oy19KssITAtdwVbJ7VajFn9dN8zirz TfFYXx58jgu93tW0196EeKhG9epxtE6PdkTVtXLJQSQoNMYKbS4oMvtI9D/6IkoNABkfQ6jGT89EnPzsdYWpomamsSVLy3tkIU29AIMuc1bMTKAwtfrcyweIK0mcu6GUVqd+JANGe2OV7v3rMLvaQ2Oi6+5avOF7ddnLg82iNSwtyyriXPO0djRdSAEs6o0PUtSc/8tU0WHEsfLxZM4+6CNABN9O6GpPeo5/7m6ft75FS+XRgAqdPxJvAm9QO8mnIwCRymTqGO5Sdnx1hg6vOuDf1wvxDQ2T2HqU4RPB4mdyWTRLQrJhrBhVxN2UkhS3MFqvIczKx+t4gZQ7o7xYaWe365DaeI6I+5mdmvYRvaD+HXixY+wDbUHLJ9MEHBOprfmBD76K+9WgPELYDtjmt3dGV4jaXuLmTX0e+9/LUBBvIqu84MPUA+FZlR4fXsRXxbtA+c9WDFJ3MkOZcTORU9ZkokpksF6h2e1gHXrLNDA1pNQrkfvHdvVHwgc=","AuthPrincipalType":"SubUser","AuthPrincipalDisplayName":"2xxx4","NoPermissionType":"ImplicitDeny","AuthAction":"ecs:ModifySecurityGroupAttribute"}}

Diagnose errors with a RequestId

OpenAPI Troubleshoot

Enter a RequestId on the OpenAPI Troubleshoot page to view the call chain, basic information, authentication details, and request content. If the request failed, the page also provides a solution.

Note

If a request is denied due to insufficient RAM permissions, get the EncodedDiagnosticMessage from the error response and call the DecodeDiagnosticMessage operation to decode it.

For an insufficient RAM permission error, for example, the Solution tab displays the ErrorCode (such as Forbidden.RAM), ErrorMessage, and permission diagnosis results, including the caller's identity, the required action, and recommended system policies. The Log Information tab displays a visualization of the call chain from the caller IP, through the UserAgent and endpoint, to the destination cloud service, along with the HTTP status code.

ActionTrail

Call the LookupEvents operation with the RequestId to query event details. Set the LookupAttribute array as follows:

Parameter

Description

Key

Set to EventId.

Value

The RequestId value.

In Alibaba Cloud API Workbench, call the API and set the host to the target region, such as Southwest 1 (Chengdu). After a successful call (status code 200), the Events array in the returned JSON response body contains the event details. The AccessDeniedDetail field of responseElements contains diagnostic information, such as PolicyType, AuthPrincipalOwnerId, and EncodedDiagnosticMessage, that you can use to troubleshoot the cause of the permission denial.