The JWT must contain the following:

  • An issuer matching your API Key
  • An issue time with the current UTC timestamp
  • A signature by your Private RSA Key
  • Only RS512 is supported at this time

The JWT must be signed using your private RSA key.

The following code snippet can be used to generate the JWT

"""
* We recomend the use of Python 3.

- Install python dependency required to run this script by:
    pip install python-jose

The .pem file used in this script is the Private Key generated during the setup.

The value of \'iss\' is the API Key that was provided by Lirium during setup.
"""

from jose import jwt
from datetime import datetime, timezone

def create_jwt():
    with open("your_private_key.pem", "r") as f:
        private_key = f.read()

    payload = {
        "iss": "your_api_key",
        "iat": int(datetime.now(timezone.utc).timestamp()),
    }
    return jwt.encode(payload, private_key, algorithm="RS512")

Here is an example with considering the API Key = 9de362f4d69d484c9a1af12d610f1caa

The JWT output is

eyJhbGciOiJSUzUxMiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiI5ZGUzNjJmNGQ2OWQ0ODRjOWExYWYxMmQ2MTBmMWNhYSIsImlhdCI6MTU5ODk3ODQ5Nn0.jhQbmEObzj4NhkAxEFp-MIE4QDesLpVgyi8ZUowW7aAFJX8OHsGMrC4Kib4N8_XqAiHs39qrinLrcwIQh3XHNLC5a4LAWARq1ZK0y72FbT3f_hvjEeui5P0VqfwDe27VPfW9fXilaXpzmlW8bDY2sZNO5dddqVZuZubpPYsJvgRcK8_Lsv9hSDfQHULH5DxB0E-iGkuLxXOk1R-Stvj4NamGmAphvV0f9V31viTqvqV0JEaSNzcgwVPCFsooI2J6xFj_lMBIOtLwCluO8hnK9-WSbBaeqTCiq9p4JA31rAcwzNnEpkQ0CeDia-3VjMgp_sXSO3hnJbGKNMqTzhLO0Rxiy-rUIB9j81hzqgD3rGC7uZi46pSHjNZAExRac6EtSiBQXOmplb1UYeg5mMU91zg75PH5PPHYmxx6W9nNmv_-qOb-osQVnOl1mzEVfakB8PhCBIX1jUlHRO4110DXnqzESx-MuiJLt3KAs0OPM95maUScggIBvTBSCx5HE5tIhmOAZ1IjneLj2kGq-W44IxRQdImfar104_Xsxw5e5fkZEqm-Hcdo5m51xa_vZ1LQQ2p-n8Sa32-dLsDz-Kq9YZGp633XCoJ6S82ITjjLmSbazy1-YOgsGU3JZ9kWibcwss6-5Xdn7nZBcSRtrSUsuYDQejDTryhNkhLfvFYNKho

This JWT must be sent on every request as the Bearer Token authorization HTTP header with the following form:

Authorization: Bearer <JWT here>