Japan agreed to negotiate for Iranian oil at the premium price of $30 a barrel only after two British companies broke the line first government sources said today.

They insisted Japan had struck by its agreement with the United States on terms for buying Iranian oil until it learned early yesterday that the British companies had decided to pay $30 a barrel.

They identified the two as British Petroleum and Shell.

American officials hoping to hold down the prices for Iranian oil as part of their squeeze play on that country were described as displeased with the reported negotiations in Tehran. But it was not clear whether they would regard it as a price break-through large enough to merit protesting to the two importing countries.

The U.S. officials agreed that, on the basis of reports from Tehran, the Japanese had kept a promise not to buy Iranian oil at higher-than-normal prices until the British oil companies had agreed to the $30 price.

As part of an international pressure campaign to free American hostages, the United States has asked allied countries not to undermine Washington's own embargo of Iranian oil by paying abnormally high prices.

Japan was criticized strongly by the United States because some of its companies bought Iranian oil on Europe's spot market last month for up to $44 a barrel. Since then, however, Japan's position has been to support American pressures on Iran, thereby endangering its own prospects of purchasing large quantities of Iranian oil this year.

It promised to support the American stand so long as European countries did so.

But clearly yesterday, Japan's Ministry of International Trade and Industry citing the reports on the two British companies, advised Japanese negotiators it would sanction purchases in the neighborhood of $30 a barrel. American officials were promptly notified of the switch in an apparent effort to avert criticism by Washington.

A Japanese official said today word of the British firms' negotiations had been received from authoritative sources in the British government.

It was understood that U.S. officials had asked Japan and West European countries to prevent deals at a price much higher than the $28.50 fixed by Iran after the recent meeting of the Organization of Petroleum Exporting Countries in Caracas.

No precise dollar amount was set as too high, however, and it was not clear today whether the $1.50 premium would be regarded as excessive by the United States.