
Comprehensive Detailed ExplanationYou’re analyzing a PDF (Test.pdf) that “contains tabular data.” In Azure AI Document Intelligence, the Layout prebuilt model is the right choice when your primary goal is to extract document structure such as tables, lines, words, selection marks, and paragraphs. Microsoft’s documentation clearly states that the Layout model “extracts text, tables, selection marks, and document structure,” which is exactly what you need for tabular content. Microsoft Learn
While the General document (prebuilt-document) model can also return tables, it is intended for broader extraction (including key-value pairs, entities, etc.). For a document whose key requirement is table extraction, Microsoft guidance recommends starting with Layout for structure-first scenarios.
For authentication in the REST call, the correct header to pass your resource key is Ocp-Apim-Subscription-Key. This is explicitly shown in the official REST API reference for the Analyze Document operation under Security (Type: apiKey, In: header). Microsoft Learn
Putting it together, the command shape is:
curl -v -i POST "{endpoint}/formrecognizer/documentModels/prebuilt-layout:analyze?api-version=2023-07-31" \
-H "Content-Type: application/json" \
-H "Ocp-Apim-Subscription-Key: {yourkey}" \
--data-ascii "{\"urlSource\": \"test.pdf\"}"
This uses a single analyze call to the prebuilt-layout model to extract the tables and authenticates with the Ocp-Apim-Subscription-Key header—matching the two selections in the answer area. The model matrix and overview pages also confirm Layout supports tables. Microsoft Learn
Document layout analysis (Layout model) – capabilities include extracting tables, text, selection marks, and structure. Microsoft Learn
Choose the best Document Intelligence model – guidance on when to use Layout (structure-first; tables). Microsoft Learn
General document (prebuilt-document) model – broader extraction including key-value pairs and tables. Microsoft Learn
Model overview / matrix – shows Layout supports Tables. Microsoft Learn
Analyze Document (REST API) – Ocp-Apim-Subscription-Key header for authentication. Microsoft Learn
References (Microsoft Documentation)=========================