Curl command reading state to a file

curl -X GET -H ‘Content-Type: application/json’ ‘http://my-ip:8123/api/states/aeon_labs_dsb09104_home_energy_meter_energy_3?api_password=token’ -o /config/tmp/energybaseline.txt"

I get a 403 FORBIDDEN error written to the file energybaseline.txt
Where PASSWORD is I am using the raw token from long live token.

Did lot o reading and tried lots o variations of the above curl with the same result.
I call the curl from a script. which is called from an automation.
that all goes fine I Just get 403 forbidden written to the file.

Thanks in advance for any help…

Have you whitelisted the directory?

Yup… I did… I also have other automatons that access that dir and they work fine… After I whitelisted them. Just can’t get the curl to work

Sorry, didn’t read exactly.

Here are multiple examples of the curl command with the bearer token.

So I figured it out… I was missing the Authorization: Bearer and token and the url was asking for the wrong sensor… I dig the curl stuff but it gets confusing…
Thanks for the input.