The first question is of course: does XProc have enough functionality on board to, theoretically, do this? The answer to that is, fortunately, yes:
REST services can be called using the <p:http-request>
step (https://spec.xproc.org/master/head/steps/#c.http-request).
XProc has a set of “file steps” (https://spec.xproc.org/master/head/file/) that allow you to do things like inspecting/creating/deleting directories, write/read/delete all kinds of files, etc
And, of course, processing documents using XSLT can be done using the <p:xslt>
step (https://spec.xproc.org/master/head/steps/#c.xslt).
So, from a functional point of view, nothing stands in your way.