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
Can't find a movie or TV show? Login to create it.
Want to rate or add this item to a list?
Not a member?
Reply by ticao2 š§š· pt-BR
on January 17, 2024 at 11:22 AM
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.
Reply by vemilyus
on January 17, 2024 at 12:09 PM
@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
.Reply by ticao2 š§š· pt-BR
on January 18, 2024 at 10:43 AM
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.
Reply by vemilyus
on January 18, 2024 at 10:46 AM
Thank you for the clarification!
Reply by kennylima
on January 19, 2024 at 2:52 AM
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.
Reply by ticao2 š§š· pt-BR
on January 19, 2024 at 7:14 AM
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.
Reply by kennylima
on January 19, 2024 at 7:42 AM
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.
Reply by ticao2 š§š· pt-BR
on January 19, 2024 at 8:02 AM
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:
Reply by kennylima
on January 20, 2024 at 4:35 AM
its 404 not found
Reply by ticao2 š§š· pt-BR
on January 20, 2024 at 7:24 AM
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.
Reply by TanmayH
on August 26, 2024 at 12:11 PM
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.
Reply by ticao2 š§š· pt-BR
on August 26, 2024 at 4:29 PM
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....
Reply by gabrielSDourado
on August 26, 2024 at 5:10 PM
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
Reply by ticao2 š§š· pt-BR
on August 26, 2024 at 5:43 PM
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.