[{"data":1,"prerenderedAt":838},["ShallowReactive",2],{"navigation":3,"/pdfrest-api-toolkit-container/api-polling/":135,"/pdfrest-api-toolkit-container/api-polling/-surround":833},[4,14,37,77,100,109,126],{"title":5,"path":6,"stem":7,"children":8,"icon":11,"fields":12},"Overview","/overview","0.overview/index",[9],{"title":10,"path":6,"stem":7},"pdfRest API Documentation","pdfrest:pdf-toolkit-self-hosted",{"hidden":13},true,{"title":15,"icon":16,"path":17,"stem":18,"children":19,"page":36},"Cloud","vscode-icons:file-type-pdf2","/pdfrest-api-toolkit-cloud","1.pdfrest-api-toolkit-cloud",[20,24,28,32],{"title":21,"path":22,"stem":23},"Getting Started","/pdfrest-api-toolkit-cloud/getting-started","1.pdfrest-api-toolkit-cloud/1.getting-started",{"title":25,"path":26,"stem":27},"Frequently Asked Questions","/pdfrest-api-toolkit-cloud/frequently-asked-questions","1.pdfrest-api-toolkit-cloud/2.frequently-asked-questions",{"title":29,"path":30,"stem":31},"API Polling","/pdfrest-api-toolkit-cloud/api-polling","1.pdfrest-api-toolkit-cloud/3.api-polling",{"title":33,"path":34,"stem":35},"Custom Compression Profiles","/pdfrest-api-toolkit-cloud/custom-compression-profiles","1.pdfrest-api-toolkit-cloud/4.custom-compression-profiles",false,{"title":38,"icon":39,"path":40,"stem":41,"children":42,"page":36},"Container","vscode-icons:file-type-docker2","/pdfrest-api-toolkit-container","2.pdfrest-api-toolkit-container",[43,46,50,54,58,62,66,70,74],{"title":21,"path":44,"stem":45},"/pdfrest-api-toolkit-container/getting-started","2.pdfrest-api-toolkit-container/1.getting-started",{"title":47,"path":48,"stem":49},"Deploy the Container","/pdfrest-api-toolkit-container/deploy-container-api","2.pdfrest-api-toolkit-container/2.deploy-container-api",{"title":51,"path":52,"stem":53},"Configure pdfRest API Toolkit Container","/pdfrest-api-toolkit-container/configure-container-api","2.pdfrest-api-toolkit-container/3.configure-container-api",{"title":55,"path":56,"stem":57},"Storage Guide","/pdfrest-api-toolkit-container/storage-guide","2.pdfrest-api-toolkit-container/4.storage-guide",{"title":59,"path":60,"stem":61},"Custom Compression Profiles in Container","/pdfrest-api-toolkit-container/custom-compression-profiles","2.pdfrest-api-toolkit-container/5.custom-compression-profiles",{"title":63,"path":64,"stem":65},"Add New Languages for OCR","/pdfrest-api-toolkit-container/adding-new-languages-for-ocr","2.pdfrest-api-toolkit-container/6.adding-new-languages-for-ocr",{"title":67,"path":68,"stem":69},"Logging","/pdfrest-api-toolkit-container/logging","2.pdfrest-api-toolkit-container/6.logging",{"title":71,"path":72,"stem":73},"Monitoring","/pdfrest-api-toolkit-container/monitoring","2.pdfrest-api-toolkit-container/7.monitoring",{"title":29,"path":75,"stem":76},"/pdfrest-api-toolkit-container/api-polling","2.pdfrest-api-toolkit-container/8.api-polling",{"title":78,"icon":79,"path":80,"stem":81,"children":82,"page":36},"On AWS","vscode-icons:file-type-aws","/pdfrest-api-toolkit-on-aws","3.pdfrest-api-toolkit-on-aws",[83,86,90,94,97],{"title":21,"path":84,"stem":85},"/pdfrest-api-toolkit-on-aws/getting-started","3.pdfrest-api-toolkit-on-aws/1.getting-started",{"title":87,"path":88,"stem":89},"Deploy on AWS","/pdfrest-api-toolkit-on-aws/deploy-on-aws","3.pdfrest-api-toolkit-on-aws/2.deploy-on-aws",{"title":91,"path":92,"stem":93},"Configure AWS Deployment","/pdfrest-api-toolkit-on-aws/configure-aws-deployment","3.pdfrest-api-toolkit-on-aws/3.configure-aws-deployment",{"title":25,"path":95,"stem":96},"/pdfrest-api-toolkit-on-aws/faq","3.pdfrest-api-toolkit-on-aws/4.faq",{"title":33,"path":98,"stem":99},"/pdfrest-api-toolkit-on-aws/custom-compression-profiles","3.pdfrest-api-toolkit-on-aws/5.custom-compression-profiles",{"title":101,"icon":102,"path":103,"stem":104,"children":105,"page":36},"API Reference Guides","vscode-icons:file-type-source","/api-reference-guides","4.api-reference-guides",[106],{"title":101,"path":107,"stem":108},"/api-reference-guides/directory","4.api-reference-guides/1.directory",{"title":110,"fields":111,"path":112,"stem":113,"children":114,"page":36},"Additional Guides",{"hidden":13},"/additional-guides","5.additional-guides",[115,118,122],{"title":110,"path":116,"stem":117},"/additional-guides/directory","5.additional-guides/1.directory",{"title":119,"path":120,"stem":121},"Font List","/additional-guides/font-list","5.additional-guides/2.font-list",{"title":123,"path":124,"stem":125},"Acknowledgements","/additional-guides/acknowledgements","5.additional-guides/acknowledgements",{"title":127,"path":128,"stem":129,"children":130,"icon":132,"sidebar":133,"collapse":36,"toc":13},"Release Notes","/release-notes","6.release-notes/1.index",[131],{"title":127,"path":128,"stem":129},"vscode-icons:file-type-git",{"style":134},"tree",{"id":136,"title":29,"body":137,"description":826,"extension":827,"head":828,"links":828,"meta":829,"navigation":13,"ogImage":828,"path":75,"robots":828,"schemaOrg":828,"seo":830,"sitemap":831,"stem":76,"__hash__":832},"docs/2.pdfrest-api-toolkit-container/8.api-polling.md",{"type":138,"value":139,"toc":820},"minimark",[140,145,158,166,170,173,196,202,226,230,763,767,799,806,809,816],[141,142,144],"h2",{"id":143},"introduction","Introduction",[146,147,148,149,153,154,157],"p",{},"API Polling repeatedly checks the status of a long-running process by making periodic requests to an endpoint. In pdfRest, send a processing request with the ",[150,151,152],"code",{},"Response-Type: requestId"," header, then use ",[150,155,156],{},"/request-status/{requestId}"," to check its progress and retrieve the completed response.",[159,160,161,162,165],"note",{},"API Polling support was added in pdfRest API Toolkit Container version ",[150,163,164],{},"2.58.0",". Older Container releases do not support API Polling.",[141,167,169],{"id":168},"prerequisites","Prerequisites",[146,171,172],{},"Before you start, ensure you have:",[174,175,176,186,193],"ul",{},[177,178,179,180,185],"li",{},"A running ",[181,182,184],"a",{"href":183},"/pdfrest-api-toolkit-container/deploy-container-api/","pdfRest API Toolkit Container"," with a configured License Key.",[177,187,188,189,192],{},"A document to process, such as a local Word file named ",[150,190,191],{},"document.docx",".",[177,194,195],{},"Basic knowledge of HTTP requests and responses.",[146,197,198,199,192],{},"Container requests do not require a client API key. Configure your License Key when starting the container, as described in ",[181,200,21],{"href":201},"/pdfrest-api-toolkit-container/getting-started/",[146,203,204,205,208,209,212,213,217,218,221,222,192],{},"The examples use ",[150,206,207],{},"http://localhost",", matching host port ",[150,210,211],{},"80"," in the ",[181,214,216],{"href":215},"/pdfrest-api-toolkit-container/deploy-container-api/#docker-compose","Docker Compose deployment example",". Replace this address with your deployed Container's base URL. Configure ",[150,219,220],{},"PDFREST_SERVER_DOMAIN"," with the externally reachable base URL so returned resource URLs use the correct address. See ",[181,223,225],{"href":224},"/pdfrest-api-toolkit-container/configure-container-api/#environment-variables","Configure Container",[141,227,229],{"id":228},"step-by-step-guide","Step-by-step guide",[231,232,234,239,249,316,327,385,391,395,401,426,435,484,494,498,504,599,602,712,722,726,732,757],"steps",{"level":233},"3",[235,236,238],"h3",{"id":237},"make-the-initial-request","Make the initial request",[146,240,241,242,244,245,248],{},"Send a document to a processing endpoint with ",[150,243,152],{},". For example, convert a Word document to PDF with ",[150,246,247],{},"/pdf",":",[250,251,256],"pre",{"className":252,"code":253,"language":254,"meta":255,"style":255},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","curl --request POST \"http://localhost/pdf\" \\\n  --header \"Response-Type: requestId\" \\\n  --form \"file=@document.docx\"\n","bash","",[150,257,258,288,302],{"__ignoreMap":255},[259,260,263,267,271,274,278,281,284],"span",{"class":261,"line":262},"line",1,[259,264,266],{"class":265},"sBMFI","curl",[259,268,270],{"class":269},"sfazB"," --request",[259,272,273],{"class":269}," POST",[259,275,277],{"class":276},"sMK4o"," \"",[259,279,280],{"class":269},"http://localhost/pdf",[259,282,283],{"class":276},"\"",[259,285,287],{"class":286},"sTEyZ"," \\\n",[259,289,291,294,296,298,300],{"class":261,"line":290},2,[259,292,293],{"class":269},"  --header",[259,295,277],{"class":276},[259,297,152],{"class":269},[259,299,283],{"class":276},[259,301,287],{"class":286},[259,303,305,308,310,313],{"class":261,"line":304},3,[259,306,307],{"class":269},"  --form",[259,309,277],{"class":276},[259,311,312],{"class":269},"file=@document.docx",[259,314,315],{"class":276},"\"\n",[146,317,318,319,322,323,326],{},"The API returns HTTP ",[150,320,321],{},"200"," with a ",[150,324,325],{},"requestId"," and a message instead of waiting for the final result. An example response is:",[250,328,332],{"className":329,"code":330,"language":331,"meta":255,"style":255},"language-json shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","{\n  \"requestId\": \"11111111-1111-4111-8111-111111111111\",\n  \"message\": \"Request received and is being processed.\"\n}\n","json",[150,333,334,339,361,379],{"__ignoreMap":255},[259,335,336],{"class":261,"line":262},[259,337,338],{"class":276},"{\n",[259,340,341,344,347,349,351,353,356,358],{"class":261,"line":290},[259,342,343],{"class":276},"  \"",[259,345,325],{"class":346},"spNyl",[259,348,283],{"class":276},[259,350,248],{"class":276},[259,352,277],{"class":276},[259,354,355],{"class":269},"11111111-1111-4111-8111-111111111111",[259,357,283],{"class":276},[259,359,360],{"class":276},",\n",[259,362,363,365,368,370,372,374,377],{"class":261,"line":304},[259,364,343],{"class":276},[259,366,367],{"class":346},"message",[259,369,283],{"class":276},[259,371,248],{"class":276},[259,373,277],{"class":276},[259,375,376],{"class":269},"Request received and is being processed.",[259,378,315],{"class":276},[259,380,382],{"class":261,"line":381},4,[259,383,384],{"class":276},"}\n",[146,386,387,388,390],{},"Save the returned ",[150,389,325],{}," for polling. This identifies the request, not an input or output file.",[235,392,394],{"id":393},"poll-the-request-status-endpoint","Poll the /request-status endpoint",[146,396,397,398,400],{},"Use the returned ",[150,399,325],{}," in the polling URL. Replace the example ID below with your request's ID:",[250,402,404],{"className":252,"code":403,"language":254,"meta":255,"style":255},"curl --request GET \\\n  \"http://localhost/request-status/11111111-1111-4111-8111-111111111111\"\n",[150,405,406,417],{"__ignoreMap":255},[259,407,408,410,412,415],{"class":261,"line":262},[259,409,266],{"class":265},[259,411,270],{"class":269},[259,413,414],{"class":269}," GET",[259,416,287],{"class":286},[259,418,419,421,424],{"class":261,"line":290},[259,420,343],{"class":276},[259,422,423],{"class":269},"http://localhost/request-status/11111111-1111-4111-8111-111111111111",[259,425,315],{"class":276},[146,427,428,429,431,432,248],{},"While processing continues, the API returns HTTP ",[150,430,321],{}," with ",[150,433,434],{},"status: \"pending\"",[250,436,438],{"className":329,"code":437,"language":331,"meta":255,"style":255},"{\n  \"status\": \"pending\",\n  \"requestId\": \"11111111-1111-4111-8111-111111111111\"\n}\n",[150,439,440,444,464,480],{"__ignoreMap":255},[259,441,442],{"class":261,"line":262},[259,443,338],{"class":276},[259,445,446,448,451,453,455,457,460,462],{"class":261,"line":290},[259,447,343],{"class":276},[259,449,450],{"class":346},"status",[259,452,283],{"class":276},[259,454,248],{"class":276},[259,456,277],{"class":276},[259,458,459],{"class":269},"pending",[259,461,283],{"class":276},[259,463,360],{"class":276},[259,465,466,468,470,472,474,476,478],{"class":261,"line":304},[259,467,343],{"class":276},[259,469,325],{"class":346},[259,471,283],{"class":276},[259,473,248],{"class":276},[259,475,277],{"class":276},[259,477,355],{"class":269},[259,479,315],{"class":276},[259,481,482],{"class":261,"line":381},[259,483,384],{"class":276},[146,485,486,487,489,490,493],{},"Wait before polling again, for example five seconds. Continue until ",[150,488,450],{}," is ",[150,491,492],{},"completed"," or an error occurs.",[235,495,497],{"id":496},"understand-the-response","Understand the response",[146,499,500,501,503],{},"Check the JSON ",[150,502,450],{}," field as well as the HTTP status code:",[505,506,507,523],"table",{},[508,509,510],"thead",{},[511,512,513,517,520],"tr",{},[514,515,516],"th",{},"Response",[514,518,519],{},"Meaning",[514,521,522],{},"Next action",[524,525,526,543,558,573,586],"tbody",{},[511,527,528,537,540],{},[529,530,531,532,534,535],"td",{},"HTTP ",[150,533,321],{},", ",[150,536,434],{},[529,538,539],{},"Processing has not completed.",[529,541,542],{},"Wait, then poll again.",[511,544,545,552,555],{},[529,546,531,547,534,549],{},[150,548,321],{},[150,550,551],{},"status: \"completed\"",[529,553,554],{},"The original request has finished.",[529,556,557],{},"Inspect the returned payload for results or an error.",[511,559,560,565,568],{},[529,561,531,562],{},[150,563,564],{},"400",[529,566,567],{},"The request ID is invalid.",[529,569,570,571,192],{},"Check the submitted ",[150,572,325],{},[511,574,575,580,583],{},[529,576,531,577],{},[150,578,579],{},"404",[529,581,582],{},"The request status record was not found.",[529,584,585],{},"Check the ID, storage configuration, and retention settings.",[511,587,588,593,596],{},[529,589,531,590],{},[150,591,592],{},"500",[529,594,595],{},"The polling request encountered a server error.",[529,597,598],{},"Inspect the error response and Container logs.",[146,600,601],{},"A completed response includes the original processing response. For a successful conversion to PDF, it can look like this:",[250,603,605],{"className":329,"code":604,"language":331,"meta":255,"style":255},"{\n  \"status\": \"completed\",\n  \"requestId\": \"11111111-1111-4111-8111-111111111111\",\n  \"outputUrl\": \"http://localhost/resource/22222222-2222-4222-8222-222222222222?format=file\",\n  \"outputId\": \"22222222-2222-4222-8222-222222222222\",\n  \"inputId\": \"33333333-3333-4333-8333-333333333333\"\n}\n",[150,606,607,611,629,647,667,688,707],{"__ignoreMap":255},[259,608,609],{"class":261,"line":262},[259,610,338],{"class":276},[259,612,613,615,617,619,621,623,625,627],{"class":261,"line":290},[259,614,343],{"class":276},[259,616,450],{"class":346},[259,618,283],{"class":276},[259,620,248],{"class":276},[259,622,277],{"class":276},[259,624,492],{"class":269},[259,626,283],{"class":276},[259,628,360],{"class":276},[259,630,631,633,635,637,639,641,643,645],{"class":261,"line":304},[259,632,343],{"class":276},[259,634,325],{"class":346},[259,636,283],{"class":276},[259,638,248],{"class":276},[259,640,277],{"class":276},[259,642,355],{"class":269},[259,644,283],{"class":276},[259,646,360],{"class":276},[259,648,649,651,654,656,658,660,663,665],{"class":261,"line":381},[259,650,343],{"class":276},[259,652,653],{"class":346},"outputUrl",[259,655,283],{"class":276},[259,657,248],{"class":276},[259,659,277],{"class":276},[259,661,662],{"class":269},"http://localhost/resource/22222222-2222-4222-8222-222222222222?format=file",[259,664,283],{"class":276},[259,666,360],{"class":276},[259,668,670,672,675,677,679,681,684,686],{"class":261,"line":669},5,[259,671,343],{"class":276},[259,673,674],{"class":346},"outputId",[259,676,283],{"class":276},[259,678,248],{"class":276},[259,680,277],{"class":276},[259,682,683],{"class":269},"22222222-2222-4222-8222-222222222222",[259,685,283],{"class":276},[259,687,360],{"class":276},[259,689,691,693,696,698,700,702,705],{"class":261,"line":690},6,[259,692,343],{"class":276},[259,694,695],{"class":346},"inputId",[259,697,283],{"class":276},[259,699,248],{"class":276},[259,701,277],{"class":276},[259,703,704],{"class":269},"33333333-3333-4333-8333-333333333333",[259,706,315],{"class":276},[259,708,710],{"class":261,"line":709},7,[259,711,384],{"class":276},[146,713,714,715,717,718,721],{},"A ",[150,716,492],{}," status does not guarantee successful processing. Check for an ",[150,719,720],{},"error"," field before using the output.",[235,723,725],{"id":724},"retrieve-the-final-data","Retrieve the final data",[146,727,728,729,731],{},"After a successful conversion, download the file from the returned ",[150,730,653],{},". For the example above:",[250,733,735],{"className":252,"code":734,"language":254,"meta":255,"style":255},"curl --output converted-document.pdf \\\n  \"http://localhost/resource/22222222-2222-4222-8222-222222222222?format=file\"\n",[150,736,737,749],{"__ignoreMap":255},[259,738,739,741,744,747],{"class":261,"line":262},[259,740,266],{"class":265},[259,742,743],{"class":269}," --output",[259,745,746],{"class":269}," converted-document.pdf",[259,748,287],{"class":286},[259,750,751,753,755],{"class":261,"line":290},[259,752,343],{"class":276},[259,754,662],{"class":269},[259,756,315],{"class":276},[146,758,759,760,192],{},"This saves the processed PDF as ",[150,761,762],{},"converted-document.pdf",[141,764,766],{"id":765},"best-practices","Best practices",[174,768,769,776,782,788],{},[177,770,771,775],{},[772,773,774],"strong",{},"Polling interval",": Start with an interval such as five seconds to avoid excessive requests.",[177,777,778,781],{},[772,779,780],{},"Error handling",": Handle HTTP errors and processing errors in completed responses.",[177,783,784,787],{},[772,785,786],{},"Timeouts",": Set request timeouts and an overall polling deadline to prevent indefinite waiting. Processing does not automatically resume after a container stops.",[177,789,790,793,794,798],{},[772,791,792],{},"Retention",": Retrieve results before they expire under your ",[181,795,797],{"href":796},"/pdfrest-api-toolkit-container/storage-guide/#file-lifecycle-policy","file lifecycle policy",". Polling does not extend retention.",[159,800,801,802,192],{},"API Polling is supported across multiple Containers when those Containers are configured for ",[181,803,805],{"href":804},"/pdfrest-api-toolkit-container/storage-guide/#shared-storage-for-any-number-of-containers","Shared Storage",[159,807,808],{},"API Polling on Container uses JSON status files and does not require any database configuration.",[146,810,811,812,192],{},"For endpoint parameters and response schemas, see the ",[181,813,815],{"href":814},"/pdfrest-api-toolkit-container/api-reference-guide/","Container API Reference Guide",[817,818,819],"style",{},"html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}",{"title":255,"searchDepth":262,"depth":290,"links":821},[822,823,824,825],{"id":143,"depth":290,"text":144},{"id":168,"depth":290,"text":169},{"id":228,"depth":290,"text":229},{"id":765,"depth":290,"text":766},"Use API Polling to monitor asynchronous requests in the pdfRest API Toolkit Container and retrieve completed results.","md",null,{},{"title":29,"description":826},{"loc":75},"_-CXA2MejkYFPRjuMmZuXLHdw0o3F4I0JhHQe890P1Y",[834,836],{"title":71,"path":72,"stem":73,"description":835,"children":-1},"Use the up, diagnostics, and targethealth endpoints to monitor pdfRest API Toolkit Container health and available processing capacity.",{"title":21,"path":84,"stem":85,"description":837,"children":-1},"Get started quickly with the pdfRest API Toolkit on AWS to integrate PDF processing into your projects.",1793729811506]