When using "GoogleSpeech" in SpeechSynthesize for the first time, a window opens asking for the API key. I entered what I thought was my API key and checked the box to save the key. However, I used the wrong key.

Now I get the error message

"SpeechSynthesize::apierr: The service returned the following error message: API key not valid. Please pass a valid API key.."

whenever trying to use GoogleSpeech.

This makes sense, but I cannot determine how to delete that bad, stored API key. I've done some spelunking in GoogleSpeech.m, and the debugger shows it obtains the bad key at some point. However, I can't determine where it might be stored.

I have also messed around with PermissionsKey(s), DeletePermissionsKey, and SystemCredentialKeys but still cannot delete the bad key.

  • $\begingroup$ Try running SystemCredentialKeys[All]. If the API key for Google Speech is listed, then Unset[SystemCredential["nameOfKey"]] should clear it. A more brutal approach would be to run Unset@*SystemCredential /@ SystemCredentialKeys[All]; and get rid of all saved system credentials, but that may be overkill. $\endgroup$
    – MarcoB
    Feb 28 at 16:57

1 Answer 1


You can retrieve your saved service connection to Google Speech with

(* Use ServiceConnect to load ServiceConnections` *)

(* {ServiceObject["GoogleSpeech", 
    "ID" -> "connection-5ba85e29a494c940d913da46b18c210b"]} *)

Now simply delete this connection with:


At your next SpeechSynthesize, you will be asked for a new API key.

Note that, as suggested in the WolframConnector dialog (You can save connection to your cloud account ...), these credentials are not stored under SystemCredentialKeys, but in the Cloud. You can retrieve it with

Import[CloudObject["connections/services/GoogleSpeech"], "RawJSON"]

Because the authentication is performed via OAuth, it's not the initial API Key that is stored, but another token that was retrieved during the authentication.

  • $\begingroup$ This looks exactly like what I need, and Names["ServiceConnections"] gives {"ServiceConnectionsDeleteConnection", "ServiceConnectionsSavedConnections", "ServiceConnectionsServiceConnections"}. However, ServiceConnectionsSavedConnections["GoogleSpeech"] just returns ServiceConnectionsSavedConnections["GoogleSpeech"], and the same for DeleteConnection. $\endgroup$
    – EricMock
    Feb 28 at 21:28
  • $\begingroup$ Ah, sorry, ServiceConnections is not automatically loaded, so just evaluate one ServiceConnect["GoogleSpeech"] in the beginning :) $\endgroup$
    – Domen
    Feb 29 at 10:53
  • $\begingroup$ I figured there was a Needs or something needed. Thank you so much for the help. $\endgroup$
    – EricMock
    Feb 29 at 15:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.