API Authentication

Find how to authenticate with Lenses APIs.

Administrator Basic Authentication

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.

post

Starts a session given a username/password and puts it into a cookie.

Authorizations
Body

Bundles a username/password for authentication purposes.

usernamestringRequired
passwordstringRequired
Responses
post
POST /api/v1/login HTTP/1.1
Host: api.example.com
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 37

{
  "username": "text",
  "password": "text"
}
204

Happy response. A set-cookie header will be present.

No content

# 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.

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

Last updated

Was this helpful?