Rajesh
Rajesh

Reputation: 479

How to add Flagsmith API authentication header

I am trying to consume the Flagsmith APIs as documented here .

It seems some APIs like -- /flags/ need "x-environment-key" header, which is working.

But for others like /environments/ "x-environment-key" does not work. I have tried a bearer token authorisation by obtaining the API key ( Authorization: Bearer <> ). But that doesn't work either. There is no clear documentation on the authentication mechanism ( or I have missed it ).

Can someone throw some pointers ?

Upvotes: 2

Views: 308

Answers (1)

Kyle Johnson
Kyle Johnson

Reputation: 961

x-environment-key is for the SDK endpoints, where as /environments is an admin endpoint used in the dashboard to list a project's environments. Those endpoints are protected via an API token, so you'd need to send

authorization: Token $API_TOKEN

You can find your API token in your account settings under keys

enter image description here

Upvotes: 2

Related Questions