Tonka beans have an intense flavour that chefs and food manufacturers have enthusiastically embraced. There’s just one problem – it contains a chemical that could, in large enough doses, kill you.

It’s led to raids by law enforcement agencies and mass deaths in animals; in the United States, chefs have ‘dealers’ who smuggle it into the country.

Given these facts, I’m unwrapping my online delivery with a level of suspicion usually reserved for bomb disposal. Inside is a jar of wrinkled black beans, each resembling an elongated raisin. These are ‘tonka beans’ – the aromatic seed of a giant tree from deep in the Amazon rainforest.

When grated into desserts or infused into syrups, they impart a flavour so transcendent, tonka has been dubbed the most delicious ingredient you’ve never heard of.

Notes of freshly cut grass mingle with vanilla, liquorice, caramel and clove, topped off with a suggestion of warmth and a hint of magnolia – that is, according to the internet. I unscrew the lid and take a whiff. They smell faintly like furniture polish.

“As long as you don’t use a copious amount of it – obviously a copious amount could cause death – it really is delicious,” says Thomas Raquel, head pastry chef at the Michelin-starred Le Bernardin in New York, not particularly reassuringly.

Selling tonka beans to eat has been illegal in the US since 1954. Foods containing tonka are considered to be ‘adulterated’, though that hasn’t stopped them appearing on the menus of Michelin-starred restaurants, from New York to California. In fact, the United States is the biggest importer of tonka on the planet.

Tonka beans contain unusually high levels of the chemical coumarin, which gives them their flavour and is found naturally in hundreds of plants, including grass, lavender and cherries. Even if you’ve never seen a tonka bean in your life, there’s a good chance you know what they smell like without realising it.

It was widely used in place of natural vanilla, added to chocolate, sweets and cocktail bitters, vanilla essence and even soft drinks

Coumarin was first isolated from tonka beans in 1820 – the name comes from the Caribbean term for the tonka tree, ‘coumarou’ – shortly afterwards, an English chemist better known for inventing the first synthetic dye worked out how to make it in the lab.

By the 1940s, artificial coumarin was really taking off. As one of the first synthetic additives, it was dirt cheap. It was widely used in place of natural vanilla, added to chocolate, sweets and cocktail bitters, vanilla essence and even soft drinks. It swiftly became a staple ingredient in tobacco and lent its complex aroma to the perfume industry.

But there was a problem. Studies in dogs and rats had revealed it to be toxic, with relatively low levels causing considerable damage to the liver in just a few weeks. In sheep, just 5g (around two teaspoons) is fatal. Both tonka and coumarin were outlawed.

Fast-forward to 2017 and they’ve never quite disappeared. “Let’s just say I know where to get em’, it’s not a problem to get them,” says Paul Liebrandt, the former co-owner of the Corton in New York.

This is despite a government crackdown nearly a decade ago, including raids on several gourmet restaurants. Grant Achatz, who is head chef at Chicago restaurant Alinea, later told The Atlantic “They [the supplier] said, 'Don't be surprised if the FDA shows up soon’…. Two days later, they walked in: ‘Can we look at your spice cabinet?’”.

Tonka and coumarin both still regularly turn up in Mexican vanilla flavouring, where they’re used to mask a low quality product. “I was talking to a vanilla purveyor recently and he offered me tonka bean paste,” says Raquel. “I was like ‘If I want to use tonka bean, I’ll use tonka bean.’”

Even if fancy restaurants aren’t your scene, there’s a good chance you’re being exposed from other sources. It’s still perfectly legal to add coumarin to tobacco and cosmetics, though it’s easily absorbed through the skin and the fragile lining of the lungs. The chemical is used copiously in detergents, shower gels, hand soaps and deodorants and blockbuster scents such as Coco Mademoiselle (Chanel) and Joop! Homme. It’s even found its way into e-cigarettes.

In fact, there’s a good chance you’ve got some coumarin lurking in your kitchen cupboards. True cinnamon is made from the bark of the plant Cinnamomum verum (also known as Cinnamomum zeylanicum) and is native to Sri Lanka. This type naturally has extremely low levels of coumarin and proven medicinal properties, but that’s probably not what you’ve got in your spice rack. That’s because what we think of as cinnamon isn’t really cinnamon at all, but a Southeast Asian imposter made from the bark of the cassia tree.

Coumarin is mostly toxic to the liver, which plays a central role in mopping up poisons and clearing them from the body  

Though the plants are distant cousins, cassia cinnamon contains around 25,000 times more coumarin. The US doesn’t regulate the amount of coumarin in cinnamon, though the European Union has set safe daily limits – and just one teaspoon of cassia cinnamon could send you over.

In 2013 Denmark’s beloved kanelsnegle, or cinnamon rolls, narrowly escaped being banned after a study found that nearly half of the products tested exceeded the maximum coumarin content allowed in food. “Only very rarely do we find an exceedance of a toxic compound in such a high percentage of foods,” says Nicolai Ballin, a food chemist from the Danish Veterinary and Food Administration who authored the study. “The worry is that many of these products are aimed at children.”.

So how dangerous is coumarin really? On paper at least, the forbidden flavour has never caused a single human death and there have been calls to lift the ban. But that’s not quite the full story.

Coumarin is mostly toxic to the liver, which plays a central role in mopping up poisons and clearing them from the body. As the front-line defence, the organ is extraordinarily resilient, able to regenerate from just a quarter of its original size. Just like alcohol, coumarin is thought to be toxic over the long term, with repeated bouts of damage.

“The problem is it’s not like you’re going to realise when you’ve got to the level where you’re eating too much – the effects build up over years,” says Dirk Lachenmeier from the Chemical and Veterinary Investigation Laboratory (CVUA) of Karlsruhe, Germany, who has developed a new way of detecting coumarin in foods.

The easy way to find out is obvious; alas, it turns out feeding people toxic chemicals isn’t allowed. Instead, the safe limits in humans are based on studies in animals, from baboons to dogs. To account for an any differences in our biology, the highest amount which hasn’t caused any harm in animals is multiplied by 100.

For most people, the current limit is probably ultra conservative  

For an average-sized person, this works out at a measly one quarter of a tonka bean or a quarter of a cinnamon bun per day – though if you remove the safety factor, your allowance shoots up to more like 25 tonka beans or 20 cinnamon buns (5680 calories, a challenge for even the most hardened binge eaters).

For most people, the current limit is probably ultra conservative. Many animals, including rats and dogs, remove coumarin from the body in a completely different way, breaking it down into highly potent chemicals which are toxic in their own right. Instead, we have enzymes which subtly tweak coumarin’s structure to render it safe. But not all people can do this.

Back in the 90s, a woman arrived at Frankfurt University Hospital with severe liver disease. She was promptly diagnosed with "coumarin-induced hepatitis", but in fact she hadn’t overdosed on tonka beans. She had been taking the drug warfarin. 

What was going on?

It all began in 1921. Hundreds of cattle across North America and Canada had been struck down by a mysterious illness, which meant that operations usually considered routine – such as surgery to remove their horns – would cause them to bleed to death. Farmers would find their animals slumped on the ground, surrounded by pools of blood.

The cattle had been eating sweet clover, a bitter and especially resilient herb which was imported from Europe, where it grew abundantly. In the unusually wet weather at the time, the clover had gone off and farmers could not afford to buy new feed.

The crisis dragged on for years, until eventually a farmer, desperate for help, showed up at the Wisconsin Alumni Research Foundation (Warf) with a dead cow and a bucket of uncoagulated blood. There biochemist Karl-Paul Link set to work uncovering what had happened.

Sweet clover contains high levels of coumarin, which a fungus had converted into the potent anticoagulant dicoumarol. The discovery inspired the development of warfarin, which today is both a particularly gruesome form of pest control and one of the most widely prescribed drugs on the planet. Coumarin itself is not an anticoagulant, but the two chemicals are extremely closely related.

Armed with the knowledge that tonka may or may not kill me, it’s time to put my baking skills to the test  

Which brings us back to the patient with liver disease. For people with a different version of the enzyme which deactivates coumarin, both warfarin and coumarin are thought to be particularly toxic. There’s no way of knowing which camp you fall in, short of a trip to the emergency room or a genetic test.  

“It has an effect on the liver and all kinds of other compounds have an effect on the liver, like alcohol especially. And so you never know if you get liver disease from coumarin or something else,” says Lachenmeier.

Globally, there were around a million deaths from liver disease in 2010 – that’s around 2% of all deaths. We may never know if coumarin was involved, but a recent report concluded that for those with the highest intakes, health risks cannot be ruled out.

Armed with the knowledge that tonka may or may not kill me, it’s time to put my baking skills to the test. Raquel recommends grating some tonka bean into macaron batter, then coating the finished shells in chocolate ganache and serving them with a sour cherry in the middle. Alas, my cooking skills are usually limited to microwave mug desserts, so I opt to bake some into cupcakes instead.

Half an hour later, I’m standing over a batch of slightly sad-looking cakes, which smell faintly of almonds. It’s only polite to share your toxic snacks with your friends, so I test one on my flatmate. She takes a bite and chews thoughtfully. “It tastes like feet.”

Join 800,000+ Future fans by liking us on Facebook, or follow us on Twitter.

If you liked this story, sign up for the weekly bbc.com features newsletter, called “If You Only Read 6 Things This Week”. A handpicked selection of stories from BBC Future, Earth, Culture, Capital, and Travel, delivered to your inbox every Friday.