Errors when trying to renew access-token RRS feed

  • Question

  • I have a PHP backend that retrieves and formats a languages drop-down. It also passes the access token back to JavaScript after setting a cookie that expires in 9 minutes. I am able to translate lots of text until the cookie expires at which time I call another PHP routine that attempts to retrieve a new access token, instead throws a couple of errors:

    ArgumentException: Invalid appId\u000d\u000aParameter name: appId : ID=3444.V2_Json.

    Translate.51C1099C"TranslateApiException: AppId is over the quota : ID=5107.V2_Json.Translate.524ADD89

    The quota error as I understand it means there was not enough elapsed time before requesting a new access token. This cannot be since at least nine minutes has passed. The first error also makes little sense since I am calling the exact same routines that successful GetLanguages method uses:

        public function GetAccessToken() {
            try {
                if (isset($_COOKIE['jQuery-Translator-OAuth-expiry'])) {
                    echo '';
                } else {
                    $auth = new AccessTokenAuthentication;
                    echo 'Bearer ' . $auth->authenticate(); // get new authentication token
                    // set cookie - authHeader expires after 10 minutes
                    setcookie("jQuery-Translator-OAuth-expiry","n/a",time() + 9 * 60);
            catch (Exception $e) {
                echo "Exception-renew-token: " . $e->getMessage() . PHP_EOL;

    The Ajax call to the translator (accessToken is a global) :

                    var url =
                        "http://api.microsofttranslator.com/V2/Ajax.svc/Translate" +
                        "?appId=" + encodeURIComponent(accessToken) +
                        "&from=" + encodeURIComponent(fromLang) +
                        "&to=" + encodeURIComponent(toLang) +
                        "&text=" + encodeURIComponent(text2xlat);

    $.ajax({ url: url, type:'post', success:function(data, status){

    // some code


    I would much appreciate any insights into this problem.

    Monday, February 1, 2016 10:08 PM

All replies

  • Hi Deje,

    the message "AppId is over the quota" means that you submitted more than ~40 million characters in one hour to the API. This quota is independent of the number of access tokens used.

    Let us know at the contact form at www.microsoft.com/translator if this is a hardship for you, and we can adjust the value.

    Chris Wendt
    Microsoft Translator

    Monday, February 1, 2016 10:25 PM
  • Thanks, but that cannot be the case. Here are my usage numbers:


    2,000,000 Characters/month


    1,339,977 Characters remaining

    Tuesday, February 2, 2016 2:19 AM
  • Hi Deje,

    "Invalid appId" means the access token is invalid or expired.

    "AppId is over the quota" means more than 40 million characters submitted to the API. This is the condition under which the exception is thrown. Not all characters count in billing, but all characters count in quota measurement.

    If you share your client ID, we can look up your consumption. If you want to do that privately, use the contact form on www.microsoft.com/translator.

    Chris Wendt
    Microsoft Translator

    Tuesday, February 2, 2016 4:32 PM
  • Thanks so much for your prompt replies.

    The invalid AppId makes sense. It is only after 10 minutes since the initial access token was retrieved that the errors are issued. But when I try to renew the token by executing the same authentication routine that I used to obtain the original token, errors are returned. Am I correct in assuming that renewing an access code is performed in the same manner as retrieving the initial one? That is, just getting a new access code. This has been a very frustrating exercise.

    My client-id is ronald-tornambe

    • Edited by Deje Wednesday, February 3, 2016 4:03 PM clarity
    Tuesday, February 2, 2016 4:52 PM