Skip to main content
If you prefer to generate JWTs programmatically within your Python application or tooling, you can use the following lightweight script. It constructs the required JWT claims and signs the token using your ES256 private key.

Step 1: Generate your private key

Before running the script, securely generate your ES256 private and public keys. For testing purposes you can use this command:

Step 2: Script to generate a JWT

The resulting token variable contains the signed JWT string, which you can include in your API request header like so:

Notes

  • The iat claim must reflect the current UTC time and be within 30 seconds of server time.
  • The body must match the exact order and structure of the request body.
  • The script does not skip the body claim for GET or HEAD