Crypto & Security 1 credit COMPUTE

JWT Sign API

Create and sign JSON Web Tokens (JWT) via REST API. Provide a payload object and a secret key, and receive a signed HS256 JWT ready to use as a Bearer token, session token, or API key. Useful for testing JWT-based auth flows without setting up a full auth library.

Try it live →

How it works

POST a JSON payload object and a secret string. The API signs the payload with HMAC-SHA256 (HS256), adds standard claims (iat, exp if you provide expiresIn), and returns the complete JWT string in three base64url-encoded parts.

Use cases

API Reference

POST https://slopshop.gg/v1/crypto-jwt-sign
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

Input parameters

ParameterTypeRequiredDescription
input / data string required The input data to hash or process

Example response

{
  "data": {
    "result": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
    "algorithm": "jwt-sign"
  },
  "meta": {
    "credits_used": 1,
    "engine": "real",
    "ms": 4
  }
}

Examples

Three real-world scenarios showing how developers use JWT Sign in production.

Example 1
Issue user session token
Sign a JWT for a logged-in user with their ID and role.
curl -X POST https://slopshop.gg/v1/crypto-jwt-sign \
  -H "Authorization: Bearer $SLOPSHOP_KEY" \
  -H "Content-Type: application/json" \
  -d '{"payload": {"user_id": 42, "role": "admin"}, "secret": "my-app-secret", "expiresIn": "24h"}'
Example 2
Service-to-service auth
Issue a short-lived token for a backend microservice call.
curl -X POST https://slopshop.gg/v1/crypto-jwt-sign \
  -H "Authorization: Bearer $SLOPSHOP_KEY" \
  -H "Content-Type: application/json" \
  -d '{"payload": {"service": "billing", "scope": "read:invoices"}, "secret": "internal-secret", "expiresIn": "5m"}'
Example 3
Email verification link
Create a token to embed in a verification email link.
curl -X POST https://slopshop.gg/v1/crypto-jwt-sign \
  -H "Authorization: Bearer $SLOPSHOP_KEY" \
  -H "Content-Type: application/json" \
  -d '{"payload": {"email": "user@example.com", "action": "verify"}, "secret": "verify-secret", "expiresIn": "1h"}'

Code examples

curl

curl -X POST https://slopshop.gg/v1/crypto-jwt-sign \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"input": "your data here"}'

Python

import requests

response = requests.post(
    "https://slopshop.gg/v1/crypto-jwt-sign",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={"input": "your data here"}
)
result = response.json()
print(result["data"])

Node.js

const response = await fetch("https://slopshop.gg/v1/crypto-jwt-sign", {
  method: "POST",
  headers: {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({ input: "your data here" })
});
const { data } = await response.json();
console.log(data);

CLI

# Install the Slopshop CLI
npm install -g slopshop

# Set your API key
export SLOPSHOP_KEY=your_api_key

# Call crypto-jwt-sign
slop crypto-jwt-sign '{"input": "your data here"}'

Pricing

Credits per call
1
credits
Cost per call
$0.001
at Starter tier
Tier
COMPUTE
Pure compute

Credits are purchased in bundles starting at $1 for 1,000 credits. All compute APIs like this one use 1 credit per call — that's $0.001. See all pricing tiers.

Related APIs in Crypto & Security

View the full API catalog · Try in playground · Documentation