Getting ports/interfaces in a VLAN

I want to get the mapping of all the ports or interfaces to the vlan for a particular device. Something similar to this page in th LibreNMS UI. Do we have an API that gets this data? or how can I get it?, I couldn’t find any mapping of the vlans with the interfaces