Question: how to add new peer to WireGuard VPN via API
Question: how to add new peer to WireGuard VPN via API
hi all,
i have a question: how can I add neww / edit peer for WireGuard VPN?
- Copy Link
- Subscribe
- Bookmark
- Report Inappropriate Content
Hi @Vincent-TP,
it seems, there is still a small misunderstanding regarding my question...
- I know exactly how to create WireGuard site2site VPN - I have replaced the unstable SD-WAN with WireGuard, which is very stable
- I have currently two WireGuard VPNs configured per site:
- one site2site as SD-WAN replacement
- second one for mobile client access
- I'm trying to add new peer to existing WireGuard via API (to the second one - for mobile clients) using "Modify site-to-site VPN by manual" API call - that's where I still have problems to pass parameters in correct format - always getting error "-1001 Invalid request parameters"......
- Copy Link
- Report Inappropriate Content
Hi @ZoloNN
Sorry for the late reply. Here are the intructions:
- Use this API to retrieve existing wired guard VPNs and related peer parameters: GET /openapi/v2/{omadacId}/sites/{siteId}/vpn/site-to-site-vpns/{vpnId}
- Based on the above information, identify the VPN ID to be modified and the existing parameter details. Then use the following PATCH method to add corresponding peer information (i.e., remote subset): PATCH /openapi/v2/{omadacId}/sites/{siteId}/vpn/site-to-site-vpns/{vpnId}

Error -1001 Invalid request parameters indicates that the parameters are unavailable. It is likely that the input information was not formatted as required. Please check whether the parameters are complete and formatted in accordance with the document requirements.
If the situation is still the same, don't hesitate to let us know.
- Copy Link
- Report Inappropriate Content
Hi @Vincent-TP,
it seems, that the API call PATCH /openapi/v2/{omadacId}/sites/{siteId}/vpn/site-to-site-vpns/{vpnId} expects the whole information set inclusive VPN name, VPN type, service port, etc... not only new peer info - which is IMHO overkill when I will only add one new peer....
currently I'm using the deprecated POST /openapi/v1/{omadacId}/sites/{siteId}/vpn/wireguard-peers which is working fine - just the question is, how long....
will try to experiment to get it running, but the usage isn't apparently that simple as the old API call.
I would like to see similar API call in the new API structure
- Copy Link
- Report Inappropriate Content
Hi @ZoloNN
Here is an example for your reference:
{
"vpnType": 4,
"name": "1",
"status": true,
"mtu": 1420,
"servicePort": 51820,
"networkType": 0,
"networkList": [
"69e829c2c0522377a132f389"
],
"tunnelIp": "172.16.0.2",
"privateKey": "2CpCHWuZZoe7nU/wZ56v3jzo2rl7ykL6HwKy3Bkb0l0=",
"publicKey": "yiYmWgY85IxEGRO2MZKjVZftNwatN3fRb6XD8jsmaSQ=",
"peers": [
{
"name": "Peer_1",
"status": true,
"serverPublicKey": "112233445566778899112233445566778899001122+=",
"remoteIp": "",
"remoteSubnet": [
"1.1.1.1/24"
],
"keepAlive": 25
}
],
"siteVpnType": 1,
"id": "69e97959c0522377a1330613"
}
- Copy Link
- Report Inappropriate Content
Information
Helpful: 0
Views: 688
Replies: 14
Voters 0
No one has voted for it yet.
