> For the complete documentation index, see [llms.txt](https://docs.console.zenlayer.com/api-reference/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.console.zenlayer.com/api-reference/sdn/pricing/querydatacenterportprice.md).

# QueryDataCenterPortPrice

## 1. API Description

This API (QueryDataCenterPortPrice) is used to inquiry Data Center Port Price

## 2. Input Parameters

The following request parameter list only provides API request parameters.

| Parameter Name                | Required | Type    | Description                                                                                                                                                                                                                                                                           |
| ----------------------------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| dcId                          | Yes      | String  | Data center ID. The latest list of data centers can be obtained via the [DescribeDataCenters](/api-reference/sdn/location/describedatacenters.md) API.                                                                                                                                |
| portType                      | Yes      | String  | Port spec. The latest port spec list can be obtained via the [DescribeDataCenterPortPrice](/api-reference/sdn/data-center-port/describedatacenterportprice.md) API.                                                                                                                   |
| buildCrossConnectWithAssisted | No       | Boolean | <p>Whether Zenlayer-assisted Cross Connect construction is required.</p><p>If true, the price includes the Cross Connect patch cord fee and the one-time construction fee.</p><p>Default: false, meaning the user builds the Cross Connect themselves.</p><p>Default value: false</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>                                              |
| crossConnectPrice                    | [PriceItem](/api-reference/sdn/datastructure.md#priceitem) | <p>Cross Connect price.</p><p>This value is null if the current data center does not support Zenlayer-assisted Cross Connect construction.</p>                     |
| crossConnectOneTimeConstructionPrice | [PriceItem](/api-reference/sdn/datastructure.md#priceitem) | <p>Cross Connect one-time construction fee.</p><p>This value is null if the current data center does not support Zenlayer-assisted Cross Connect construction.</p> |
| dcId                                 | String                                                     | Data center ID.                                                                                                                                                    |
| price                                | [PriceItem](/api-reference/sdn/datastructure.md#priceitem) | Price information.                                                                                                                                                 |
| stock                                | Integer                                                    | Available stock quantity.                                                                                                                                          |

## 4. Code Example

{% tabs %}
{% tab title="Example" %}
**1. Inquire the price for a data center port, where the user builds the Cross Connect themselves.**

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

Request:
{
    "dcId": "SIN1",
    "portType": "10G",
    "buildCrossConnectWithAssisted": false
}

Response:
{   
  "requestId": "TDB181167-C39F-4C3E-8E88-B8FDE755FDC0",
  "response": {
    "requestId":"TDB181167-C39F-4C3E-8E88-B8FDE755FDC0",
    "price":        {
            "unitPrice":1.65,
            "originalPrice":null,
            "discountPrice":null,
            "discount":100,
            "stepPrices":null,
            "discountUnitPrice":1.65,
            "chargeUnit":"DAY",
            "amountUnit":null
        },
    "stock": 100,
    "crossConnectPrice": null,
    "crossConnectOneTimeConstructionPrice": null,
    "dcId": "SIN1"
  }
}
```

{% endtab %}
{% endtabs %}

## 5. Developer Resources

Zenlayer Cloud API 2.0 integrates [SDKs](/api-reference/api-introduction/toolkit/api-sdk.md)，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](/api-reference/api-introduction/instruction/commonerrorcode.md).

| HTTP Status Code | Error Code                      | Description                               |
| ---------------- | ------------------------------- | ----------------------------------------- |
| 404              | INVALID\_DATACENTER\_NOT\_FOUND | The specified data center does not exist. |
