# Add Routing Policy - AddRoutePolicy

## Overview

Add Routing Policy






## Definition

### Public Parameters

| Parameter Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **Action**     | string  | Corresponding API command name, the current API is `AddRoutePolicy`.                      | **Yes** |
| **PublicKey**  | string  | The user's public key can be obtained from [Console](https://console.netlake.cn/uaccount/api_manage)                                             | **Yes** |
| **Signature**  | string  | User signature generated based on public key and API command, see [Signature Algorithm](/docs/api/summary/signature.md)  | **Yes** |

### Request Parameters

| Parameter Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **ProjectId** | string | Project ID. Leave it blank for the default project. Sub-accounts must fill in. Please refer to the [GetProjectList API](/docs/api/summary/get_project_list) |**Yes**|
| **UGNID** | string | UGN Instance ID |**Yes**|
| **Policy.Direction** | string | Policy direction, limited values: "In"/"Out |**Yes**|
| **Policy.Priority** | int | Policy priority, range: [1,255], the smaller the value, the higher the priority. In the same direction, policy priorities cannot be duplicated. |**Yes**|
| **Policy.RouteAction** | string | Policy execution action, limited values: "Permit"/"Deny |**Yes**|
| **Policy.SrcNetworks.N.NetworkId** | string | Array of network instance IDs for the routing policy to match |**Yes**|
| **Policy.SrcNetworks.N.Prefixes.N** | string | The subnet array under the network instance of the route that the routing policy needs to match |No|
| **Policy.Name** | string | Policy Name, limited to 255 characters |No|
| **Policy.RoutePriority** | int | When the action is set to "Permit", assign a routing priority to the matched routes, with a range of [1,255]. The smaller the value, the higher the priority. |No|
| **Policy.SrcRegions.N** | string | Array of regions where the routing strategy needs to match the route |No|
| **Policy.SrcNetworkTypes.N** | string | The array of network instance types of the routes that need to match the routing policy, limited to the value: "VPC""". |No|
| **Policy.DstNetworkTypes.N** | string | The array of network instance types that the routing policy needs to apply to, limited to the value: "VPC |No|
| **Policy.DstNetworks.N.NetworkId** | string | Array of Network Instance IDs that the Routing Policy Needs to Apply |No|

### Response Field

| Field Name | Type | Description Information | Required |
|:---|:---|:---|:---|
| **RetCode** | int | Return status code. If it is 0, it means successful return. If it is not 0, it means failure. |**Yes**|
| **Action** | string | Operation command name. |**Yes**|
| **Message** | string | Returns an error message, providing detailed description when `RetCode` is non-zero. |No|




## Example

### Request Example
    
```
https://api.netlake.cn/?Action=AddRoutePolicy
&ProjectId=org-1jzytw
&UGNID=ugn-1j2ekni38q2v
&Policy.Direction= In
&Policy.Priority=5
&Policy.Action=Permit
&Policy.SrcNetworks.n.NetworkId=uvnet-1ikw4byoo49w
&Policy.Name=test
&Policy.RoutePriority=9
&Policy.SrcRegions.n=cn-bj2
&Policy.SrcNetworkTypes.n=VPC
&Policy.SrcNetworks.n.Prefixes.n=10.55.56.0/24
&Policy.DstNetworkTypes.n=VPC
&Policy.DstNetworks.n.NetworkId=uvnet-1ikw4byoo49w
```

### Response Example
    
```json
{
  "Action": "AddRoutePolicyResponse",
  "RetCode": 0
}
```





