Hospitals are being urged to send urine and blood samples to be tested if they think emergency room patients may have taken synthetic cannabis.
The testing programme, by the Institute of Environmental Science and Research, follows more than 50 deaths in New Zealand which had been linked to synthetic cannabis.
The institute's senior forensic toxicologist, Diana Kappatos, said the testing was available to all district health boards, and several were already using the service.
"What we've found over the last year and a half in New Zealand is that synthetic cannabinoids have caused a lot of harm, and have been linked to many deaths in New Zealand, so we're trying to understand what is causing this harm," she said.
She said the new drugs were constantly changing in structure and symptoms, but hospitals did not have the technology to test what they were made up of.
"They're structured in such a way to avoid detection by routine analysis in laboratories, and to be one step ahead of legislation."
ESR forensic toxicology and pharmaceuticals manager Mary-Jane McCarthy said the testing allowed hospitals to better treat patients.
"The real benefit of the project is for the DHBs to have that ability to link the presentations of people that come into the emergency department who have taken these drugs, with the clinical symptoms that they're seeing, and then being able to target treatments," she said.
"Having an ability to do the identification of these drugs in patients admitted to emergency departments is very important, because it's a very early way of being able to understand there is an emerging threat from these drugs, and to start to plan proper harm reduction and intervention."
An emergency medicine specialist at Wellington Hospital, Paul Quigley, said knowing what patients had taken allowed doctors to treat them, and helped inform drug policy.
He said if users did not know what they were taking it was hard to treat them, and hard to warn the public.
"The users don't know what they're taking it's hard to police it," Dr Quigley said.
"Whereas we can say, 'Right, it's clear ABC... causing the problem, and that's where the enforcement needs to go.
"We're showing the system works."
But Dr Quigley also had a message to those buying the drugs.
"Buyer beware," he said. "The guys selling these drugs on the street don't care about you - they just want money.
"We know that there's a lot of drugs out there that are not safe, and you've really got to take a lot of care buying illicit drugs."