---
title: "Add one of your machines or routers to the private network, and get its wg-quick file."
method: POST
path: "/v1/networks/wireguard/peers"
tags: ["networks"]
---

# Add one of your machines or routers to the private network, and get its wg-quick file.

`POST /v1/networks/wireguard/peers`

## Request

- Base URL: `https://api.withruntime.com`
- URL: `https://api.withruntime.com/v1/networks/wireguard/peers`
- Auth: HTTP bearer

Send your peer's public key, or leave it out and Runtime generates the pair and puts the private key in config once. routes are your own ranges behind the peer that sandboxes may reach. At most 16 peers.

## Headers

- `Idempotency-Key` string

## Request body

- object
  - `name` string, required: Your own handle for the resource. Letters, digits, dot, dash, underscore.
  - `publicKey` string: The peer's WireGuard public key. Leave it out and Runtime generates the pair.
  - `routes` string[]: Private IPv4 ranges on your side of this peer that sandboxes may reach, such as 10.0.0.0/16.

## Response `200`

Success

- object
  - `tunnel` object
    - `funded` boolean: Funding permits traffic. False disables traffic while retaining the reservation; check balance, spending limits and account permissions.
    - `fundedUntil` string, date-time, nullable: Last funded-through timestamp, possibly in the past. Null means no meter exists. Free IPv6 also receives renewable deadlines.
    - `rateMicros` integer: Immutable quoted monthly price in millionths of a US dollar.
    - `rateUnit` 'unit_month'
    - `id` string
    - `subnet` string
    - `gatewayAddress` string
    - `endpoint` string: Where peers send WireGuard: address:udpPort.
    - `gatewayPublicKey` string, nullable: Null until a funded gateway is ready.
    - `disabled` boolean
    - `peers` object[]
      - `id` string
      - `name` string
      - `publicKey` string
      - `address` string: The peer's address inside the private network.
      - `routes` string[]: Your own ranges behind this peer, which sandboxes may reach through it.
      - `createdAt` string, date-time
      - `rotatedAt` string, date-time, nullable
    - `sandboxes` object[]
      - `sandboxId` string
      - `name` string, nullable
      - `address` string: Reach this sandbox's ports at this address.
      - `state` string
    - `createdAt` string, date-time
  - `peer` object
    - `id` string
    - `name` string
    - `publicKey` string
    - `address` string: The peer's address inside the private network.
    - `routes` string[]: Your own ranges behind this peer, which sandboxes may reach through it.
    - `createdAt` string, date-time
    - `rotatedAt` string, date-time, nullable
  - `config` string, nullable: A wg-quick file or a draft when configReady is false. Keep it: a Runtime-generated private key is delivered here once. Complete the gateway PublicKey before using a draft.
  - `configReady` boolean: Whether config includes the gateway public key. Funding and access are reported separately on tunnel.
  - `hint` string

## Other responses

- `default`: Error

---

[API](https://skmtc.dev/withruntime/apis/runtime-cloud-api.md) · [All operations](https://skmtc.dev/withruntime/apis/runtime-cloud-api/llms.txt) · [OpenAPI document](https://skmtc.dev/withruntime/apis/runtime-cloud-api/revisions/6f4012286988?raw)
