Device Type by Serial Number

New here

Device Type by Serial Number

I have written Python code using the "meraki" Python package and it's working great.  I just ran into an issue where my code attempted to add MR devices to a "Switch Only" network.  This got me thinking that along with the serial number format validation regex I'm using, r'([A-Z0-9]{4}-){2}([A-Z0-9]{4})\b', I'd like to identify the "Device Type" with ReGex as well.  This way if I have a network that's not "Combined" and I try to add a new device I will know prior to getting the reject message.  I've looked on the Cisco DevNet site and API documentation and can't seem to find an official listing of how the first four (4) characters of the serial number Identify the device type.  Someone posted this here, but it's pretty old.


I would think that Meraki would have a table listed somewhere, but can't seem to find it.


Thanks for any help,



4 Replies 4
Head in the Cloud

Tbh I'd never even noticed the serial number prefix mapped to device type, so I learned something new today!


But in the same position, I'd use!get-organization-inventory-devices filtered for unused inventory, or just look up an individual serial number with...!get-organization-inventory-device


...then look at the productType field for the device(s) concerned.


This avoids relying on manually maintaining a lookup table.


New here



Thanks for the reply.  The automation I'm working on is when my field services team is installing a new network.  The first part of my code reads an Excel sheet that has all of the Serial Numbers that are going to be applied to the site.  When I create the network, my code needs to know if its for a single product or combined products.  I want to take the Serial Numbers from the spreadsheet and using ReGex determine what products are being installed.  That way when my code creates the site it knows what products should be in the list being passed, eg ['appliance', 'switch', 'wireless'].

Getting noticed

Do you have the device model number in the spreadsheet? 

If so, determine the device type by the first two characters of the model field, MX, MS, MR, etc. 


Building a reputation

The following file tracks this.  Pull requests welcome.

Get notified when there are additional replies to this discussion.