Venezuelans trying to emigrate to Peru are rushing to get there before Saturday when new rules will come into force requiring them to have valid passports.
So far, Venezuelans have been allowed to enter Peru with just their ID cards.
Many have been waiting for their passports for years with the authorities blaming "mafias" inside the registry services for the delays.
More than two million Venezuelans have fled their country since 2014.
They are fleeing a severe economic crisis which has led to severe shortages of food, medicine and basic goods.
Many of those fleeing the country say they are doing so because they cannot get the operations and medical care they need.
On Thursday, United Nations High Commissioner for Refugees Filippo Grandi urged Peru, and Ecuador, which already put a similar measure in place on 18 August, to "continue to allow those in need of international protection to access safety and seek asylum".
According to UN figures, 26,000 entered Peru in 2017 but Peruvian migration chief Eduardo Sevilla says many more have arrived since.
He puts the number of Venezuelans currently in Peru at 400,000.
Peruvian Prime Minister César Villanueva said requiring Venezuelans to show their passport at the border did not mean that Peru was "closing the door" on Venezuelan migrants.
He said that Venezuelan ID cards did not provide enough information and could easily be forged.
Peruvian Foreign Minister Néstor Popolizio said Peru would issue "humanitarian visas" to Venezuelans in "exceptional" cases such as those of elderly people, pregnant women and young children.
He said Venezuelans could apply for the visa in Peruvian consulates in Venezuela, Colombia, Ecuador or even at the border crossing in Tumbes.
Mauricio Aparicio, who left Venezuela for Peru told Reuters news agency: "I came here because of the harsh poverty that we Venezuelans are going through in Venezuela, because of the economic crisis, in search of a better life, to have a way to help my family."
"My father is sick with stomach cancer. As you know, you can't find medicine and, if you get them, they are at a high price," he said.
Hundreds of Venezuelans are making the journey to Peru on foot as they do not have the money to pay for the bus fare.
Ecuador has laid on a number of buses to transport Venezuelans through the country on to Peru.
One of those on board is Maly Avilés, who said: "We're heading for Peru. There's no turning back, returning to Venezuela would be suicide."
After news of the passport requirements spread, even longer queues were reported at the offices of the Saime, the government offices issuing passports in Venezuela.
Some people in the queues said they had been trying to get hold of new passports for two years. Others reported having been asked to pay as much as $1,000 (£775) as bribes to jump the queue and be issued with new documents.
When some cited urgent personal reasons for needing a passport, such as travelling abroad to visit sick relatives, the requested bribe reportedly jumped to as much as $5,000.
In June, four officials at the Saime were arrested for extortion and a new director was named in July.