There is growing concern about the over-prescription of opioids and the risks of long-term use. This study examined the relationship between initial need (pre-operative, post-operative, and discharge pain) and dosage of opioids in the first prescription after surgery with continued opioid use through opioid refills over 12 months, while considering patient-level characteristics. A total of 9262 opioid-naïve patients underwent elective surgery, 7219 of whom were prescribed opioids following surgery. The results showed that 17% of patients received at least one opioid refill within one year post-surgery. Higher initial opioid doses, measured in morphine milligram equivalent (MME), were associated with a greater likelihood of continued use. Patients receiving a dose greater than 90 MME were 1.57 times more likely to receive a refill compared to those receiving less than 90 MME (95% confidence interval: 1.30–1.90,p< 0.001). Additionally, patients who experienced pain before or after surgery were more likely to receive opioid refills. Those experiencing moderate or severe pain were 1.66 times more likely to receive a refill (95% confidence interval: 1.45–1.91,p< 0.001). The findings highlight the need to consider surgery-related factors when prescribing opioids and the importance of developing strategies to balance the optimization of pain management with the risk of opioid-related harms.