Skip to content
Browse all functions

Create JWT – Encode and Sign a JSON Web Token

data/jwtencode

jwtencode (Create JWT – Encode and Sign a JSON Web Token) is a 1001fx API function in the group Data & JSON: POST https://api.1001fx.com/data/jwtencode, 1 credit per call. It works as a ready-made module in Make or as a plain HTTP call.

1 credit per callHTTP APIMake

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

Parameters

  • payloadobjectrequired

    Claims as JSON object.

  • secretstringrequired

    Shared secret for HS*, PEM private key for RS*.

    Example:
    my-shared-secret
  • algorithmenumoptional

    Default HS256.

    Values:
    HS256
    HS384
    HS512
    RS256
    RS384
    RS512
    Default:
    HS256
  • expiresInnumberoptional

    Sets exp = now + seconds.

    Example:
    3600
  • issuerstringoptional
  • subjectstringoptional
  • audiencestringoptional

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