# RegisterBackend

## 1. API Description

This API is used to create a backend server and add it to a load balance listener.

## 2. Input Parameters

The following request parameter list only provides API request parameters.

<table><thead><tr><th width="165.63221528861155">Parameter Name</th><th width="117.5374755859375">Required</th><th width="140.86248779296875">Type</th><th>Description</th></tr></thead><tbody><tr><td>listenerId</td><td>Yes</td><td>String</td><td>The listener ID.</td></tr><tr><td>backendName</td><td>Yes</td><td>String</td><td>Backend server name.<br>This parameter can contain up to 64 characters. Only letters, numbers, - and periods (.) are supported.</td></tr><tr><td>instanceId</td><td>Yes</td><td>String</td><td>Bare metal instance ID.</td></tr><tr><td>clientToken</td><td>Yes</td><td>String</td><td>Used to ensure the idempotency of the request.</td></tr><tr><td>portList</td><td>No</td><td>Array of Integer</td><td>Port list.</td></tr><tr><td>weight</td><td>No</td><td>Integer</td><td>Weight of the instance.</td></tr></tbody></table>

## 3. Output Parameters

<table><thead><tr><th width="168.02813720703125">Parameter Name</th><th width="112.69061279296875">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>backendId</td><td>String</td><td>Backend server ID.</td></tr></tbody></table>

## 4. Code Example

{% tabs %}
{% tab title="Example" %}
**Add a backend server to a load balance listener.**

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

Request:
{
  "listenerId": "xxxx",
  "backendName": "xxxx",
  "portList": [80],
  "clientToken": "xxxx",
  "weight": 100,
  "instanceId": "xxxx"
}

Response:
{
  "requestId": "TEEFDCA5B-76FB-4E91-A18E-DF7F5D2CE41F",
  "response": {
    "requestId": "TEEFDCA5B-76FB-4E91-A18E-DF7F5D2CE41F",
    "backendId": "xxxx"
  }
}
```

{% endtab %}
{% endtabs %}

## 5. Developer Resources

Zenlayer Cloud API 2.0 integrates [SDKs](https://github.com/zenlayer/zenlayercloud-api-doc-en/blob/main/api-introduction/software-toolkit/sdk/README.md) to make it easier for you to call APIs. More programming languages will be supported.

## 6. Error Codes

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