JWT Decode API Endpoint - Free Public API

Endpoint URL:
https://aisenseapi.com/services/v1/jwt_decode

Description:
This endpoint decodes a JSON Web Token (JWT) and returns its payload. It accepts JWT input as JSON with a data field, as a plain text string with Content-Type: text/plain, or as a file upload. To successfully decode the JWT, a secret key must be provided in the request.

If the JWT or secret is invalid, an appropriate error message will be returned.


Response Format

  • Content-Type: application/json

Example Success Response:

{
 "decoded_payload": {
  "sub": "1234567890",
  "name": "John Doe",
  "iat": 1516239022
 }
}

Example Error Responses:

{ "error": "Invalid JWT or secret." }
{ "error": "Secret key is required for decoding." }
{ "error": "Invalid data provided. Expected a string." }
{ "error": "No data to process or invalid input." }
{ "error": "An unexpected error occurred: error details" }

Input Requirements

The API accepts JWT input in three formats:

  1. JSON Input:

    {
     "data":
    "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
     "secret": "your_secret_key"
    }
  2. Plain Text Input:

    eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
  3. File Upload: Send the JWT as a file with the key jwt_data using multipart/form-data.


Use Cases

  • Decoding JWTs for user authentication tokens
  • Verifying JWT signatures with a secret key
  • Extracting claims from secure tokens in web applications

How to Use

  1. Send a POST request to:
    https://aisenseapi.com/services/v1/jwt_decode

  2. Choose your input format:

    • JSON input:
      {
       "data": "JWT_string_here",
       "secret": "your_secret_key"
      }
    • Plain text input (with secret key in JSON):
      JWT_string_here
  3. Handle the response:

    • If valid, the decoded JWT payload will be returned.
    • If invalid, an error message will be provided.

Example cURL Requests

  • JSON Input:

    curl -X POST https://aisenseapi.com/services/v1/jwt_decode \
    -H "Content-Type: application/json" \
    -d '{"data":"your.jwt.token","secret":"your_secret_key"}'
  • Plain Text Input:

    curl -X POST https://aisenseapi.com/services/v1/jwt_decode \
    -H "Content-Type: text/plain" \
    -H "X-Secret: your_secret_key" \
    --data "your.jwt.token"
  • File Upload:

    curl -X POST https://aisenseapi.com/services/v1/jwt_decode \
    -F "jwt_data=@/path/to/token.txt" \
    -F "secret=your_secret_key"

Key Features

  • Supports JSON, plain text, and file input formats
  • Requires a secret key for decoding HS256 tokens
  • Provides clear error handling for invalid input or JWT decoding issues
  • No authentication required – free public API
Scroll to Top