Unable access port 6869

when i run curl -X POST --header ‘Content-Type: application/json’ --header ‘Accept: application/json’ -d ‘MyApiKey’ ‘http://localhost:6869/utils/hash/secure’ on the server but i keep getting connection refused to open. even after opening the port

Check:
cat /etc/hosts

You should have localhost here
127.0.0.1 localhost alias1 alias2…

sorry i didn’t get that. will it activate the port?

No, it will not activate the port. You said the port is open and my guess is your system just does not know that ‘localhost’ is 127.0.0.1

okay. how do i make it work

please show the output of command:
sudo cat /etc/hosts

127.0.0.1 localhost

The following lines are desirable for IPv6 capable hosts

::1 ip6-localhost ip6-loopback

fe00::0 ip6-localnet

ff00::0 ip6-mcastprefix

ff02::1 ip6-allnodes

ff02::2 ip6-allrouters

ff02::3 ip6-allhosts

Okay, my guess was wrong. Try to put your real IP address instead of localhost in the command you trying to execute
http://PUT.YOUR.IP.HERE:6869/utils/hash/secure