The question is pretty old, so I will add this for future reference.
I was dealing with the same problem and I found a solution. Or rather hack. Instead of createLibraryDocument, I use sendDocument directly. It has the mergeFieldsInfo property, which according to the documentation cannot be used with library documents, but will work if you pass the file url. I tried the option with the URL and it works, I have the fields filled in the test document.
An example of a request body that worked for me:
<?xml version="1.0"?> <sendDocument> <apiKey>XXXXX</apiKey> <senderInfo nil="true"/> <documentCreationInfo> <fileInfos> <FileInfo> <fileName>Merchant Agreement.pdf</fileName> <url>https://my.public.host.com/GetFinancing%20Merchant.pdf</url> </FileInfo> </fileInfos> <mergeFieldInfo> <mergeFields> <MergeField> <defaultValue>test</defaultValue> <fieldName>companyName</fieldName> </MergeField> <MergeField> <defaultValue>test</defaultValue> <fieldName>companyAddress</fieldName> </MergeField> <MergeField> <defaultValue>0123456789</defaultValue> <fieldName>companyPhone</fieldName> </MergeField> </mergeFields> </mergeFieldInfo> <name>Merchant Agreement</name> <recipients> <RecipientInfo> <email> kowalski0123@gmail.com </email> <role>SIGNER</role> </RecipientInfo> </recipients> <reminderFrequency>NEVER</reminderFrequency> <signatureFlow>SENDER_SIGNATURE_NOT_REQUIRED</signatureFlow> <signatureType>ESIGN</signatureType> </documentCreationInfo> </sendDocument>
source share