⚠️ Under construction.
API Docs
Authentication

Authentication

LifeNome uses OAuth2 (opens in a new tab) authorization framework for implementing access control to all publicly available APIs.

Obtaining an access token

All our API endpoints require authentication. Requests can be authenticated by adding a token, which can be obtained from Authorization API Create Token endpoint using your username and password:

curl --request POST \
  --url "https://se1.lifenome.com/platform-api/api/core-api/auth/token/" \
  --header "Content-Type: application/json" \
  --data '{"username": "'${USERNAME}'", "password": "'${PASSWORD}'"}'

Successful response will include two tokens:

{
  "refresh": "{REFRESH_TOKEN}",
  "access": "{ACCESS_TOKEN}"
}

Similar to password, access tokens should be treated like a secret. Unsuccessful authentication will return HTTP response with status code 401 and it will not include any tokens (error message will be returned in the detail field).

Alternatively, if jq tool is available, ACCESS_TOKEN variable could be automatically extracted:

ACCESS_TOKEN=$(curl --request POST  \
  --url "https://se1.lifenome.com/platform-api/api/core-api/auth/token/" \
  --header "Content-Type: application/json" \
  --data '{"username": "'${USERNAME}'", "password": "'${PASSWORD}'"}' | jq -r .access)

Making authenticated requests

For the regular API requests, pass your ACCESS_TOKEN in an Authorization header:

--header 'Authorization: Bearer ${ACCESS_TOKEN}'

For example, the List Samples endpoint will list all existing samples, if any:

curl --request GET \
  --url "https://se1.lifenome.com/platform-api/api/core-api/samples/" \
  --header "Content-Type: application/json" \
  --header "Authorization: Bearer ${ACCESS_TOKEN}"

Successfully authenticated request will return one of the successful codes (2xx) with requested content in the response body, which is list of sample objects for this requests (empty when first used):

{
  "count": 0,
  "next": null,
  "previous": null,
  "results": []
}

Similar to previous endpoint, unsuccessful authentication will return HTTP response status code 401 with error messages given in detail field and additionally in messages field.