Upconversion techniques offer all-optical wireless alternatives to modulate targeted neurons in behaving animals, but most existing upconversion-based optogenetic devices show prefixed emission that is used to excite just one channelrhodopsin at a restricted brain region. Here, a hierarchical upconversion device is reported to enable spatially selective and combinatory optogenetics in behaving rodent animals. The device assumes a multiarrayed optrode format containing engineered upconversion nanoparticles (UCNPs) to deliver dynamic light palettes as a function of excitation wavelength. Three primary emissions at 477, 540, and 654nm are selected to match the absorption of different channelrhodopsins. The UCNPs are barcode assembled to multiple nanomachined optical pinholes in a microscale pipette device to allow remotely addressable, spectrum programmable, and spatially selective optical interrogation of complex brain circuits. Using the unique device, the basolateral amygdala and caudoputamen circuits are selectively modulated and the associated fear or anxiety behavior in freely behaving rodents is successfully differentiated. It is believed that the 3D barcode upconversion device would be a great supplement to current optogenetic toolsets and opens up new possibilities for sophisticated neural control.