As of today, there is no Word API available under the Microsoft Graph
Only thing that can be done using Graph API is managing the drive item and its permissions, when the file is residing in SharePoint/OneDrive for Business.
However, what you can try is editing the word file using Interop assemblies.
Reference link: https://learn.microsoft.com/en-us/visualstudio/vsto/office-primary-interop-assemblies?view=vs-2022
The steps can be as follows
- Download the file using Graph API https://learn.microsoft.com/en-us/graph/api/driveitem-get-content?view=graph-rest-1.0&tabs=http
- Edit the file using interop assemblies.
- Upload the edited file using Graph API (https://learn.microsoft.com/en-us/graph/api/driveitem-put-content?view=graph-rest-1.0&tabs=http)
- For larges files(greater than 4MB in size) upload session can be created (https://learn.microsoft.com/en-us/graph/api/driveitem-createuploadsession?view=graph-rest-1.0)
Following link can be referred to update bookmarks in a word document
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".