Using Convert API it is simple as this HTTP request:
POST https://v2.convertapi.com/doc/to/pdf?Secret=XXX&File=http://example.com/myfile.doc
if file is accessible from the internet. If file is not accessible from the internet, Convert API supports many ways how to pass a file for conversion.