Kc_idp_hint is not redirecting to the idp url

I have created a Identity provider(oidc) using Keycloak admin rest api and it was created successfully. I am passing ‘kc_idp_hint’ as a query string to redirect to the newly created idp url. But it’s not redirecting.

I have created a idp using keycloak admin console, But this time ‘kc_idp_hint’ is working as expected.

I have verified both idps (created via rest api and admin console). The settings are same.
Am I missing anything. Please advise.