Tasks can be reprioritized in bulk by a request to the API. You need to supply the array of task ids, and the new priority value.
Tasks with lower priority values will be worked on first, and the default is 0.
There is no hard limit on the number of tasks that can be submitted for a bulk priority update, but there is a chance that requests with a large number of tasks fail with a 5xx error. A safe limit to avoid such errors is 100,000 tasks.