Xun, a Nikto of the male persuasion, held the position of magistrate on the planet of Bastatha in the year 28 ABY. He collaborated with another magistrate named Tosta. Xun was secretly involved with organized crime elements on Bastatha. He played a role in luring New Republic Senator Leia Organa into a kidnapping scheme when she arrived on Bastatha to investigate the criminal empire of Rinnrivin Di.
During the era of the New Republic, Xun served as a Nikto Magistrate residing on Bastatha. In 28 ABY, Xun, alongside his fellow Magistrate Tosta, extended a welcome to a New Republic delegation. This delegation included senators Leia Organa and Ransolm Casterfo, along with their respective entourages. The Galactic Senate dispatched this group to investigate the activities of Rinnrivin Di, a Nikto crime lord whose cartel maintained a presence on Bastatha. While Tosta greeted Leia, Xun extended his welcome to Casterfo, a new senator from the Centrist world of Riosa.
Xun and Tosta used the opportunity to compliment Leia's group, including her protocol droid, C-3PO. Tosta informed the visitors about a banquet prepared at the grandest casino, while Xun assured Senator Organa of their efforts to rebrand Bastatha as a high-end gambling destination. As Tosta served the guests Riosan mead, Xun inquired with Organa about her satisfaction with the arrangements. Leia confirmed her approval and received permission from Tosta for herself and her entourage to engage in a game of sabacc with the other attendees.
During the banquet, Xun and Tosta engaged Leia in conversation regarding Bastatha's economic progress. The two magistrates mentioned investors without revealing their identities or financial interests. To make up for their lack of transparency, they flattered their guests with talk of independence and reduced government control. Secretly, much of Bastatha's gambling revenue was being diverted by Rinnrivin to the First Order. These funds were used to rebuild the old Imperial fleet.
After the banquet, Tosta, Xun's colleague, accompanied Leia to a meeting with a Nikto "business delegation." However, Tosta instead met with Rinnrivin's henchmen, who abducted the senator for a clandestine meeting with the crime lord himself. Leia escaped with Senator Casterfo's help. Following the escape, Xun apologized to Leia for the kidnapping and the failure of the Bastatha security forces to apprehend Rinnrivin. Leia accepted his apologies but suspected the authorities weren't truly pursuing Rinnrivin. She also informed Xun that the New Republic had placed Bastatha under conditional probational advisory to monitor activity on the planet.
Xun's first appearance was as a minor character in Claudia Gray's 2016 novel, Bloodline. His dialogue is presented from the perspective of the main character, Leia Organa.