web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Unanswered

Trying to Upload a Document using Business Central API

(0) ShareShare
ReportReport
Posted on by 112
Hi Team,
We are trying to attach PDF documents to both Purchase Invoices using the standard Business Central Document Attachments API.
The process consists of two steps:
Create a record in the standard documentAttachments entity.
Upload the PDF content using the attachmentContent endpoint.
The attachment record is created successfully, and the upload request returns HTTP 204 (No Content). However:
The PDF is not attached correctly to the Purchase Invoice.
An Incoming Document record is created.
Downloading the attached document results in a corrupted PDF that cannot be opened
The request body to create attachment record is
{
"fileName": "abc.pdf",
"ParentType": "Purchase Invoice",
"Parent Id": "1234-12345-2434".
Whereas for uploading the file content I am using PATCH method with uri as https://api.businesscentral.dynamics.com/v2.0/{tenant}/{environment}/api/v2.0/companies({companyId})/documentAttachments({attachmentId})/attachmentContent
and send the file content from SharePoint for the request body with expression as "body('Get_file_content')?['$content']".
Thank you!
Screenshot 2026-07-13 223503.png
I have the same question (0)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 621 Super User 2026 Season 1

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 445 Most Valuable Professional

#3
YUN ZHU Profile Picture

YUN ZHU 366 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans