404 Response from Security service API request for bearer token

I have some python code that is pulling data from XProtect servers in our environment for the purposes of some required video data retention compliance reporting.

I am using Python 13.3.5 and the Milestone REST API, using the sample code modules (api_gateway.py and identity_provider.py) provided at https://github.com/milestonesys/mipsdk-samples-protocol/tree/main/RestfulCommunicationPython [github.com]

My application works fine on most of the management servers that I have tested, however there are two servers, running 2022R1, 2022R2 and 2022R3 that return 404 Errors when calling the Identity API to get a bearer access token. I have tested with both the legacy “/API/IDP/connect/token” path and the new (since 2022R2) “/Identity/connect/token" path and both provide the same responses, such as:

Error from XXXXXX New URL: 404

404 - File or directory not found.

The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable.

The code currently works on versions 2023R2, 2024R2, 2025R2, and doesn’t work on some servers running 2022R1, 2022R2, 2022R3

Servicers have been confirmed running and recently restarted.

Does anyone have any ideas where to look next to troubleshoot this?

Try to replace “/API/IDP/connect/token” with “/IDP/connect/token”. We have a theory this was added to the API around the time you indicate.

PS. We were confused with your mention of “/Identity”, we don’t think that is in the API.

That worked. When I remove the “/Identity” and replaced with “/IDP” it works. I am sure that I got the reference from either a search within Milestone documentation or a general internet search. Thank you for the help.