I can't find documentation for the keycloak API

I am working on something at work that already uses keycloak and I need to modify it, but I don’t seem to be able to find any documentation of the API. I am using the REST API, but something else.

The existing request is like this:
Body:

{
        grant_type: "password",
        client_id: user.config,
        username: user.driverId,
        password: user.password,
}

URL: ${baseUrl}/realms/${config}/protocol/openid-connect/token
And passing "Content-Type": "application/x-www-form-urlencoded" as a header.

Where do I find documentation for this part? Is there any? How can I find out how to modify this request?

Documentation for the admin REST API is here:
https://www.keycloak.org/docs-api/21.0.1/rest-api/index.html

The token request you are trying to make needs those pairs as post parameters, not as a JSON body. E.g. with curl:

curl -i --request POST $host/realms/$realm/protocol/openid-connect/token \
--header "Accept: application/json" \
--header "Content-Type: application/x-www-form-urlencoded" \
--data "grant_type=password&username=$user&password=$pass&client_id=$client"

Thank you for the reply!

One thing I don’t really understand from those documents is that the specific request you also posted here is nowhere in them, I can’t find it!

I need to change it to an OTP-based one, but I simply need docs that can direct me in the right direction!

Those endpoints are for Keycloak’s OpenID Connect implementation, not the API. You can find information on those endpoints here: Securing Applications and Services Guide