4

I'm trying to make the Stack Exchange API request using the key provided by Stack Apps. But whenever I try it always throws the below error.

{'error_id': 400, 'error_message': "key doesn't match a known application", 'error_name': 'bad_parameter'}

I'm using the Python requests library to make the requests.

STACKEXCHANGE_ENDPOINT = "https://api.stackexchange.com/"
SIMILAR_ENDPOINT = "/2.2/similar"
endpoint = STACKEXCHANGE_ENDPOINT + SIMILAR_ENDPOINT

params = {
    "key": "<mykeyhere>",
    "order": "desc",
    "sort": "relevance",
    "tagged": "django",
    "site": "stackoverflow",
    "title": self.q,
}
response = requests.get(endpoint, params=params)

My final URL will be like this:

https://api.stackexchange.com/2.2/similar?key=<mykeyhere>&order=desc&sort=relevance&tagged=django&site=stackoverflow&title=how+to+install+django+channels

Can someone tell me why I'm getting that bad_parameter error?

2

When copying the application key, please keep in mind that the parentheses are actually part of the key, even if they are the only non-alphanumeric characters in it:

enter image description here

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .