Call Rasa X Endpoint with password

How do i call an endpoint (e.g. /version) on a rasa x server, secured with a password?

First you call the auth endpoint, like this:

curl --location --request POST 'http://127.0.0.1:5002/api/auth' \
--data-raw '{"username": "me", "password": "98DpNcIqeTKa" }'

Which will return a token that you use in the subsequent calls.

curl --location --request POST 'http://127.0.0.1:5002/api/chat?environment=production' \
--header 'Authorization: Bearer <token>' \
--data-raw '{"sender":"postman", "message":"hi there"}'