# DescribeNatGateways

## 1. API Description

This API (DescribeNatGateways) is used to query the NAT gateway list.

## 2. Input Parameters

The following request parameter list only provides API request parameters.

| Parameter Name  | Required | Type                                                                                      | Description                                                                                              |
| --------------- | -------- | ----------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| regionId        | No       | String                                                                                    | Region ID.                                                                                               |
| vpcId           | No       | String                                                                                    | Filter by VPC network ID to which the NAT gateway belongs.                                               |
| natGatewayIds   | No       | Array of String                                                                           | <p>NAT gateway ID list.</p><p>The maximum number of instance IDs is 100 .</p>                            |
| name            | No       | String                                                                                    | NAT gateway name.                                                                                        |
| status          | No       | String                                                                                    | NAT gateway state.                                                                                       |
| securityGroupId | No       | String                                                                                    | Filter by the security group ID to which the NAT gateway belongs.                                        |
| pageSize        | No       | Integer                                                                                   | <p>Number of items in the current page result.</p><p>Default value: 20 ;</p><p>Maximum value: 1000 .</p> |
| pageNum         | No       | Integer                                                                                   | <p>Page number of the current page result.</p><p>Default value: 1 .</p><p>Default value: 1</p>           |
| resourceGroupId | No       | String                                                                                    | Resource Group ID.                                                                                       |
| tagKeys         | No       | Array of String                                                                           | <p>Query using tag keys.</p><p>A maximum of 20 tag keys can be used.</p>                                 |
| tags            | No       | Array of [Tag](https://docs.console.zenlayer.com/api-reference/compute/datastructure#tag) | <p>Query using tags.</p><p>A maximum of 20 tags can be used.</p>                                         |

## 3. Output Parameters

| Parameter Name | Type                                                                                                    | Description                                                                                                           |
| -------------- | ------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| requestId      | String                                                                                                  | <p>The unique request ID, which is returned for each request.</p><p>RequestId is required for locating a problem.</p> |
| totalCount     | Integer                                                                                                 | The total number of NAT gateways that meet the filtering conditions.                                                  |
| dataSet        | Array of [NatGateway](https://docs.console.zenlayer.com/api-reference/compute/datastructure#natgateway) | The returned NAT gateway list.                                                                                        |

## 4. Code Example

{% tabs %}
{% tab title="Example" %}
**Query the NAT gateway list.**

```json
POST /api/v2/zec HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: DescribeNatGateways
<Common Request Params>

Request：
{
}

Response：
{
  "requestId": "T20F6B319-E8DD-4B1F-B038-DC79E4EA57F7",
  "response": {
      "requestId": "T20F6B319-E8DD-4B1F-B038-DC79E4EA57F7",
      "totalCount": 1,
      "dataSet": [
          {
              "resourceGroupName": "Default Resource Group",
              "natGatewayId": "<natGatewayId>",
              "expiredTime": null,
              "securityGroupId": "<securityGroupId>",
              "icmpReplyEnabled": true,
              "regionId": "asia-east-1",
              "createTime": "2025-04-01T01:01:01Z",
              "vpcId": "<vpcId>",
              "name": "<name>",
              "eipIds": ["<eipId>"],
              "resourceGroupId": "<resourceGroupId>",
              "isAllSubnets": false,
              "status": "RUNNING",
              "subnetIds": ["<subnetId>"],
              "zbgId": "<zbgId>",
              "tags":null
          }
      ]
  }
}
```

{% endtab %}
{% endtabs %}

## 5. Developer Resources

Zenlayer Cloud API 2.0 integrates [SDKs](https://docs.console.zenlayer.com/api-reference/api-introduction/toolkit/api-sdk)，to make it easier for you to call APIs. More programming languages will be supported.

## 6. Error Codes

The following only lists the error codes related to the API business logic. For other error codes, see [Common Error Codes](https://docs.console.zenlayer.com/api-reference/api-introduction/instruction/commonerrorcode).

| HTTP Status Code | Error Code | Description |
| ---------------- | ---------- | ----------- |
