"Can't authenticate you" error when trying to run a DigitalOcean API command

Posted February 2, 2018 10k views
APIUbuntu 16.04

I tried to run this command for rebuilding my droplet:

curl -X POST "" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer MY_API_TOKEN" \
-d '{"type":"rebuild","image":"ubuntu-16-04-x64"}' 

Note I used MYDROPLETID, taken from my
Note I used MYAPITOKEN (read and write), taken from

I’d like to know what’s bad with my command? I might missed something aside of droplet-ID and API-token.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers

Javier from the DO support team helped me with this. I’ll now quote his response:

I appreciate you contacting us with this issue. Sorry to hear about this case. Currently, the “Can’t authenticate you” error specifically is with the failure to accept the token being passed in.

The format is correct here, so the only thing I can think of is either the key is missing or something has caused the key to be expired.

Indeed, like Javier said, the problem was with the API token. I created a new token and then the operation succeeded.

Show answer This answer has been marked as resolved by Charlchadd.