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
async
parameter and set it totrue
. 2 Enableasync
mode by settingasync
input parameter totrue
. This will tell API method to create background job and immediately return unique id of this new background job injobId
property in the output along with the finalurl
. 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
/job/check
withjobId
parameter set to the jobId value from the previous step. Repeat and check until it returnsstatus
assuccess
. Recommended interval for checking is 1-2 seconds for small documents and 10-15 seconds for large documents.