Document Intelligence AI returns 404

sami jan 75 Reputation points
2024-01-27T18:27:52.98+00:00

Hi I have created a document intelligence endpoint and I can see it in Azure Portal but I can't call an SDK API with that - https://document-intelligence-sami.cognitiveservices.azure.com/ Screenshot 2024-01-26 at 2.27.05 PM

It gives me a 404 Resource Not Found error The code:

document_intelligence_client = DocumentIntelligenceClient(    endpoint=endpoint, credential=AzureKeyCredential(key))

with open(path_to_sample_documents, "rb") as f:    
     poller = document_intelligence_client.begin_analyze_document(        "prebuilt-layout", analyze_request=f, content_type="application/octet-stream"    )

In the Studio if I specify the "Service resource "resource" it works fine Screenshot 2024-01-26 at 2.28.10 PM

But if I explicitly pass in the API key and URL, it gives me a 404 here too Screenshot 2024-01-27 at 11.32.40 PM

I did have an issue with the "Default Directory" - do I need to specify in the API call as well?

Azure AI Document Intelligence
Azure AI Document Intelligence
An Azure service that turns documents into usable data. Previously known as Azure Form Recognizer.
1,203 questions
{count} votes

2 answers

Sort by: Most helpful
  1. sami jan 75 Reputation points
    2024-01-29T10:45:24.0033333+00:00

    thanks VasaviLankipalle-MSFT - but that wasn't the issue I had 3 tenants in azure and 2 of them were named "default directory" - i removed the 2 that were redundant and it worked The API looks up the tenants and tries to find the key in the first "default directory" I guess - I had the same problem in Studio where I had to set the tenant every time so the solution is to have only 1 tenant in your azure account for now...

    1 person found this answer helpful.
    0 comments No comments

  2. VasaviLankipalle-MSFT 11,286 Reputation points
    2024-01-31T01:23:53.6133333+00:00

    Hello @sami jan , I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this! Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to "Accept " the answer.

    Issue: Document Intelligence AI returns 404 Resource Not Found error

    Solution:

    Try to check the tenants if you have multiple. In this issue they had 3 tenants in azure and 2 of them were named "default directory" - removed the 2 that were redundant, and it worked. Looks like the API looks up the tenants and tries to find the key in the first "default directory.

    Other possibilities for this error are, since Public preview version 2023-10-31-preview is currently only available in the following Azure regions:

    • East US
    • West US2
    • West Europe

    The 404 Resource Not Found error occur if you are trying to access the 2023-10-31-preview version of the Document Intelligence API from a region other than East US, West US2, or West Europe.

    If you have any other questions or are still running into more issues, please let me know.

    Thank you again for your time and patience throughout this issue.

    Regards,
    Vasavi

    Please remember to "Accept Answer" if any answer/reply helped, so that others in the community facing similar issues can easily find the solution.

    0 comments No comments