Hello john john,
Thank you for posting in this Q&A Forum.
You can use POST /drives/{driveId}/items/{itemId}/createLink API endpoint to share a SharePoint document with external users. In the Scope parameter you can set it to "anonymous" Anyone with the link has access, without needing to sign in, the driveId is the SharePoint drive where the document is located, Itemid is the id of the document.
In the body you can use type, scope, password, message, recipients
https://learn.microsoft.com/en-us/graph/api/driveitem-createlink?view=graph-rest-1.0&tabs=http
Once you created the CreateLink API endpoint, you will receive a response that includes the URL of the sharing link.
Hope that helps.
Thanks
--please don't forget to upvote
and Accept as answer
if the reply is helpful--