Problem connecting to the Hestia CP API

Hello, I am wanting to use the Hestia CP API to create users from an external application, but I always receive rejection from the server saying that I do not have permissions, I tried to use the administrator’s username and password, and also the KEY that I generated, but no method works, I always get the same error, as if I had authentication problems, or should I activate something specific?

Hello @Neytor,

Please, show the output of this command:

grep API /usr/local/hestia/conf/hestia.conf

How did you generated the key (v-generate-api-key)? How are you trying to call the API.

Cheers,
sahsanu

Hello @sahsanu , generate the key with this command:
v-generate-api-key

I’m trying to connect with Laravel, it just worked, but I had to put my IP in the allowed list, otherwise I put that in it didn’t work, now the command you told me shows the following:

I assume that the API_ALLOWED_IP appears, because I added it from the web panel.

Now my question is, should you always set an IP? If I try to access from another server, will I have to add it?

API_ALLOWED_IP=‘35.80.187.191’
API_SYSTEM=‘1’
API=‘yes’

I’m glad it finally works. Just one issue, you said that the error you received was:

But if the ip is not allowed, you should receive this message:

Error: IP is not allowed to connect with API

Yes, you must always add the ip of the external machine from which you want to use the api. If you want to allow all external ips, just add 0.0.0.0 to the list (it could be a security problem so use it at your own risk)

Cheers,
sahsanu

Thanks for the help, okay I will take your advice about allowing IPS, for now for development purposes I will keep it for everyone, then I will block it when I upload it, even though it is the best way to work with it, thanks for your time

1 Like