Skip to content
Browse all functions

Create JWT – Encode and Sign a JSON Web Token

data/jwtencode

Creates a signed JSON Web Token from a JSON payload, with HS256/384/512 (shared secret) or RS256/384/512 (PEM private key). iat is set; exp, iss, sub and aud optionally.

Endpoint

POSThttps://api.1001fx.com/data/jwtencode
Header
X-API-KEY: YOURSECRETAPIKEY How to
Content type
application/json (no body)

Parameters

This function has no parameters.

Examples

Create JWT – Encode and Sign a JSON Web Token

Create JWT – Encode and Sign a JSON Web Token

Input

Expects a json body
{
  "payload": {
    "userId": 42,
    "role": "editor"
  },
  "secret": "my-shared-secret",
  "algorithm": "HS256",
  "expiresIn": 3600,
  "issuer": "my-app"
}

Output · HTTP 200

Response
{
  "statusCode": 200
}
Show curl command
curl -X POST 'https://api.1001fx.com/data/jwtencode' \
  -H 'X-API-KEY: YOURSECRETAPIKEY' \
  -H 'Content-Type: application/json' \
  -d '{"payload":{"userId":42,"role":"editor"},"secret":"my-shared-secret","algorithm":"HS256","expiresIn":3600,"issuer":"my-app"}'

Try jwtencode now

Run it in your browser or create a free account and get 100 credits every month.

Changelog

  • 1.0.001.11.2026created