Search API Key Forbidden Error

TLDR Jeremy encountered a "Forbidden" error when using a search API key. Kishore Nallan discussed possible causes, and Jeremy discovered they mistakenly used a production key in a test environment.

Photo of Jeremy
Jeremy
Mon, 24 Apr 2023 13:37:09 UTC

I just created a search only api key, and now when I replace the inital api key that was created with the search key, i get `"message": "Forbidden - a valid `x-typesense-api-key` header must be sent."`

Photo of Kishore Nallan
Kishore Nallan
Mon, 24 Apr 2023 13:43:03 UTC

Check the /keys end-point -- it returns few chars from the key. Ensure you are using the correct key.

Photo of Jeremy
Jeremy
Mon, 24 Apr 2023 14:12:29 UTC

ya it's the right key, i just tried creating a new one and immediately placing it in my search query, still same forbidden result

Photo of Kishore Nallan
Kishore Nallan
Mon, 24 Apr 2023 14:13:11 UTC

Is this locally? Check the typesense server logs to see if a more detailed error is logged.

Photo of Jeremy
Jeremy
Mon, 24 Apr 2023 14:13:22 UTC

is `x-typesense-api-key` the correct header for a search only key?

Photo of Jeremy
Jeremy
Mon, 24 Apr 2023 14:14:51 UTC

oh boy, ignore this Kishore Nallan i figured out my error. time for a break :smile:

Photo of Kishore Nallan
Kishore Nallan
Mon, 24 Apr 2023 14:15:19 UTC

What was it?

Photo of Jeremy
Jeremy
Mon, 24 Apr 2023 14:17:05 UTC

Creating a key in production.... and running it in test......

Photo of Jeremy
Jeremy
Mon, 24 Apr 2023 14:17:06 UTC

oof

Photo of Kishore Nallan
Kishore Nallan
Mon, 24 Apr 2023 14:17:31 UTC

Ah! No worries, happens :slightly_smiling_face: