Hello, my API key isnt working anymore for some reason. I tried regenerating a new one, it worked for like a minute and staterted giving a 404 error. Requests on the developer page give this: { "status_code": 7, "status_message": "Invalid API key: You must be granted a valid key.", "success": false } and a stastus 401: this request is not associated with an endpoint in the api definition. Could you please help me out
Un film, une émission télévisée ou un artiste est introuvable ? Connectez-vous afin de créer une nouvelle fiche.
Vous souhaitez évaluer ou ajouter cet élément à une liste ?
Pas encore membre ?
Réponse de ticao2 🇧🇷 pt-BR
le 17 janvier 2024 à 11h22
Are you submitting your API Requests using the "Try it" feature on the developer pages in the documents?
https://developer.themoviedb.org/reference/intro/getting-started
Or are you sending it directly via your browser's URL?
Or are you sending it using code you are developing?
If you're always using the developers' page, then...
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 want to test your API Key directly, follow the instructions 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.
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.
Réponse de vemilyus
le 17 janvier 2024 à 12h09
@ticao2 The problem is that even if the
API Key Auth
option is selected the API Key is still sent via theAuthorization
header instead of the query parameterapi_key
.Réponse de ticao2 🇧🇷 pt-BR
le 18 janvier 2024 à 10h43
I think I didn't explain it correctly in my previous comment.
Never select the "API Key Auth" option in the "Try it" dropdown.
This documentation feature is defective.
Does not work.
In the dropdown, always leave the "Access Token Auth" option selected.
Réponse de vemilyus
le 18 janvier 2024 à 10h46
Thank you for the clarification!
Réponse de kennylima
le 19 janvier 2024 à 02h52
it worked locally for some hours after i sent the message enough to be deployed, however, when i started my local server again, i got 404 not found error. i tried your https://api.themoviedb.org/3/movie/550?api_key=THE_KEY hack and this worked tho.
Réponse de ticao2 🇧🇷 pt-BR
le 19 janvier 2024 à 07h14
I didn't quite understand your answer.
If the problem is solved, forget what I'm going to say.
If it hasn't been resolved, please answer the questions I asked.
Réponse de kennylima
le 19 janvier 2024 à 07h42
Yes, i am sending it via code for a project.
i tried your suggestion: https://api.themoviedb.org/3/movie/550?api_key=THE_KEY. It worked and gave me the fight club info
however, it doesn't work for my code.
Réponse de ticao2 🇧🇷 pt-BR
le 19 janvier 2024 à 08h02
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:
Réponse de kennylima
le 20 janvier 2024 à 04h35
its 404 not found
Réponse de ticao2 🇧🇷 pt-BR
le 20 janvier 2024 à 07h24
Which of the two?
I believe it is when the item ID (movie or TV show) has an error.
Try searching for another ID.
Your TOKEN usage session was not created correctly or has a problem.
Réponse de TanmayH
le 26 août 2024 à 12h11
I am facing the same issue. I tried the test that you mentioned before using my API key. But when I use it in my code then it doesn't work. It gives me a 401: Invalid API Key error.
Réponse de ticao2 🇧🇷 pt-BR
le 26 août 2024 à 16h29
The problem must be in the code that is building your API Request, or something like that,
and is sending the Request to the TMDb Server.
It is very common to find people here with this type of problem.
A little mistake, a copy and paste with an extra space, or less character, an exchange of characters,
a quote left, use a dash when it should be underline, in short a typo and the answer can be that.
Even if the API Key is correct. The Requisition is that it has a little mistake.
I will place 6 API requests here. The first 5 with error.
You can see that the API Key is correct but the answer is Invalid API key or could not be found.
My suggestion is to check if there is any way for you to view the API Request that your APP is sending to the TMDb server.
Not the construction of the code, but the requisition built, final.
If possible, post the Request here.
If this is not possible, then you need to check in your code if there is a mistake, like the mistake in the examples above.
The error is usually in this segment of the API Request: ....?api_key=12345....
Réponse de gabrielSDourado
le 26 août 2024 à 17h10
By testing the API using postman, I get the answer "status_code": 7, "status_message": "Invalid API key: You must be granted a valid key.", "success": false
Réponse de ticao2 🇧🇷 pt-BR
le 26 août 2024 à 17h43
I suggest you search here on the forum for something about Postman.
https://www.themoviedb.org/talk/search?advanced_search=&query=Postman&with_category=5047958519c29526b50017d6&with_status%5B%5D=closed&with_status%5B%5D=open
Or open a new topic with your question, putting the word Postman in the title.
Something like: Postman - Invalid API Key. Or something similar.
That way you can more easily find other Postman users who might be able to help.