Deploy error - bad credentials

I am trying to build a github repository and I get the following error:

Preparing deploy

/home/travis/.rvm/gems/ruby-2.4.5/gems/octokit-4.6.2/lib/octokit/response/raise_error.rb:16:in `on_complete': GET 401 - Bad credentials // See: (Octokit::Unauthorized)

I guess it has to do with the encrypted api_key in the .travis.yml.
I used the result of travis encrypt TOKEN with the token returned from travis token.

Is there a different procedure I need to perform to generate the encrypted api_key for a github repository?