Gresham-Yang Treaty
The Gresham-Yang Treaty was a treaty signed between the United States of America and the Qing dynasty in 1894, in which the Qing dynasty consented to measures put in place by the United States prohibiting Chinese immigration in exchange for the readmission of previous Chinese residents, thus agreeing to the enforcement of the Geary Act. This was the first time the United States government barred an entire ethnic group from entering the mainland United States of America. The treaty lasted until 1904, when the Qing dynasty government exercised its right to unilaterally withdraw. Historical Context 
The California Gold Rush catalyzed a large wave of Chinese immigration to the United States, further intensified by the high demand for workforce caused by the construction of the Transcontinental Railroad. However, with the shifting of the labor reality, white hostility to foreign laborers, including Chinese laborers, surged. In response anti-Chinese immigration laws were passed by the government, barring entry to new Chinese immigrants and requiring that fully legal existing Chinese immigrants who wished to later return to the United States obtain a "certificate of return". These laws were delineated in various acts, such as the Chinese Exclusion Act of 1882. Notably, some senators present during the creation of this act manifested their belief in the inferiority of the Chinese people, deeming them unfit to be naturalized, similar to parasites, and possessing revolting social characteristics. This act was further extended by the Geary Act, which included measures such as the requirement for Chinese people to always carry a resident permit, with failure to doing so resulting in deportation or one year of hard labor. These measures stayed in place until the signing of the Magnuson Act in 1943. The Treaty 
The Qing dynasty signed the Gresham-Yang Treaty so that, in exchange for their consent for the enforcement of the Geary Act and all associated measures, the United States would readmit previous Chinese residents into the country. However, the Qing government held many grievances against the United States related to the various "exclusion laws" passed, and the manner under which they were being enforced. In fact, the Qing government considered this their most important issue with the United States. In 1904, after the United States Congress decided, on April 29, 1902, to extend all laws relating to Chinese immigration and residence indefinitely, and to apply all such laws to the insular territories, including the Philippines, the Qing dynasty government unilaterally withdrew from the Gresham-Yang Treaty. In response, further laws were passed, this time making all Chinese barred both entrance to the United States and eligibility for American citizenship. Repercussions 
The Gresham-Yang Treaty's outcome, combined with the other exclusion acts, and a large anti-Chinese sentiment in the United States, contributed directly to the 1905 Chinese boycott. See also 

 Anti-Chinese sentiment in the United States

References 

China–United States relations