Your subscription key is working just fine. Looks like you are specifying endpoint for global (non-regional) instead of 'westeurope' region. Your request should include the following headers:
curl --location --request POST 'https://api-eur.cognitive.microsofttranslator.com/translate?api-version=3.0&to=es' \
--header 'Ocp-Apim-Subscription-Key: xxxxxxxxxxxxxxxxxxxxxxxxxxx' \
--header 'Content-Type: application/json' \
--header 'Ocp-Apim-Subscription-Region: westeurope' \
--data-raw '[{'\''Text'\'':'\''Hello, what is your name?'\''}]'
You can also use a tool like postman to confirm. Hope this helps.