> 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/networking/sdn/port/describeportusablevlan.md).

# DescribePortUsableVlan

## 1. API Description

This API is used to query available VLANs for the port.

{% hint style="info" %} <mark style="color:blue;">**Note**</mark>

<mark style="color:blue;">At least one of the following parameters needs to be passed in: Port or data center.</mark>
{% endhint %}

## 2. Input Parameters

The following request parameter list only provides API request parameters.

<table><thead><tr><th width="194.15238095238095">Parameter Name</th><th width="118">Required</th><th width="98">Type</th><th>Description</th></tr></thead><tbody><tr><td>dcId</td><td>No</td><td>String</td><td><p>Code of data center.</p><p>To obtain code, you can call <a href="/pages/6NryHUpaL9ykwvihast7"><code>DescribeDataCenters</code></a>, and find <code>dcId</code> in the response.</p></td></tr><tr><td>portId</td><td>No</td><td>String</td><td>Port ID.</td></tr></tbody></table>

## 3. Output Parameters

<table><thead><tr><th width="199.33333333333331">Parameter Name</th><th width="166">Type</th><th>Description</th></tr></thead><tbody><tr><td>requestId</td><td>String</td><td>The unique request ID, which is returned for each request. RequestId is required for locating a problem.</td></tr><tr><td>start</td><td>Integer</td><td>Start value of VLAN range.</td></tr><tr><td>end</td><td>Integer</td><td>End value of VLAN range.</td></tr><tr><td>inuseVlanList</td><td>Array of Integer</td><td>List of occupied VLANs.</td></tr></tbody></table>

## 4. Code Example

{% tabs %}
{% tab title="Example" %}
**Query available VLANs for a port.**

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

Request: {
  "portId": "your-port-id"
}

Response: {
  "requestId": "TEEFDCA5B-76FB-4E91-A18E-DF7F5D2CE41F",
  "response": {
    "requestId": "TEEFDCA5B-76FB-4E91-A18E-DF7F5D2CE41F",
    "dataSet": {
      "start": 1,
      "end": 4000,
      "inuseVlanList":[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 3999, 4000]
    }
  }
}
```

{% 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).​

<table><thead><tr><th width="195.33333333333331">HTTP Status Code</th><th width="286">Error Code</th><th>Description</th></tr></thead><tbody><tr><td>7112</td><td>SELF_SERVICE_PORT_VLAN_PORT_AND_DC_NEED_AT_LEAST_ONE</td><td><mark style="color:blue;">At least one port or one data center needs to be passed in.</mark></td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.console.zenlayer.com/api-reference/networking/sdn/port/describeportusablevlan.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
