['The role of urgent endoscopy in high-risk nonvariceal upper gastrointestinal bleeding (NVUGIB) is unclear. The aim of this study was to determine whether esophagogastroduodenoscopy (EGD) performed sooner than the currently recommended 24 h in high-risk patients presenting with NVUGIB is associated with lower all-cause in-hospital mortality.', 'All adult patients undergoing EGD for the indications of coffee-grounds vomitus, hematemesis or melena at a university hospital over an 18-month period were enrolled. Patients with variceal and lower gastrointestinal bleeding were excluded. Data were prospectively collected.', 'A total of 934 patients were included. The area under the receiver operating characteristic curve (AUROC) for the Glasgow-Blatchford score (GBS) was 0.813 for predicting all-cause in-hospital mortality, with a cut-off score of ≥ 12 resulting in 90 % specificity. In low-risk patients with GBS < 12, presentation-to-endoscopy time in those who died and in those who survived was similar. In high-risk patients with GBS of ≥ 12, presentation-to-endoscopy time was significantly longer in those who died than in those who survived. Multivariate analysis of the high-risk cohort showed presentation-to-endoscopy time to be the only factor associated with all-cause in-hospital mortality. For high-risk patients, the AUROC for presentation-to-endoscopy time in predicting all-cause in-hospital mortality was 0.803, with a sensitivity of 100 % at the cut-off time of 13 h. All-cause in-hospital mortality in high-risk patients was significantly higher in those with presentation-to-endoscopy time of > 13 h compared with those undergoing endoscopy in < 13 h from presentation (44 % vs. 0 %; P < 0.001).'] Is urgent endoscopy associated with lower mortality in high-risk but not low-risk nonvariceal upper gastrointestinal bleeding?