Forum Discussion
Victor_F
Aug 18, 2025Copper Contributor
Extracting attachments from Business Central via API early 2024
Hi all According to the API documentation, the pdf or images attached to e.g. purchase invoices can be found using /attachments endpoint. This works very well for late 2024 and 2025 invoices, but fi...
Kidd_Ip
Aug 19, 2025MVP
Would suggest:
- Try Filtering by Journal or Ledger Entry
Use the /attachments endpoint with a filter like:
GET /api/v1.0/companies({id})/attachments?$filter=parentId eq {journalLineId} and parentType eq 'Journal'
Replace parentType with 'GeneralLedgerEntry' if applicable.
- Check for Incoming Documents
Older PDFs may be stored as Incoming Documents. Try querying:
GET /api/v1.0/companies({id})/incomingDocuments
Then match the sourceId or documentId with your ledger entries.
- Explore Media or MediaSet Fields
Some attachments may be stored using the Media or MediaSet data types. These aren't always exposed via /attachments, so you may need to:
- Use AL code to expose them via a custom API
- Check if the document is linked to a custom page or extension