# API Authentication

## Administrator Basic Authentication

{% hint style="info" %}
You can use HTTP Basic Authentication if you are an Administrator with a username and password (non-SSO).

To check if you are an Administrator, go to `My profile > Organisation settings > Administrators`.
{% endhint %}

{% openapi src="<https://3471212993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJpmk4J5g3Kj2RRRpYUrl%2Fuploads%2Fi0BYF0dr31g2XDn1Ehm8%2Fhq-openapi.yml?alt=media&token=ccfc8054-faae-4600-ad93-e2093e443969>" path="/v1/login" method="post" %}
[hq-openapi.yml](https://3471212993-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJpmk4J5g3Kj2RRRpYUrl%2Fuploads%2Fi0BYF0dr31g2XDn1Ehm8%2Fhq-openapi.yml?alt=media\&token=ccfc8054-faae-4600-ad93-e2093e443969)
{% endopenapi %}

```bash
# EXAMPLE
# Get a list of users
curl https://lenses.example.com/api/v1/users/me -u my-admin-user:my-admin-password
```

## Service Accounts

Use a Bearer Token to authenticate service accounts. Set the token in the HTTP header request.

```bash
# EXAMPLE
# Get the list of environments via API
curl https://lenses.example.com/api/v1/environments \
  -H 'Authorization: Bearer MY_SERVICE_ACCOUNT_KEY'
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.lenses.io/latest/devx/6.0/resources/api-reference/authentication-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
