The Movie Database Support

I cannot get my API key to validate and have tried a bunch of different things to fix it. I am getting this error: { "status_code": 7, "status_message": "Invalid API key: You must be granted a valid key.", "success": false }

Please help!

10 replies (on page 1 of 1)

Jump to last post

I also have this error message when testing:

401 Authentication failed: You do not have permissions to access the service.

@babyonsteroids said:
Cannot Validate API key
I cannot get my API key to validate and have tried a bunch of different things to fix it. I am getting this error:
{
"status_code": 7,
"status_message": "Invalid API key: You must be granted a valid key.",
"success": false
}
Please help!

I assume you are testing/using "Try it!" in the documentation.

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.

I am still getting the following response when I try the validation test: { "status_code": 7, "status_message": "Invalid API key: You must be granted a valid key.", "success": false }

It also logs a status 401 error message in the attempt

@babyonsteroids said:
I am still getting the following response when I try the validation test:
{
"status_code": 7,
"status_message": "Invalid API key: You must be granted a valid key.",
"success": false
}
It also logs a status 401 error message in the attempt

I didn't understand.
Received error response in "Try it!" of DOCs?
https://developer.themoviedb.org/reference/authentication-validate-key
Or in the test response directly to your browser?
https://api.themoviedb.org/3/movie/550?api_key=THE_KEY

When using the vadilate-key link you provided, my API key returns an 401 error code and returns:

{ "status_code": 7, "status_message": "Invalid API key: You must be granted a valid key.", "success": false }

@babyonsteroids said:

When using the vadilate-key link you provided, my API key returns an 401 error code and returns:

{ "status_code": 7, "status_message": "Invalid API key: You must be granted a valid key.", "success": false }

Well, if you did the test as indicated above, using a tab in your browser, and received this error,
then I suggest asking to regenerate your API Key.
Go to your profile
https://www.themoviedb.org/settings/api
and in the top menu click on the "Regenerate Key" option on the right.
It may take up to a week.
Only the admin, Travis Bell, can regenerate an API Key.
It depends on how much work he has.

https://api.themoviedb.org/3/movie/11?api_key=

Using that link returns the Star Wars data, so the key itself is good but using the validate key test fails: https://developer.themoviedb.org/reference/authentication-validate-key

@babyonsteroids said:
https://api.themoviedb.org/3/movie/11?api_key=
Using that link returns the Star Wars data, so the key itself is good

OK. Your API Key is valid, no problems.

but using the validate key test fails:
https://developer.themoviedb.org/reference/authentication-validate-key

I'll repeat what I said in my first comment.

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.

Check on the page which option is selected in the Dropdown, top right, under "Authorization - Header".
Cannot selected with "API Key Auth". which has a bug.
It must be selected with "Access Token Auth", which is what works correctly.

@ticao2 said:

@babyonsteroids said:
https://api.themoviedb.org/3/movie/11?api_key=
Using that link returns the Star Wars data, so the key itself is good

OK. Your API Key is valid, no problems.

but using the validate key test fails:
https://developer.themoviedb.org/reference/authentication-validate-key

I'll repeat what I said in my first comment.

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.

Check on the page which option is selected in the Dropdown, top right, under "Authorization - Header".
Cannot selected with "API Key Auth". which has a bug.
It must be selected with "Access Token Auth", which is what works correctly.

the try it option in docs with the access token auth works for me also in the url i put my api key and it works fine but in when i run my code it gives error of invalid api key .......

@jasimz said:
the try it option in docs with the access token auth works for me
also in the url i put my api key and it works fine
but in when i run my code it gives error of invalid api key .......

OK. So we know that your API Key is still valid.
The problem occurs when you use your code. Then...

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

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

Global

s focus the search bar
p open profile menu
esc close an open window
? open keyboard shortcut window

On media pages

b go back (or to parent when applicable)
e go to edit page

On TV season pages

(right arrow) go to next season
(left arrow) go to previous season

On TV episode pages

(right arrow) go to next episode
(left arrow) go to previous episode

On all image pages

a open add image window

On all edit pages

t open translation selector
ctrl+ s submit form

On discussion pages

n create new discussion
w toggle watching status
p toggle public/private
c toggle close/open
a open activity
r reply to discussion
l go to last reply
ctrl+ enter submit your message
(right arrow) next page
(left arrow) previous page

Settings

Want to rate or add this item to a list?

Login