Skip to content

Create network

POST
/wp-json/wp2/multi-network/v1/networks
curl --request POST \
--url https://example.com/wp-json/wp2/multi-network/v1/networks \
--header 'Content-Type: application/json' \
--header 'X-WP-Nonce: <X-WP-Nonce>' \
--data '{ "domain": "network2.example.com", "path": "/", "site_name": "Network root site", "network_name": "Network Two", "user_id": 1, "clone_network_id": 1, "options_to_clone": [ "site_name", "admin_email" ] }'

Creates a new WordPress network (wp-multi-network add_network) on an installation where the Multi-Network module is committed and add_network exists. This is not a new blog inside the current network: it adds a separate network with its own root site.

    `domain`, `path`, and `site_name` are required (otherwise 400 `missing_fields`). Empty strings after trim count as missing. PHP lowercases `domain` and strips spaces.

    Omit `user_id` to make the current user the new network super-admin; a non-existent id returns 403 `network_user`. `clone_network_id` is the network whose network-meta is copied; default is the request''s current network (`get_current_network_id`). Omit `options_to_clone` and PHP uses the keys of `network_options_to_copy()` (admin_email, allowedthemes, site_admins, …). `network_name` is written to the network option `site_name` after create; it is not the same as `site_name` (root site blogname).

    Requires capability `create_networks`. Cookie + `X-WP-Nonce` or Application Password.
Media typeapplication/json
object
domain
required

Host of the new network without https:// (e.g. network2.example.com). Required. PHP trims, lowercases, and strips spaces. Empty → 400 missing_fields. A taken domain+path pair → insert_network network_exists (REST usually 500).

string
path
required

Path of the new network, not a file path. Usually / for a whole host. Required. add_network lowercases, strips spaces, and trailingslashit. This is not a Local Sync field.

string
site_name
required

Title of the new network’s root site (blogname). Required. Not the same as network_name — that is the network’s own site_name option.

string
network_name

Display name of the network. Optional. A non-empty value is written with update_network_option(…, ‘site_name’, …) after add_network. If omitted, wp-multi-network keeps its default (often “New Network”).

string
user_id

User ID to appoint as administrator of the new network. Optional: defaults to the current REST user. The user must exist, otherwise add_network returns 403 network_user. Not a Studio client id.

integer
clone_network_id

Source network ID whose network-meta is copied. Optional: defaults to the request’’s current network (get_current_network_id). Passed to add_network as clone_network.

integer
options_to_clone

Network option names to copy from clone_network_id. Optional. If omitted, PHP uses the keys of network_options_to_copy(): admin_email, allowedthemes, site_admins, upload_filetypes, welcome_email, etc. An empty array means copy nothing (the field was sent). Do not invent keys: only what wp-multi-network accepts.

Array<string>
Example
{
"domain": "network2.example.com",
"path": "/",
"site_name": "Network root site",
"network_name": "Network Two",
"user_id": 1,
"clone_network_id": 1,
"options_to_clone": [
"site_name",
"admin_email"
]
}

Network created. Body is format_network: id, domain/path, root site, network admin URL and site URL.

Media typeapplication/json
object
network_id

WordPress network ID (WP_Network->id). Same number as GET …/networks/{network_id}.

integer
domain

Network host as stored in wp_site (no scheme). Matches create input after lowercasing.

string
path

Network path with a trailing slash (add_network trailingslashit). Usually /.

string
site_id

Root site ID of this network (WP_Network->site_id), not the network ID.

integer
site_name

Root site blogname (get_blog_option site_id, blogname). Site title, not a network option.

string
network_name

Network option site_name (get_network_option). Set from request network_name when provided.

string
admin_url

Network admin URL {scheme}://{domain}{path}wp-admin/network/. scheme is https when is_ssl().

string format: uri
site_url

Root site URL {scheme}://{domain}{path}.

string format: uri
Example
{
"network_id": 2,
"domain": "network2.example.com",
"path": "/",
"site_id": 5,
"site_name": "Network root site",
"network_name": "Network Two",
"admin_url": "https://network2.example.com/wp-admin/network/",
"site_url": "https://network2.example.com/"
}

Missing_fields — domain, path, or site_name missing (empty after trim).

Media typeapplication/json
object
code

Machine-readable error or event code.

string
message

Message text (log, PIN, or password reset).

string
data

Extra WP_Error or license payload.

object
Examplegenerated
{
"code": "example",
"message": "example",
"data": {}
}

Not authenticated. DualRest: rest_forbidden (status 401) when there is no cookie session. Cookie + X-WP-Nonce or Application Password.

Media typeapplication/json
object
code

Machine-readable error or event code.

string
message

Message text (log, PIN, or password reset).

string
data

Extra WP_Error or license payload.

object
Examplegenerated
{
"code": "example",
"message": "example",
"data": {}
}

Missing create_networks, invalid REST nonce, or add_network: network_user / network_super_admin (the given user_id does not exist).

Media typeapplication/json
object
code

Machine-readable error or event code.

string
message

Message text (log, PIN, or password reset).

string
data

Extra WP_Error or license payload.

object
Examplegenerated
{
"code": "example",
"message": "example",
"data": {}
}

WP_Error from insert_network/add_network with no HTTP status in data (often network_exists — that network already exists, network_empty — empty domain). WordPress REST surfaces those as 500.

Media typeapplication/json
object
code

Machine-readable error or event code.

string
message

Message text (log, PIN, or password reset).

string
data

Extra WP_Error or license payload.

object
Examplegenerated
{
"code": "example",
"message": "example",
"data": {}
}

Multi_network_not_ready — module is not committed or add_network is missing.

Media typeapplication/json
object
code

Machine-readable error or event code.

string
message

Message text (log, PIN, or password reset).

string
data

Extra WP_Error or license payload.

object
Examplegenerated
{
"code": "example",
"message": "example",
"data": {}
}