Introduction
Rolling out a single branch office by hand through the dashboard is manageable. But once you’re deploying fifty, a hundred, or a thousand new sites, manual configuration turns into operational bottlenecks, configuration drift, and the occasional costly typo.
That’s why I lean on Infrastructure as Code (IaC) and API-driven automation once you’re past a handful of sites.
With the Cisco Meraki REST API, you can provision new branches programmatically in seconds. Instead of clicking through dozens of dashboard menus to set up firewalls, switches, and wireless access points, a single API call generates the entire site footprint.
Below I’ll walk through exactly how to create new Meraki networks and clone existing golden templates using raw API calls, Postman, and Python.
What is Meraki API Site Provisioning?
Meraki API site provisioning means using HTTP requests to talk directly to the Cisco Meraki cloud backend. Instead of using the Dashboard GUI, you send an HTTP POST request to the /organizations/{organizationId}/networks endpoint.
That endpoint accepts a JSON payload with site-specific parameters — the site name, the devices it will support (appliances, switches, cameras), its time zone, and optionally a source network to clone configuration from.
Why It Matters in Modern Networks
In a modern NetOps environment, speed and consistency both matter.
When you’re expanding, you need standardized deployments. A retail chain opening a new store needs the exact same VLAN structure, SSID configuration, and firewall rules as its existing locations.
Cloning an existing “Base Network” via the API guarantees that consistency. It takes the human element out of the initial build, which helps compliance and gets a new site live faster.
Key Concepts Explained
Before the code, here are the core pieces you need to understand:
REST Architecture: Meraki’s API is RESTful.
GETretrieves data,POSTcreates new data,PUTupdates existing data, andDELETEremoves it. To create a network, you send aPOSTrequest.Organization ID: the unique identifier for your overarching Meraki tenant. Networks always sit underneath an Organization.
Network ID: the unique identifier for a specific site or deployment (e.g., “Branch_01”).
copyFromNetworkId: a powerful parameter in the payload. Pass an existing Network ID into this field and Meraki duplicates that site’s configuration into the new one.
Product Types: a list defining what hardware lives at the site. Valid types include
appliance,camera,cellularGateway,sensor,switch, andwireless.
Read Also: How to Find Your Meraki Organization ID and Network ID — covers the API, Postman, and Dashboard methods for both IDs in depth.
Step-by-Step Breakdown
Here’s the logical flow I follow for automated site creation:
Authenticate: make sure you have an active Meraki API key with Organization Read/Write privileges.
Retrieve your Organization ID: use a
GETrequest to/organizationsto find your target environment.Identify the source network: if you’re cloning a site, run a
GETrequest to/organizations/{organizationId}/networksto find the Network ID of your golden template.Construct the JSON payload: build the data structure with the new site’s name, time zone, and the cloning parameter.
Execute the POST request: push the payload to the API.
Handle post-provisioning updates: immediately fix any conflicting parameters (like IP subnets) that the cloning process generated.
Configuration / Code Examples
The JSON Payload
When creating a network, the API expects a specific JSON body. Here’s a payload for cloning a site:
{
"name": "New_Retail_Branch_05",
"timeZone": "America/New_York",
"productTypes": [
"appliance",
"switch",
"wireless",
"sensor"
],
"copyFromNetworkId": "N_1234567890123456"
}
Example 1: Python Using the requests Library
Python is my go-to for network automation scripts. Here’s how I’d create the site using the native requests library.
Read Also: Python NETCONF Automation with NCclient
import requests
import json
# Define variables
api_key = "YOUR_MERAKI_API_KEY"
org_id = "YOUR_ORGANIZATION_ID"
url = f"https://api.meraki.com/api/v1/organizations/{org_id}/networks"
# Define the headers
headers = {
"X-Cisco-Meraki-API-Key": api_key,
"Content-Type": "application/json",
"Accept": "application/json"
}
# Define the payload
payload = {
"name": "New_Retail_Branch_05",
"timeZone": "America/New_York",
"productTypes": ["appliance", "switch", "wireless"],
"copyFromNetworkId": "N_1234567890123456"
}
# Execute the POST request
response = requests.post(url, headers=headers, data=json.dumps(payload))
# Output the result
if response.status_code == 201:
print("Network created successfully!")
print(json.dumps(response.json(), indent=4))
else:
print(f"Failed to create network. Status Code: {response.status_code}")
print(response.text)
What’s happening here:
I build the endpoint dynamically using an f-string to inject
org_id.The API key goes in via the
X-Cisco-Meraki-API-Keyheader.json.dumps(payload)turns the Python dictionary into a JSON string the Meraki cloud can read.A successful creation returns an HTTP
201 Created.
Example 2: Python Using the meraki SDK
Cisco maintains an official Python SDK that simplifies this considerably.
import meraki
# Initialize the Meraki dashboard client
api_key = "YOUR_MERAKI_API_KEY"
dashboard = meraki.DashboardAPI(api_key)
org_id = "YOUR_ORGANIZATION_ID"
source_network_id = "N_1234567890123456"
try:
# Create the network using the SDK method
new_network = dashboard.organizations.createOrganizationNetwork(
organizationId=org_id,
name="New_Retail_Branch_05",
productTypes=["appliance", "switch", "wireless"],
timeZone="America/New_York",
copyFromNetworkId=source_network_id
)
print("Success! New Network ID:", new_network['id'])
except meraki.APIError as e:
print(f"Meraki API Error: {e}")
What’s happening here:
The SDK abstracts away the manual HTTP handling. You call createOrganizationNetwork and pass your parameters as arguments, and it handles retries and rate-limiting for you — this is what I reach for in anything beyond a quick one-off script.
Real-World Use Cases
Managed Service Providers (MSPs): onboarding a new client, you can spin up a fully customized, secure network in seconds by cloning a managed base template.
Retail Expansion: stores need identical POS VLANs, guest WiFi configuration, and SD-WAN rules — API cloning guarantees a 100% match.
Disaster Recovery: if a configuration gets wiped or corrupted, a script can rebuild the entire site logic instantly.
Benefits
Time: what takes 30 minutes of dashboard clicking takes 2 seconds via code.
No configuration drift: cloning guarantees your ACLs, group policies, and content filtering rules are exact duplicates.
Auditability: changes made via script can be tracked in Git.
Common Challenges
The biggest gotcha with copyFromNetworkId is that it’s an exact duplication.
When you clone a Meraki network, everything copies over — including local VLAN IP subnets and DHCP scopes. If you’re running a Meraki Auto VPN (site-to-site) topology, you can’t have two sites advertising the same IP subnet.
So cloning a site is only step one. Step two has to be a PUT request updating the new site’s VLAN subnets, DHCP ranges, and local firewall objects before you bring it online.
Best Practices
Maintain golden templates: keep inactive “Template Networks” in your dashboard strictly as cloning sources. Don’t alter these except when updating your global baseline.
Validate inputs: use Python data validation (like Pydantic) to make sure your time zones and product types are formatted correctly before you fire the API call.
Modularize your code: keep authentication logic separate from deployment logic so scripts stay reusable.
Security Considerations
Your API key carries the same weight as an enterprise administrator credential — treat it that way.
Never hardcode API keys: don’t paste your key directly into a script that’s going to GitHub.
Use environment variables: store keys locally on your machine (
os.getenv('MERAKI_API_KEY')).Use a secrets manager: for CI/CD pipelines, use HashiCorp Vault or AWS Secrets Manager.
Rotate keys regularly: regenerate your API keys periodically to limit the blast radius if one ever leaks.
Troubleshooting Tips
HTTP 400 Bad Request: your JSON payload is malformed. Check that you’re passing strings and lists correctly (
productTypesmust be a list[], not a string).HTTP 401 Unauthorized: your API key is invalid, expired, or missing from the headers.
HTTP 404 Not Found: double-check your Organization ID or source Network ID — if it’s wrong, the endpoint can’t resolve.
HTTP 429 Too Many Requests: you’ve hit the Meraki API rate limit (typically 10 calls per second per organization). Add exponential backoff, or just use the official Python SDK, which handles 429s for you.
Future Trends
I still reach for the raw API or the Python SDK above for one-off scripts and ad-hoc cloning. But if network provisioning becomes a recurring job for you — onboarding a new franchise site every month, say — it’s worth looking at Cisco’s official Terraform provider for Meraki. Terraform’s state file tracks what it already created, so re-running a deployment doesn’t accidentally spin up duplicate networks. That’s a real gap in the scripts above: they create a network every time you run them, with no memory of what’s already there.
Frequently Asked Questions
Q: How do I create a new network using the Meraki API?
A: Send an HTTP POST request to the /organizations/{organizationId}/networks endpoint. Your request body needs to include the network name and the product types (e.g., appliance, switch, wireless) you plan to deploy.
Q: What is the difference between creating a new Meraki network and cloning one?
A: Creating a new network gives you a blank slate with default Meraki settings. Cloning a network (using copyFromNetworkId) copies all existing configuration — VLANs, SSIDs, firewall rules — from a source network into the new one.
Q: Can I use Python to automate Meraki site deployments?
A: Yes — Python is the most common choice. Use the standard requests library for raw HTTP calls, or install the official meraki Python SDK (pip install meraki) to simplify authentication and rate-limiting.
Q: What product types are supported when creating a Meraki network?
A: appliance (MX firewalls), switch (MS switches), wireless (MR access points), camera (MV cameras), sensor (MT sensors), and cellularGateway (MG gateways).
Q: Why do my VLANs conflict after cloning a Meraki network?
A: Cloning creates an exact duplicate, including the local IP subnets and VLAN definitions from the source network. You need to run a follow-up API call to update the new site’s subnets and avoid IP overlap.
Q: How do I handle Meraki API rate limits?
A: Meraki generally allows 10 requests per second per organization. If you exceed that, you’ll get a 429 status code — handle it with a Python sleep() delay, or use the official SDK, which retries automatically.
Have a question this didn’t cover? Get in touch and I’ll help you work through it.
๐ง Free Network Tools
Handy while you're troubleshooting โ no signup needed.
