The Movie Database Support

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

14 replies (on page 1 of 1)

• Jump to last post

@kennylima said:
API key not working
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

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.

@ticao2 The problem is that even if the API Key Auth option is selected the API Key is still sent via the Authorization header instead of the query parameter api_key.

@vemilyus said:
@ticao2
The problem is that even if the API Key Auth option is selected the API Key is still sent via the Authorization header instead of the query parameter api_key.

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.

Thank you for the clarification!

@ticao2 said:

@kennylima said:
API key not working
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

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.

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.

@kennylima said:
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.

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.

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?

@ticao2 said:

@kennylima said:
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.

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.

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?

Or are you sending it using code you are developing?

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.

@kennylima said:

Or are you sending it using code you are developing?

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.

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  
3       401     Authentication failed: You do not have permissions to access the service.
7       401     Invalid API key: You must be granted a valid key.
10      401     Suspended API key: Access to your account has been suspended, contact TMDb.
14      401     Authentication failed.
16      401     Device denied.
17      401     Session denied.
30      401     Invalid username and/or password: You did not provide a valid login.
31      401     Account disabled: Your account is no longer active. Contact TMDb if this is an error.
32      401     Email not verified: Your email address has not been verified.
33      401     Invalid request token: The request token is either expired or invalid.
34      401     The resource you requested could not be found.
35      401     Invalid token.
36      401     This token hasn't been granted write permission by the user.
38      401     You don't have permission to edit this resource.
39      401     This resource is private.  

6       404     Invalid id: The pre-requisite id is invalid or not found.  
37      404     The requested session could not be found.  

@ticao2 said:

@kennylima said:

Or are you sending it using code you are developing?

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.

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  
3         401     Authentication failed: You do not have permissions to access the service.
7         401     Invalid API key: You must be granted a valid key.
10        401     Suspended API key: Access to your account has been suspended, contact TMDb.
14        401     Authentication failed.
16        401     Device denied.
17        401     Session denied.
30        401     Invalid username and/or password: You did not provide a valid login.
31        401     Account disabled: Your account is no longer active. Contact TMDb if this is an error.
32        401     Email not verified: Your email address has not been verified.
33        401     Invalid request token: The request token is either expired or invalid.
34        401     The resource you requested could not be found.
35        401     Invalid token.
36        401     This token hasn't been granted write permission by the user.
38        401     You don't have permission to edit this resource.
39        401     This resource is private.  

6         404     Invalid id: The pre-requisite id is invalid or not found.  
37        404     The requested session could not be found.  

its 404 not found

@kennylima said:

Can you tell us which of these errors is occurring?
In your case:

Code    HTTP    Message  
6       404     Invalid id: The pre-requisite id is invalid or not found.  
37      404     The requested session could not be found.  

its 404 not found

Which of the two?

6       404     Invalid id: The pre-requisite id is invalid or **not found**.  

I believe it is when the item ID (movie or TV show) has an error.
Try searching for another ID.

37      404     The requested session could **not be found**.  

Your TOKEN usage session was not created correctly or has a problem.

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.

@TanmayH said:
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.

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.

1 https://api.themoviedb.org/3/movie/550&api_key=THE_KEY  
2 https://api.themoviedb.org/3/movie/550/api_key=THE_KEY  
3 https://api.themoviedb.org/3/movie/550?api-key=THE_KEY  
4 https://api.themoviedb.org/3/movie/550? api_key=THE_KEY    
5 https://api.themoviedb.org/3/movie/'550'?api_key=THE_KEY  
6 https://api.themoviedb.org/3/movie/550?api_key=THE_KEY    

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....

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

@gabrielSDourado said:
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

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.

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

Want to rate or add this item to a list?

Login