Hi Paweł L,
The error behavior you're observing receiving an InternalServerError for a specific document along with a 401 Unauthorized response when querying the result via Postman suggests that there may be multiple issues occurring in sequence. The InternalServerError typically occurs during the document processing phase when something unexpected fails in the backend, often due to malformed content, unsupported document structure, or internal limits being exceeded. Since other documents process correctly and this issue consistently occurs with a specific file, it likely points to a problem intrinsic to that file (e.g., corrupted PDF metadata, excessive size, or an edge case that triggers a failure in the prebuilt-invoice model).
However, the 401 Unauthorized error you’re now encountering when trying to retrieve the results via Postman is a separate issue. This indicates that the request is being rejected due to an invalid subscription key or a mismatch between the endpoint region and the resource's actual deployment region. This could happen if the endpoint URL used in the GET request does not match the Azure region where the Document Intelligence resource is deployed (e.g., using westeurope instead of eastus). It’s also important to confirm that the same key used during submission is being used during retrieval, and that it is passed in the request header using Ocp-Apim-Subscription-Key.
As a workaround, we recommend confirming the exact region and endpoint of your Document Intelligence resource in the Azure portal under "Keys and Endpoint" and ensuring your API requests both for submission and result retrieval—use that same regional endpoint and subscription key. For the document that triggered the internal server error, try converting or simplifying the file and reprocess it using either the same or a different model like prebuilt-document to verify whether the issue is model-specific.