Hi @john john ,
You could try following two api to create a sharelink
/_api/Web/Lists/GetByTitle(‘Documents’)/Items(1)/sharelink
or
/_api/web/GetFileByUrl(@v)/ListItemAllFields/ShareLink?@v='/sites/testsite/Mylib/test.txt'
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.