Fresh fecal samples were collected from seven sites on the north island of New Zealand (Fig. 1a, Supplementary Table 1) during January – April 2019. Bacterial 16S rRNA (V4 region)  and fungal ITS genes  were amplified using isolated DNA from captive (n = 38) and wild kiwi fecal samples (n = 68).
To determine whether captivity influences kiwi gut microbiota, we used PERMANOVA and NMDS analyses. Bacterial communities clustered by captivity across spatially independent sites with little overlap between the ellipses (Fig. 1b, PERMANOVA, r2 = 0.07, p = 0.001). Captivity significantly decreased alpha diversity of bacteria (Fig. 2a, ANOVA, p < 0.005) and fungi (Supplementary Fig. 1, ANOVA, p = 0.012) by 33% and 74% respectively. To assess the spread of variation among kiwi microbiomes in captive and wild treatments, we calculated distance to centroid, a metric for beta diversity. No discernible pattern was observed for bacteria (Supplementary Fig. 2a, ANOVA, p = 0.948), but a marginally significant pattern was detected in fungal communities (Supplementary Fig. 2b, ANOVA, p = 0.051). We also tested if site (a factor nested within captivity status) and history of coccidiosis (positive or negative) had an influence on variation in microbial communities using PERMANOVA (Supplementary Table 2). Site showed a significant effect on bacteria (r2 = 0.129, p = 0.001) and fungi (r2 = 0.183, p = 0.001). Coccidiosis history showed a marginally significant trend with bacteria (Fig. 2b, r2 = 0.048, p = 0.095) and fungi (r2 = 0.074, p = 0.087). Although bacterial phyla composition was variable within and across treatments, Firmicutes was more prevalent in wild kiwi, while Proteobacteria dominated in captive kiwi (Fig. 2c).
We conducted a simper analysis  to determine the most influential OTUs that differentiate captive and wild kiwi samples for both bacteria and fungi. Eighty-seven bacterial OTUs and fifteen fungal OTUs accounted for about 70% of the differences between wild and captive samples (Supplementary Tables 3 and 4). Using a multinomial species classification method (clamtest)  we categorized OTUs into four classes: rare, generalist, wild specialist, and captive specialist. For bacterial OTUs, 10% were classed as generalist, 53% as rare, 20% as wild specialist, and 17% as captive specialist (Fig. 3a, Supplementary Table 5). For fungal OTUs, 0% were classed as generalist, 47% as rare, 27% as wild specialist, and 27% as captive specialist (Fig. 3b, Supplementary Table 5).