WG-CP is API-first. You can manage networks completely via HTTP. Note: All API endpoints enforce a minimum 1-second response delay to mitigate misconfigured or malfunctioning agents.
admin_tokens or write_tokens is set in your YAML, include an Authorization: Bearer <token> header. Note: write_tokens only protect mutations (POST/DELETE).write_barrier: <integer> to the root of your YAML. Updates will be rejected (HTTP 409) if the incoming barrier is not greater than or equal to the stored one.POST /api/v1/networks
Creates a new network namespace and returns its ID.
POST /api/v1/networks/:networkId/yaml
Updates the network configuration. Send raw YAML in the body.
GET /api/v1/networks/:networkId/hosts
Returns a plain-text /etc/hosts compatible file for the entire network.
GET /api/v1/networks/:networkId/config/:pubkey
Generates the wg0.conf format for a specific node based on its public key. No auth required.
WireGuard Configuration (.conf): Returns the literal WireGuard configuration file for the node. Use this for initial setup, manual provisioning, or one-off fetches.
Streaming Updates (NDJSON): Append ?stream=true to receive a persistent NDJSON stream of updates. The stream outputs JSON objects containing the latest configuration (e.g., {"status":200,"config":"..."}) as network state changes.
GET /api/v1/networks/:networkId/yaml
Fetches the current raw YAML configuration.
DELETE /api/v1/networks/:networkId
Deletes the network and all configurations.