How to populate form fields from the api

How to populate form fields from the api

I have a document that has text tags i.e {{Textfield:Recipient1*:totalMontlyRent}}. Is there a way I can populate this field from the API so that the resultant document is dynamic?

Please, this is urgent. 
Thanks