How to run a background job
We've designed a special
async mode that is available for almost all endpoints.
In this mode you can process large input files. It is recommended for use by default.
If your call takes more than
25 seconds then you need to run it as a background job that can work for up to 15-20 minutes and can process large documents and files.
When you set
async param to
true, your call returns
jobId param containing unique ID of your background job. Use
/job/check to read a background job status to find when your output file is ready for download.
Step by step:
- Add the
asyncparameter and set it to
true. 2 Enable
asyncmode by setting
asyncinput parameter to
true. This will tell API method to create background job and immediately return unique id of this new background job in
jobIdproperty in the output along with the final
url. Use this url to access the output file (if any) once the job is finished.
- Now check the status of that new background job using
jobIdparameter set to the jobId value from the previous step. Repeat and check until it returns
success. Recommended interval for checking is 1-2 seconds for small documents and 10-15 seconds for large documents.