Scotland Yard sought the records in 2012 after the newspaper revealed the Downing Street row between police and then cabinet minister Andrew Mitchell.
The Sun alleges police violated their right to protect “confidential sources” but the Met Police deny any wrongdoing.
The evidence is being analysed by the Investigatory Powers Tribunal.
The tribunal considers complaints about the way public authorities use covert techniques.
In September 2012, Mr Mitchell had a row with an officer who would not let him wheel his bike through the main gate at Downing Street.
Details were leaked to the Sun which reported Mr Mitchell had called officers plebs, which he continues to deny. PC Toby Rowland, the officer who was shouted at by the MP, stands by his account.
In the opening session of the unique challenge, a senior detective said he had legal justification to obtain call data from journalists' phones and two newsdesk landlines.
The officer used the Regulation of Investigatory Powers Act (Ripa), a law used to covertly obtain phone data in a wide range of situations, including crime, terrorism and missing people.
Police must prove to superiors that using the power was necessary and proportionate.
Det Ch Insp Tim Neligan, the senior investigating officer in the case, said he was confronted with allegations that looked like a “criminal conspiracy to unseat a cabinet minister”.
“He [Andrew Mitchell] was quite emphatic that he was a victim of a fit-up by the police,” Det Ch Insp Neligan said.
“It was now a crime investigation. We were investigating whether officers [at the Downing Street gate] had lied… and conspired with each other to leak (their account) to the press,” said the detective.
“We were under some considerable pressure to find answers to that.”
The Sun's parent News Group Newspapers, the paper's political editor Tom Newton Dunn and reporters Anthony France and Craig Woodhouse all argue Scotland Yard chiefs breached their freedom of speech under the European Convention on Human Rights.
In written submissions, Gavin Millar QC, for the Sun, said police should have gone to court or, alternatively, asked the newspaper to assist in other ways short of revealing its source.
“Until the last few years… a judge would always take any decision as to whether the journalistic right could lawfully be overridden in order to identify a confidential journalistic source,” said Mr Millar.
“This important requirement was disregarded in the present case.
“In each complaint there is an obvious violation of the source right for any number of obvious reasons. The manifest incompatibility of the actions taken by the police with the complainants' [human rights] should be declared.”
Det Ch Insp Neligan said he stood by his decision.
“I would not have applied for that data if I did not need it as an investigator,” he said.
The hearing, which is due to end on Tuesday, continues.