Hi,
To access SharePoint resources using REST, you need to construct a RESTful HTTP request by using the OData standard, which corresponds to the desired client object model API. The endpoint for getting attachments for a list is https://{site_url}/_api/web/lists/GetByTitle('list_title')/items(item_id)/AttachmentFiles. Make sure to replace site_url, list_title, and item_id with the appropriate values. To authenticate your app, you can use OAuth 2.0 for authorization/authentication. You can get an access token that authorizes your app with a particular set of permissions for a user. You provide an access token through an HTTP header: Authorization: bearer {token}. To obtain an access token and sign the user in, see OneDrive for Business authentication. If you are still getting an "Access is denied" error, make sure that the user account you are using to authenticate has the necessary permissions to access the SharePoint list and its attachments.
If the answer is helpful, please click "Accept as 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.