In some cases, when using the API to retrieve production files it is possible that the file may not yet be available as it is stlll being generated by eDocBuilder when the API request is executed. One method to avoid this would be to add a wait time before the request is performed; however, this may not always be effective.
The best approach to ensure that the attempt to pull the production file only when it is available would be to use a "webhook". You can configure a webhook so that Pressero would notify your system when production files are ready and then you can perform an API request to retrieve the file. The specific webhook for this would be "Order Item Files Generated".
Using this option would mean that you would not have to wait for a static period of time and orders would be processed as soon as files are ready.