The Movie Database Support

My API key was working until last month. However, When I checked my API key this month, I got 401 error with this message "Invalid API key: You must be granted a valid key". Can you explain me why my API key Invalid?

14 replies (on page 1 of 1)

• Jump to last post

@tjddud1191 said:
API Key Invalid
My API key was working until last month.
However, When I checked my API key this month, I got 401 error with this message
"Invalid API key: You must be granted a valid key".
Can you explain me why my API key Invalid?

Better make sure your API Key has been canceled.
And the safest way is to do the test below.

Take a Test
Using a computer, desktop or notebook.
On some mobile devices this test may not work correctly.
In the URL below, change THE_KEY to your API Key.
https://api.themoviedb.org/3/movie/550?api_key=THE_KEY
Use this example to do a search using a new tab or window in your browser.
You will receive the basic data of the Movie Fight Club (1999)
https://www.themoviedb.org/movie/550-fight-club
If it works, your Key is OK.

If it does not work, let us know right here.

I got this error message instead of basic data of the Movie Fight Club

{"adult":false,"backdrop_path":"/hZkgoQYus5vegHoetLkCJzb17zJ.jpg","belongs_to_collection":null,"budget":63000000,"genres":[{"id":18,"name":"Drama"}],"homepage":"http://www.foxmovies.com/movies/fight-club","id":550,"imdb_id":"tt0137523","original_language":"en","original_title":"Fight Club","overview":"A ticking-time-bomb insomniac and a slippery soap salesman channel primal male aggression into a shocking new form of therapy. Their concept catches on, with underground \"fight clubs\" forming in every town, until an eccentric gets in the way and ignites an out-of-control spiral toward oblivion.","popularity":85.845,"poster_path":"/pB8BM7pdSp6B6Ih7QZ4DrQ3PmJK.jpg","production_companies":[{"id":711,"logo_path":"/tEiIH5QesdheJmDAqQwvtN60727.png","name":"Fox 2000 Pictures","origin_country":"US"},{"id":508,"logo_path":"/7cxRWzi4LsVm4Utfpr1hfARNurT.png","name":"Regency Enterprises","origin_country":"US"},{"id":4700,"logo_path":"/A32wmjrs9Psf4zw0uaixF0GXfxq.png","name":"The Linson Company","origin_country":"US"},{"id":25,"logo_path":"/qZCc1lty5FzX30aOCVRBLzaVmcp.png","name":"20th Century Fox","origin_country":"US"},{"id":20555,"logo_path":"/hD8yEGUBlHOcfHYbujp71vD8gZp.png","name":"Taurus Film","origin_country":"DE"}],"production_countries":[{"iso_3166_1":"DE","name":"Germany"},{"iso_3166_1":"US","name":"United States of America"}],"release_date":"1999-10-15","revenue":100853753,"runtime":139,"spoken_languages":[{"english_name":"English","iso_639_1":"en","name":"English"}],"status":"Released","tagline":"Mischief. Mayhem. Soap.","title":"Fight Club","video":false,"vote_average":8.44,"vote_count":27672}

Also, when I check my api authentication, Still I got this message. "status_message": "Invalid API key: You must be granted a valid key."

If My api Key got canceled, Can I ask why it has been canceled?

@tjddud1191 said:

I got this error message instead of basic data of the Movie Fight Club

{"adult":false,"backdrop_path":"/hZkgoQYus5vegHoetLkCJzb17zJ.jpg","belongs_to_collection":null,"budget":63000000,"genres":[{"id":18,"name":"Drama"}],"homepage":"http://www.foxmovies.com/movies/fight-club","id":550,"imdb_id":"tt0137523","original_language":"en","original_title":"Fight Club"," ...

Sorry I do not understand.

You did the test I indicated above and

  1. received the correct data in the response.
  2. received the same error message that you reported at the beginning.

Choose one of the possibilities.

Sorry, Now I understand.

The answer is 1,

I received the correct Fight Club Movie's basic "data", instead of go to https://www.themoviedb.org/movie/550-fight-club this page.

With this test we know that your API Key is still valid.

@tjddud1191 said:
However, When I checked my API key this month, I got 401 error with this message
"Invalid API key: You must be granted a valid key".

How or where did you do this check?
It was using "Try it!" in the Documents?

The "Try it!" option in DOCs it only works with the "Access Token Auth" option.
It doesn't work if you select the "API Key Auth" option.
Your API Key validation test is done using your Token.
https://developer.themoviedb.org/reference/authentication-validate-key
If your Token works then your API Key must also work.

If you checked in another way, please let us know which way it was.

Hello TMDB Support ...
I am also receiving this message.
"status_message": "Invalid API key: You must be granted a valid key.",
Please advise. I did take the test above and it failed.
https://developer.themoviedb.org/reference/authentication-validate-key

@kmcowan said:

Hello TMDB Support ...
I am also receiving this message.
"status_message": "Invalid API key: You must be granted a valid key.",
Please advise. I did take the test above and it failed.
https://developer.themoviedb.org/reference/authentication-validate-key

Take a Test
Using a computer, desktop or notebook.
On some mobile devices this test may not work correctly.
In the URL below, change THE_KEY to your API Key.
https://api.themoviedb.org/3/movie/550?api_key=THE_KEY
Use this example to do a search using a new tab or window in your browser.
You will receive the basic data of the Movie Fight Club (1999)
https://www.themoviedb.org/movie/550-fight-club
If it works, your Key is OK.

When there is a problem, the TMDb Server sends a message.
Can you tell which message the server sent?
Here is a list of possible messages:
https://developer.themoviedb.org/docs/errors

If it does not work, let us know right here.

Yes, I tried both the aforementioned test above, as test as the authentication test page. I'm unable to get a 200 response now, although this key used to work.

@kmcowan said:
Yes, I tried both the aforementioned test above, as test as the authentication test page. I'm unable to get a 200 response now, although this key used to work.

Tested API Key and it didn't work
Create a new topic requesting it with the title: Regenerate API Key.
It will be in this new topic that you will receive the information that your API Key has been regenerated.

Or

Go to this page in your profile.
https://www.themoviedb.org/settings/api
If you already have it and want it to be changed or regenerated,
request it here by clicking on "Regenerate Key":

Thank you. I was able to regenerate the key.

@ticao2 said:

With this test we know that your API Key is still valid.

@tjddud1191 said:
However, When I checked my API key this month, I got 401 error with this message
"Invalid API key: You must be granted a valid key".

How or where did you do this check?
It was using "Try it!" in the Documents?

The "Try it!" option in DOCs it only works with the "Access Token Auth" option.
It doesn't work if you select the "API Key Auth" option.
Your API Key validation test is done using your Token.
https://developer.themoviedb.org/reference/authentication-validate-key
If your Token works then your API Key must also work.

If you checked in another way, please let us know which way it was.

It was "Try it" for "API key Auth".

Even the result of test shows my API Key is still valid, still I got fail error message on my portfolio, movie db page. "Failed to load resource: the server responded with a status of 400 ()"

Also, my "API Key Auth" is show still failed on "API Reference - Authentication" page.

I don't know if I understood correctly, but...

@tjddud1191 said:
It was "Try it" for "API key Auth".
Even the result of test shows my API Key is still valid,

Then your API Key is valid.

still I got fail error message on my portfolio, movie db page.
"Failed to load resource: the server responded with a status of 400 ()"

Can you tell us which of these errors is occurring?
See the list of TMDb server error warnings here.
https://www.themoviedb.org/documentation/api/status-codes
In your case:

Code    HTTP    Message  

18      400     Validation failed.
22      400     Invalid page: Pages start at 1 and max at 1000. They are expected to be an integer.
23      400     Invalid date: Format needs to be YYYY-MM-DD.
26      400     You must provide a username and password.
27      400     Too many append to response objects: The maximum number of remote calls is 20.
28      400     Invalid timezone: Please consult the documentation for a valid timezone.
29      400     You must confirm this action: Please provide a confirm=true parameter.
47      400     The input is not valid.

Also, my "API Key Auth" is show still failed on "API Reference - Authentication" page.

Nothing works on the DOC pages if the "API Key Auth" option is selected.
Only works with the "Access Token Auth" option.

My API Key is not working. Please help. {"status_code":7,"status_message":"Invalid API key: You must be granted a valid key.","success":false}I

@Markysan said:
My API Key is not working. Please help.
{"status_code":7,"status_message":"Invalid API key: You must be granted a valid key.","success":false}I

Read this conversation from the beginning.
First do the test indicated here:
https://www.themoviedb.org/talk/657d0eeeb7fbbd06e430013f#657e58cd8f26bc1f50751e92

If your API Request worked correctly, read this second explanation:
https://www.themoviedb.org/talk/657d0eeeb7fbbd06e430013f#6582dc0a8586785635f65e85

If your problem has not yet been resolved, follow these instructions:
https://www.themoviedb.org/talk/657d0eeeb7fbbd06e430013f#65833a81ea7b0e51fa270f0f

Can't find a movie or TV show? Login to create it.

Want to rate or add this item to a list?

Login