{"type":"api","title":"Get Device Switch Ports","meta":{"id":"/apps/pubhub/media/Meraki-Dashboard-API-v1-Documentation/e92a64d0814b40091de22f4a93378df69809b95e/5c63a5d4-9452-397a-85eb-8b6fec45147e","info":{"title":"Meraki Dashboard API","description":"A RESTful API to programmatically manage and monitor Cisco Meraki networks at scale.\n\n\u003e Date: 06 November, 2024\n\u003e\n\u003e [Recent Updates](https://meraki.io/whats-new/)\n\n---\n\n[API Documentation](https://meraki.io/api)\n\n[Community Support](https://meraki.io/community)\n\n[Meraki Homepage](https://www.meraki.com)\n","contact":{"name":"Meraki Developer Community","url":"https://meraki.io/community"},"version":"1.52.0"},"security":[{"meraki_api_key":[]},{"bearerAuth":[]}],"tags":[{"name":"organizations"},{"name":"networks"},{"name":"devices"},{"name":"insight"},{"name":"wireless"},{"name":"camera"},{"name":"appliance"},{"name":"switch"},{"name":"cellularGateway"},{"name":"sm"},{"name":"sensor"},{"name":"administered"},{"name":"wirelessController"},{"name":"policy"},{"name":"accessControlLists"},{"name":"accessPolicies"},{"name":"accounts"},{"name":"acls"},{"name":"actionBatches"},{"name":"adaptivePolicy"},{"name":"addresses"},{"name":"admins"},{"name":"airMarshal"},{"name":"alertTypes"},{"name":"alerts"},{"name":"alternateManagementInterface"},{"name":"analytics"},{"name":"api"},{"name":"apiRequests"},{"name":"apnsCert"},{"name":"appliances"},{"name":"applicationCategories"},{"name":"applicationUsage"},{"name":"applications"},{"name":"areas"},{"name":"arpInspection"},{"name":"arpTable"},{"name":"artifacts"},{"name":"assets"},{"name":"assignments"},{"name":"authenticationToken"},{"name":"autoLocate"},{"name":"autoRf"},{"name":"availabilities"},{"name":"bandwidthUsageHistory"},{"name":"bgp"},{"name":"billing"},{"name":"bluetooth"},{"name":"bluetoothClients"},{"name":"bonjourForwarding"},{"name":"boundaries"},{"name":"brandingPolicies"},{"name":"bulk"},{"name":"bulkUpdate"},{"name":"byBoundary"},{"name":"byClient"},{"name":"byDevice"},{"name":"byEnergyUsage"},{"name":"byInterval"},{"name":"byMetric"},{"name":"byModel"},{"name":"byNetwork"},{"name":"byStatus"},{"name":"bySwitch"},{"name":"byType"},{"name":"byUsage"},{"name":"byUtilization"},{"name":"bypassActivationLockAttempts"},{"name":"cableTest"},{"name":"callbacks"},{"name":"categories"},{"name":"cellular"},{"name":"cellularFirewallRules"},{"name":"cellularUsageHistory"},{"name":"certs"},{"name":"changeHistory"},{"name":"channelUtilization"},{"name":"channelUtilizationHistory"},{"name":"channels"},{"name":"claim"},{"name":"claimKey"},{"name":"clientCountHistory"},{"name":"clients"},{"name":"cloudMonitoring"},{"name":"commands"},{"name":"communicationPlans"},{"name":"compliance"},{"name":"configTemplates"},{"name":"configurationChanges"},{"name":"configure"},{"name":"configuredDevices"},{"name":"connectionStats"},{"name":"connections"},{"name":"connectivity"},{"name":"connectivityEvents"},{"name":"connectivityMonitoringDestinations"},{"name":"contentFiltering"},{"name":"coterm"},{"name":"current"},{"name":"customAnalytics"},{"name":"customPerformanceClasses"},{"name":"dataRateHistory"},{"name":"delegated"},{"name":"desktopLogs"},{"name":"details"},{"name":"detections"},{"name":"deviceCommandLogs"},{"name":"deviceProfiles"},{"name":"deviceTypeGroupPolicies"},{"name":"dhcp"},{"name":"dhcpServerPolicy"},{"name":"dscpTaggingOptions"},{"name":"dscpToCosMappings"},{"name":"eapOverride"},{"name":"earlyAccess"},{"name":"electronicShelfLabel"},{"name":"entitlements"},{"name":"esims"},{"name":"ethernet"},{"name":"eventTypes"},{"name":"events"},{"name":"exportEvents"},{"name":"failedConnections"},{"name":"failover"},{"name":"features"},{"name":"fields"},{"name":"firewall"},{"name":"firewalledServices"},{"name":"firmware"},{"name":"firmwareUpgrades"},{"name":"floorPlans"},{"name":"groupPolicies"},{"name":"groups"},{"name":"health"},{"name":"healthByTime"},{"name":"historical"},{"name":"history"},{"name":"hotspot20"},{"name":"httpServers"},{"name":"identities"},{"name":"identityPsks"},{"name":"idps"},{"name":"imports"},{"name":"inboundCellularFirewallRules"},{"name":"inboundFirewallRules"},{"name":"interfaces"},{"name":"internetPolicies"},{"name":"intrusion"},{"name":"inventory"},{"name":"ipv6"},{"name":"jobs"},{"name":"keys"},{"name":"l2"},{"name":"l3"},{"name":"l3FirewallRules"},{"name":"l7FirewallRules"},{"name":"lan"},{"name":"latencyHistory"},{"name":"latencyStats"},{"name":"latest"},{"name":"licenses"},{"name":"licensing"},{"name":"lines"},{"name":"linkAggregations"},{"name":"linkLayer"},{"name":"live"},{"name":"liveTools"},{"name":"lldpCdp"},{"name":"loginSecurity"},{"name":"logs"},{"name":"lossAndLatencyHistory"},{"name":"malware"},{"name":"managementInterface"},{"name":"manufacturers"},{"name":"me"},{"name":"merakiAuthUsers"},{"name":"meshStatuses"},{"name":"models"},{"name":"monitor"},{"name":"monitoredMediaServers"},{"name":"mqttBrokers"},{"name":"mtu"},{"name":"multicast"},{"name":"netflow"},{"name":"networkAdapters"},{"name":"networkHealth"},{"name":"objectDetectionModels"},{"name":"onboarding"},{"name":"oneToManyNatRules"},{"name":"oneToOneNatRules"},{"name":"openapiSpec"},{"name":"optIns"},{"name":"order"},{"name":"ospf"},{"name":"overview"},{"name":"packetLoss"},{"name":"packets"},{"name":"payloadTemplates"},{"name":"performance"},{"name":"performanceHistory"},{"name":"permissions"},{"name":"pii"},{"name":"piiKeys"},{"name":"ping"},{"name":"pingDevice"},{"name":"policies"},{"name":"policyObjects"},{"name":"portForwardingRules"},{"name":"portSchedules"},{"name":"ports"},{"name":"power"},{"name":"powerModules"},{"name":"prefixes"},{"name":"prepare"},{"name":"priorities"},{"name":"profiles"},{"name":"provisioning"},{"name":"qosRules"},{"name":"qualityAndRetention"},{"name":"qualityRetentionProfiles"},{"name":"radio"},{"name":"ratePlans"},{"name":"readings"},{"name":"recent"},{"name":"redundancy"},{"name":"relationships"},{"name":"rendezvousPoints"},{"name":"requests"},{"name":"responseCodes"},{"name":"restrictions"},{"name":"rfProfiles"},{"name":"roles"},{"name":"rollbacks"},{"name":"routing"},{"name":"rules"},{"name":"saml"},{"name":"samlRoles"},{"name":"schedules"},{"name":"sdwan"},{"name":"search"},{"name":"security"},{"name":"securityCenters"},{"name":"seen"},{"name":"sense"},{"name":"sentry"},{"name":"servers"},{"name":"serviceProviders"},{"name":"settings"},{"name":"signalQualityHistory"},{"name":"sims"},{"name":"singleLan"},{"name":"siteToSiteVpn"},{"name":"smDevicesForKey"},{"name":"smOwnersForKey"},{"name":"snmp"},{"name":"softwares"},{"name":"splash"},{"name":"splashAuthorizationStatus"},{"name":"splashLoginAttempts"},{"name":"ssids"},{"name":"stacks"},{"name":"staged"},{"name":"stages"},{"name":"staticRoutes"},{"name":"statics"},{"name":"stats"},{"name":"status"},{"name":"statuses"},{"name":"stormControl"},{"name":"stp"},{"name":"subnetPool"},{"name":"subnets"},{"name":"subscription"},{"name":"subscriptions"},{"name":"summary"},{"name":"swap"},{"name":"swaps"},{"name":"switches"},{"name":"syslogServers"},{"name":"system"},{"name":"targetGroups"},{"name":"themes"},{"name":"thirdPartyVPNPeers"},{"name":"throughputTest"},{"name":"top"},{"name":"topology"},{"name":"traffic"},{"name":"trafficAnalysis"},{"name":"trafficHistory"},{"name":"trafficShaping"},{"name":"trustedAccessConfigs"},{"name":"trustedServers"},{"name":"upgrades"},{"name":"uplink"},{"name":"uplinkBandwidth"},{"name":"uplinkSelection"},{"name":"uplinks"},{"name":"uplinksLossAndLatency"},{"name":"usage"},{"name":"usageHistories"},{"name":"usageHistory"},{"name":"userAccessDevices"},{"name":"utilization"},{"name":"v4"},{"name":"video"},{"name":"videoLink"},{"name":"vlanAssignments"},{"name":"vlanProfiles"},{"name":"vlans"},{"name":"vmx"},{"name":"vpn"},{"name":"vpnExclusions"},{"name":"vpnFirewallRules"},{"name":"vppAccounts"},{"name":"wakeOnLan"},{"name":"warmSpare"},{"name":"warnings"},{"name":"webhookTests"},{"name":"webhooks"},{"name":"wirelessControllers"},{"name":"wirelessProfiles"},{"name":"wlanLists"},{"name":"zones"}],"x-parser-conf":{"overview":{"markdownPath":"docs/overview.md"},"theme":"meraki","serverConfig":true,"meta":{"useProxy":true},"httpBearer":{"bearerToken":"75dd5334bef4d2bc96f26138c163c0a3fa0b5ca6"},"labelConfig":{"endpoint":{"field":"operationId","format":"startCase"}},"groupBy":{"$remoteModule":"config/group_platform.js"},"sortBy":{"$remoteModule":"config/sort_by.js"},"exampleAsDefault":true,"expand":3,"sampleCode":{"python":{"folder":"meraki/sdk/python","name":"Meraki Python Library","highlight":"python"}},"variables":{"organizationId":"1215707","networkId":"N_784752235069315754","serial":"QBSB-VQ3J-XZ54"}},"openapi":"3.0.1","servers":[{"url":"https://api.meraki.com/{basePath}","variables":{"basePath":{"default":"api/v1"}}}],"securitySchemes":{"meraki_api_key":{"type":"apiKey","name":"X-Cisco-Meraki-API-Key","in":"header"},"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Key"}}},"spec":{"description":"List the switch ports for a switch","operationId":"getDeviceSwitchPorts","parameters":[{"name":"serial","in":"path","description":"Serial","schema":{"type":"string"},"required":true}],"responses":{"200":{"description":"Successful operation","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"portId":{"type":"string","description":"The identifier of the switch port."},"name":{"type":"string","description":"The name of the switch port."},"tags":{"type":"array","items":{"type":"string"},"description":"The list of tags of the switch port."},"enabled":{"type":"boolean","description":"The status of the switch port."},"poeEnabled":{"type":"boolean","description":"The PoE status of the switch port."},"type":{"type":"string","enum":["access","stack","trunk"],"description":"The type of the switch port ('trunk', 'access' or 'stack')."},"vlan":{"type":"integer","description":"The VLAN of the switch port. For a trunk port, this is the native VLAN. A null value will clear the value set for trunk ports."},"voiceVlan":{"type":"integer","description":"The voice VLAN of the switch port. Only applicable to access ports."},"allowedVlans":{"type":"string","description":"The VLANs allowed on the switch port. Only applicable to trunk ports."},"isolationEnabled":{"type":"boolean","description":"The isolation status of the switch port."},"rstpEnabled":{"type":"boolean","description":"The rapid spanning tree protocol status."},"stpGuard":{"type":"string","enum":["bpdu guard","disabled","loop guard","root guard"],"description":"The state of the STP guard ('disabled', 'root guard', 'bpdu guard' or 'loop guard')."},"linkNegotiation":{"type":"string","description":"The link speed for the switch port."},"linkNegotiationCapabilities":{"type":"array","items":{"type":"string"},"description":"Available link speeds for the switch port."},"portScheduleId":{"type":"string","description":"The ID of the port schedule. A value of null will clear the port schedule."},"schedule":{"type":"object","properties":{"id":{"type":"string","description":"The ID of the port schedule."},"name":{"type":"string","description":"The name of the port schedule."}},"description":"The port schedule data."},"udld":{"type":"string","enum":["Alert only","Enforce"],"description":"The action to take when Unidirectional Link is detected (Alert only, Enforce). Default configuration is Alert only."},"accessPolicyType":{"type":"string","enum":["Custom access policy","MAC allow list","Open","Sticky MAC allow list"],"description":"The type of the access policy of the switch port. Only applicable to access ports. Can be one of 'Open', 'Custom access policy', 'MAC allow list' or 'Sticky MAC allow list'."},"accessPolicyNumber":{"type":"integer","description":"The number of a custom access policy to configure on the switch port. Only applicable when 'accessPolicyType' is 'Custom access policy'."},"macAllowList":{"type":"array","items":{"type":"string"},"description":"Only devices with MAC addresses specified in this list will have access to this port. Up to 20 MAC addresses can be defined. Only applicable when 'accessPolicyType' is 'MAC allow list'."},"stickyMacAllowList":{"type":"array","items":{"type":"string"},"description":"The initial list of MAC addresses for sticky Mac allow list. Only applicable when 'accessPolicyType' is 'Sticky MAC allow list'."},"stickyMacAllowListLimit":{"type":"integer","description":"The maximum number of MAC addresses for sticky MAC allow list. Only applicable when 'accessPolicyType' is 'Sticky MAC allow list'."},"stormControlEnabled":{"type":"boolean","description":"The storm control status of the switch port."},"adaptivePolicyGroupId":{"type":"string","description":"The adaptive policy group ID that will be used to tag traffic through this switch port. This ID must pre-exist during the configuration, else needs to be created using adaptivePolicy/groups API. Cannot be applied to a port on a switch bound to profile."},"adaptivePolicyGroup":{"type":"object","properties":{"id":{"type":"string","description":"The ID of the adaptive policy group."},"name":{"type":"string","description":"The name of the adaptive policy group."}},"description":"The adaptive policy group data of the port."},"peerSgtCapable":{"type":"boolean","description":"If true, Peer SGT is enabled for traffic through this switch port. Applicable to trunk port only, not access port. Cannot be applied to a port on a switch bound to profile."},"flexibleStackingEnabled":{"type":"boolean","description":"For supported switches (e.g. MS420/MS425), whether or not the port has flexible stacking enabled."},"daiTrusted":{"type":"boolean","description":"If true, ARP packets for this port will be considered trusted, and Dynamic ARP Inspection will allow the traffic."},"profile":{"type":"object","properties":{"enabled":{"type":"boolean","description":"When enabled, override this port's configuration with a port profile."},"id":{"type":"string","description":"When enabled, the ID of the port profile used to override the port's configuration."},"iname":{"type":"string","description":"When enabled, the IName of the profile."}},"description":"Profile attributes"},"module":{"type":"object","properties":{"model":{"type":"string","description":"The model of the expansion module."}},"description":"Expansion module"},"mirror":{"type":"object","properties":{"mode":{"type":"string","enum":["Destination port","Not mirroring traffic","Source port"],"description":"The port mirror mode. Can be one of ('Destination port', 'Source port' or 'Not mirroring traffic')."}},"description":"Port mirror"},"dot3az":{"type":"object","properties":{"enabled":{"type":"boolean","description":"The Energy Efficient Ethernet status of the switch port."}},"description":"dot3az settings for the port"},"stackwiseVirtual":{"type":"object","properties":{"isStackWiseVirtualLink":{"type":"boolean","description":"For SVL devices, whether or not the port is used for StackWise Virtual Link."},"isDualActiveDetector":{"type":"boolean","description":"For SVL devices, whether or not the port is used for Dual Active Detection."}},"description":"Stackwise Virtual settings for the port"}}}},"example":[{"portId":"1","name":"My switch port","tags":["tag1","tag2"],"enabled":true,"poeEnabled":true,"type":"access","vlan":10,"voiceVlan":20,"allowedVlans":"1,3,5-10","isolationEnabled":false,"rstpEnabled":true,"stpGuard":"disabled","linkNegotiation":"Auto negotiate","linkNegotiationCapabilities":["Auto negotiate","1 Gigabit full duplex (auto)"],"portScheduleId":"1234","schedule":{"id":"1234","name":"Port Schedule"},"udld":"Alert only","accessPolicyType":"Sticky MAC allow list","accessPolicyNumber":2,"macAllowList":["34:56:fe:ce:8e:a0","34:56:fe:ce:8e:a1"],"stickyMacAllowList":["34:56:fe:ce:8e:b0","34:56:fe:ce:8e:b1"],"stickyMacAllowListLimit":5,"stormControlEnabled":true,"adaptivePolicyGroupId":"123","adaptivePolicyGroup":{"id":"123","name":"Adaptive Policy Group"},"peerSgtCapable":false,"flexibleStackingEnabled":true,"daiTrusted":false,"profile":{"enabled":false,"id":"1284392014819","iname":"iname"},"module":{"model":"MA-MOD-4X10G"},"mirror":{"mode":"Not mirroring traffic"},"dot3az":{"enabled":false},"stackwiseVirtual":{"isStackWiseVirtualLink":false,"isDualActiveDetector":false}}]}}}},"summary":"List the switch ports for a switch","tags":["switch","configure","ports"],"__originalOperationId":"getDeviceSwitchPorts","security":[{"meraki_api_key":[]},{"bearerAuth":[]}],"method":"get","path":"/devices/{serial}/switch/ports","sampleCode":{"Meraki Python Library":{"code":"import meraki\n\n# Defining your API key as a variable in source code is discouraged.\n# This API key is for a read-only docs-specific environment.\n# In your own code, use an environment variable as shown under the Usage section\n# @ https://github.com/meraki/dashboard-api-python/\n\nAPI_KEY = '75dd5334bef4d2bc96f26138c163c0a3fa0b5ca6'\n\ndashboard = meraki.DashboardAPI(API_KEY)\n\nserial = 'Q2QN-9J8L-SLPD'\n\nresponse = dashboard.switch.getDeviceSwitchPorts(\n serial\n)\n\nprint(response)","highlight":"python"}}}}