Invalid API Key Specified UiPathOCRInvalidApiKey

Invalid API key specified UiPathOCRInvalidApiKey.

Issue:

When attempting to use the UiPath Document OCR, the following error is given "Invalid API key specified UiPathOCRInvalidApiKey"

Troubleshooting:

  1. Check the API Key listed under AI Units (or Document Understanding pages if still on the Legacy License model) in the Cloud -> Admin -> License -> Robots & Services page. (If the organization was recently switched from the legacy license model (Robot Units) to the new license model (AI Units). A new API key may have been generated when the conversion took place.)
  2. Debug the process to validate that the API that is being used in the process for the Digitize document scope matches what is seen as listed in the Cloud -> Admin -> License -> Robots & Services page under AI Units (if on the new license model) or Document Understanding pages (if on the Legacy - AI Robots model).
    • If the UiPath Document OCR activity is failing inside the Digitize document scope, to check the API key, a log message can be placed just before the Digitize Document Scope and the same value that is being used for the API input of the UiPath Document OCR activity can be output for the log message. (Alternatively, just use the Locals panel in Studio to check the value while debugging) If the API key matches what is seen in the Robots & Services page as mentioned in the step above, please capture a screenshot of the log message/locals pannel where the api key is visible. (For security purposes, part of the API key can be redacted if desired.)
  3. Ensure that the correct endpoint is being used for the UiPath Document OCR activity. See a full list of valid UiPath Public Endpoints.
    • If the endpoint is a public ML Skill URL, load it in a web browser and confirm it returns HTTP 405 (Method not Allowed). This indicates healthy connectivity with the endpoint. If it doesn't load a 405, then contact your network team and let them know bi-directional communication between the robot host machine and the ML Skill URL is mandatory.
  4. After following the first two steps, if API key does match, but the issue is still occurring, try regenerating a new API key in the Cloud -> Admin -> License -> Robots & Services page for the AI Units or Document Understanding pages (depending on license model) and then update the key in the process.
    • Caution: By regenerating the API key, all processes using the old key would need to be updated. It is recommended to store the key in an asset in Orchestrator and the call the asset in the processes so the key only has to be changed in one location.

Next Steps:

After confirming the steps above, if the issue is still occurring, share the following with UiPath Product Support:

  1. Share the project files in a zipped folder. (xamls, project.json, etc) Note: if unable to share the project, share screenshots of the project's dependencies, and share screenshots of the properties panel for the Digitize Document Scope as well as the OCR Activity within the Document Scope. (Check the version of the dependencies being used)
  2. Share an example file that the issue can be replicated with
  3. If the issue is only occurring for some files, but not for others, also share a file that the issue is not occurring for
  4. Capture a Fiddler Trace while causing the error to occur: How To Use Fiddler To Debug An Issue ?.