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
Es fehlt ein Film oder eine Serie? Logge dich ein zum Ergänzen.
Diesen Eintrag bewerten oder zu einer Liste hinzufügen?
Kein Mitglied?
Antwort von ticao2 🇧🇷 pt-BR
am 17. Januar 2024 um 11:22
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.
Antwort von vemilyus
am 17. Januar 2024 um 12:09
@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
.Antwort von ticao2 🇧🇷 pt-BR
am 18. Januar 2024 um 10:43
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.
Antwort von vemilyus
am 18. Januar 2024 um 10:46
Thank you for the clarification!
Antwort von kennylima
am 19. Januar 2024 um 02:52
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.
Antwort von ticao2 🇧🇷 pt-BR
am 19. Januar 2024 um 07:14
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.
Antwort von kennylima
am 19. Januar 2024 um 07:42
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.
Antwort von ticao2 🇧🇷 pt-BR
am 19. Januar 2024 um 08:02
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:
Antwort von kennylima
am 20. Januar 2024 um 04:35
its 404 not found
Antwort von ticao2 🇧🇷 pt-BR
am 20. Januar 2024 um 07:24
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.
Antwort von TanmayH
am 26. August 2024 um 12:11
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.
Antwort von ticao2 🇧🇷 pt-BR
am 26. August 2024 um 16:29
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....
Antwort von gabrielSDourado
am 26. August 2024 um 17:10
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
Antwort von ticao2 🇧🇷 pt-BR
am 26. August 2024 um 17:43
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.