How to add Flagsmith API authentication header

175 Views Asked by At

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 ?

1

There are 1 best solutions below

0
On

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