Discussions
add_attachment endpoint: use_as_pdf_view inconsistent behavior & missing dual-mode option
Hello B2Brouter Team,
We are currently integrating your API into our invoicing workflow and are facing a strange behavior with the add_attachment endpoint, specifically regarding the use_as_pdf_view parameter.
Context
We are generating PDF invoices on our side and attaching them to invoices through your add_attachment endpoint. Our goal is to have the uploaded PDF serve both as:
- The default PDF view of the invoice (i.e., what is rendered when a user opens or previews the invoice), AND
- A downloadable attachment accessible on the invoice.
Observed Behavior
We have tested both available values for the use_as_pdf_view parameter and neither achieves the desired result on its own:
-
use_as_pdf_view = true
The uploaded PDF is used as the default PDF view of the invoice. However, it does NOT appear as a downloadable attachment on the invoice. The file is only accessible when explicitly downloading a PDF copy. from the web UI -
use_as_pdf_view = (empty / false)
The uploaded PDF is available as a downloadable attachment on the invoice. However, it does NOT replace the default PDF view — the system-generated PDF is still displayed by default.
In both cases, only one of the two expected behaviors is active at a time.
Expected Behavior / Business Need
When we receive invoices from our own suppliers through your platform, we notice that both behaviors are active simultaneously:
- The supplier's PDF is used as the default view.
- The same PDF is also available as a downloadable attachment.
This is the behavior we need to replicate for our outgoing invoices.
Questions
- Is there a way to achieve both behaviors (default PDF view + downloadable attachment) with a single upload via add_attachment?
- If not, is it intentional that a second upload is required? Is there a dedicated parameter or workflow to handle this use case?
- How are our suppliers achieving this dual behavior — are they using a different endpoint or a specific parameter combination we are not aware of?
Additional Information
- API endpoint concerned: add_attachment
- Parameter concerned: use_as_pdf_view
- Integration method: REST API for PDF and UBL-XML upload before that.
Thank you in advance for your help. We would appreciate either a clarification of the expected behavior in the documentation, or guidance on the correct approach to implement this use case without uploading the document twice.
Best regards