The New York Times tracked international ape smugglers from Congolese rain forests to the back streets of Bangkok. Here is what unfolded.

By Jeffrey Gettleman

MBANDAKA, Democratic Republic of Congo — The sting began, as so many things do these days, on social media.

Daniel Stiles, a self-styled ape trafficking detective in Kenya, had been scouring Instagram, Facebook and WhatsApp for weeks, looking for pictures of gorillas, chimps or orangutans. He was hoping to chip away at an illicit global trade that has captured or killed tens of thousands of apes and pushed some endangered species to the brink of extinction.

“The way they do business,” he said of ape traffickers, “makes the Mafia look like amateurs.”

After hundreds of searches, Mr. Stiles found an Instagram account offering dozens of rare animals for sale, including baby chimpanzees and orangutans dressed in children’s clothes. He sent an email to an address on the account — “looking for young otans” (the industry standard slang for orangutans) — and several days later received a reply.

“2 babies, 7.5k each. Special introductory price.”

The trafficker identified himself only as Tom and said he was based in Southeast Asia. Mr. Stiles knew what Tom was hoping for: to sell the infant orangutans to a private collector or unscrupulous zoo, where they are often beaten or drugged into submission and used for entertainment like mindlessly banging on drums or boxing one another. Such ape shows are a growing business in Southeast Asia, despite international regulations that prohibit trafficking in endangered apes.

Several weeks later, after a few more rounds of text messages with Tom to firm up the details, Mr. Stiles decided to fly to Bangkok.

“I was way out on a limb,” Mr. Stiles admitted later. But he was eager to bring down Tom, who indicated that he could find orangutans and chimps with only a few days’ notice, the mark of a major dealer.