How to store the dynamic attachment? Its not through Browse or Link


I want help from your side regarding the attachment functionality in erpnext.

I want to attach one pdf document on my record. The document which I want to attach is not in my system. I get the document dynamically through API Response as a binary code of that document.

I tried to solve this functionality using doc.add_comment(“Attachment”) but I have no idea in deep regarding this.

Waiting for the reply from your side.

Thank You.