#community-help

Issue with API Key Format and Typesense API Calls

TLDR Adrian encountered a 401 error when making API calls using a key, and Jason helped correct the key's format. Adrian then created a Github issue about the problem.

Powered by Struct AI

3

7
1mo
Solved
Join the chat
Aug 26, 2023 (1 month ago)
Adrian
Photo of md5-27ff63286c7b3dcb91085f39e910c437
Adrian
03:20 PM
Hey I created an API key with this format. Yet all api requests using this key return a 401. Did I format the actions list incorrectly?
curl "http://...:8108/keys" \ 
-X POST \ 
-H "X-TYPESENSE-API-KEY: ${TYPESENSE_API_KEY}" \ 
-H 'Content-Type: application/json' \ 
-d '{"description":"Key with custom permissions","actions": ["collections:*,documents:*,aliases:*,synonyms:*"], "collections": ["*"]}'
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
03:20 PM
Each action, should be a separate array element
03:21
Jason
03:21 PM
["collections:*", "documents:*", "aliases:*, "synonyms:*"]
Adrian
Photo of md5-27ff63286c7b3dcb91085f39e910c437
Adrian
03:21 PM
ah I see makes sense
03:21
Adrian
03:21 PM
would be nice if the api call to create it returned an error ๐Ÿ˜• But thanks for the fast response!

1

Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
03:21 PM
Yeah, could you open a GitHub issue for this so we can keep track?

1

Aug 27, 2023 (1 month ago)