# JWT Decoder API

> JWT Decoder decodes JWT tokens to reveal header and payload information, and on paid plans verifies the signature against a public key you supply. It handles JSON web token decode from any language over REST, so you can inspect claims and expiry without adding a JWT library.

**Endpoint:** `POST https://api.apiverve.com/v1/jwtdecoder`  
**Category:** Data Conversion  
**Cost:** 1 credit per call  
**Canonical page:** https://apiverve.com/marketplace/jwtdecoder

## Overview

On paid plans, pass a PEM public key, certificate or JWK as publicKey to verify RS, PS, ES and EdDSA signatures and check exp and nbf. HMAC (HS*) secrets and alg none are always refused, and keys are never fetched from URLs.

## Authentication

Every call carries your key in an `x-api-key` header. The same key works across the whole
APIVerve catalog — there are no per-API subscriptions. Responses always use the same three
top-level keys: `status`, `error`, and `data`.

## Example request

```bash
curl -X POST "https://api.apiverve.com/v1/jwtdecoder" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"token":"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6InNhbXBsZS1rZXktMSJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaXNzIjoiaHR0cHM6Ly9hdXRoLmV4YW1wbGUuY29tIiwiYXVkIjoiYXBpLmV4YW1wbGUuY29tIiwiaWF0IjoxNzY3MjI1NjAwLCJleHAiOjIwODI3NTg0MDB9.hP0O9ELZGk-KN3upyYqdOnPY2Ig7FAzfUY_xytzOCBIhn0_TWdzl2dbLPlj0rkCDsRIQX0I5t9Xv551VI1W9dmvRGtVztyeD3IKHnIn24baOUtjU7Eb6FHL_iWMu5PqMeQJPFytuYbYhzjjCNfFPgAciGgn1Celr8H7_q51x5naMb-nbTvBc5SIX9MBnegGzabExBYQ-OsdKOoYmK0uymNIgC3834jlPuhuJHkPsxX7ncKoSQ4wheiLaZDwFANlT1NrD2XgKyyh-LIIg9CRwqB_WDktZ_R6UusNkLRhKJ20ff29ttkyRhJZzEqRRK60xYn7iPyg4YQni1J_w-oAa_w","publicKey":"-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA9MiLgWPmLJoEIpAUHVvx\nGyo9vyW9/ryejQyuDZr1m5x0qj5y1otdjN3TwLH1PBQuinSDGiL7O56dfXwy/YIa\nKOhANcJWe78eSDs4oMh3wQnzRfseWZfFgbLHU/nWyXjPE5WRa9F+H5A96KvmatER\nG+kfWUINKR0RUTzox9xSy1KmiaQ5a2GoH3vINioVWBN1zX7Uq6mjCF5nYUMfWDyv\nuUofPWRU2saYdxD2TtVlIs8F62IQU0bnMifFXqmZ5CkmXwPAFJXAIi38Lh/vkOvw\n5B8oeiZd8ZEOLhSYlmhje1IGIwlB8B/ekKnZp4BdKsJYgGka7yn9NTuRsx8U7tfr\n7QIDAQAB\n-----END PUBLIC KEY-----"}'
```

## Parameters

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `token` | string | Yes | JWT token to decode; a pasted Authorization header value (Bearer <token>) is accepted |
| `publicKey` | string | No | Public key to verify the signature with: a PEM public key, a PEM X.509 certificate, or a JWK (as a JSON object or string). Asymmetric algorithms only; HMAC secrets are refused and keys are never fetched from URLs. Omit it to decode only.. Premium field |

## Response fields

- `header` — object · Decoded JWT header, typically containing the signing algorithm and token type
  - `header.alg` — string
  - `header.typ` — string
  - `header.kid` — string
- `payload` — object · Decoded JWT payload containing the token's claims (e.g. subject, issuer, expiration, and any custom claims)
  - `payload.sub` — string
  - `payload.name` — string
  - `payload.iss` — string
  - `payload.aud` — string
  - `payload.iat` — number
  - `payload.exp` — number
- `signature` — string · Raw signature segment of the token (the third dot-separated part); see signatureVerification for the verification result when publicKey is sent
- `isExpired` — boolean · Whether the token's expiration (exp claim) is in the past
- `expiresAt` — string · ISO timestamp of when the token expires (from the exp claim); null if there is no exp claim
- `issuedAt` — string · ISO timestamp of when the token was issued (from iat claim)
- `tokenAge` — string · Human-readable age of the token · (premium)
- `algorithm` — string · Signing algorithm declared in the token header (alg)
- `expiresIn` — number · Seconds until the token expires; negative once expired, null if there is no exp claim
- `notYetValid` — boolean · Whether the token's not-before (nbf) claim is still in the future
- `securityAnalysis` — object · Structural security assessment of the token: unsigned (alg:none) detection, missing expiration, over-long lifetime, and a list of issues. Does not verify the signature. · (premium)
  - `securityAnalysis.isUnsecured` — boolean · (premium)
  - `securityAnalysis.hasExpiration` — boolean · (premium)
  - `securityAnalysis.isLongLived` — boolean · (premium)
  - `securityAnalysis.issues` — array · (premium)
- `warning` — string · Without publicKey, a reminder that the token was decoded but not verified; with publicKey, the verification outcome or the reason it failed
- `signatureVerification` — object · Signature and time-claim check against publicKey; present only when publicKey is sent · (premium)
  - `signatureVerification.verified` — boolean · Whether the signature matches publicKey. Always false for alg none, HS* algorithms, or an algorithm that does not match the key type · (premium)
  - `signatureVerification.algorithm` — string · Algorithm from the token header that verification used · (premium)
  - `signatureVerification.keyType` — string · Type of the supplied key, e.g. RSA, EC P-256 or Ed25519 · (premium)
  - `signatureVerification.reason` — object · Why verification failed; null when verified · (premium)
  - `signatureVerification.claimsValid` — boolean · Whether exp and nbf hold at the current time, reported separately from the signature · (premium)
  - `signatureVerification.claimsReason` — object · Which time claim failed and when; null when claimsValid is true · (premium)

## Sample response

```json
{
  "status": "ok",
  "error": null,
  "data": {
    "header": {
      "alg": "RS256",
      "typ": "JWT",
      "kid": "sample-key-1"
    },
    "payload": {
      "sub": "1234567890",
      "name": "John Doe",
      "iss": "https://auth.example.com",
      "aud": "api.example.com",
      "iat": 1767225600,
      "exp": 2082758400
    },
    "signature": "hP0O9ELZGk-KN3upyYqdOnPY2Ig7FAzfUY_xytzOCBIhn0_TWdzl2dbLPlj0rkCDsRIQX0I5t9Xv551VI1W9dmvRGtVztyeD3IKHnIn24baOUtjU7Eb6FHL_iWMu5PqMeQJPFytuYbYhzjjCNfFPgAciGgn1Celr8H7_q51x5naMb-nbTvBc5SIX9MBnegGzabExBYQ-OsdKOoYmK0uymNIgC3834jlPuhuJHkPsxX7ncKoSQ4wheiLaZDwFANlT1NrD2XgKyyh-LIIg9CRwqB_WDktZ_R6UusNkLRhKJ20ff29ttkyRhJZzEqRRK60xYn7iPyg4YQni1J_w-oAa_w",
    "isExpired": false,
    "expiresAt": "2036-01-01T00:00:00.000Z",
    "issuedAt": "2026-01-01T00:00:00.000Z",
    "tokenAge": "309 days",
    "algorithm": "RS256",
    "expiresIn": 288757380,
    "notYetValid": false,
    "securityAnalysis": {
      "isUnsecured": false,
      "hasExpiration": true,
      "isLongLived": true,
      "issues": [
        "Token lifetime exceeds 24 hours"
      ]
    },
    "warning": "Signature verified with the supplied public key.",
    "signatureVerification": {
      "verified": true,
      "algorithm": "RS256",
      "keyType": "RSA",
      "reason": null,
      "claimsValid": true,
      "claimsReason": null
    }
  }
}
```

## Use cases

- **Token Debugging** — Debug and inspect JWT tokens during development to view header and payload contents
- **Token Analysis** — Analyze token structure and claims for free, and verify the signature against a public key on paid plans
- **Expiration Check** — Check token expiration status and view expiration timestamps
- **Token Inspection** — Inspect token contents for troubleshooting authentication issues

## SDKs

- **npm** — `npm install @apiverve/jwtdecoder` (https://www.npmjs.com/package/@apiverve/jwtdecoder)
- **NuGet** — `dotnet add package APIVerve.API.JWTDecoder` (https://www.nuget.org/packages/APIVerve.API.JWTDecoder)
- **Source** — https://github.com/apiverve/jwtdecoder-api

## More

- Full reference: https://docs.apiverve.com/ref/jwtdecoder
- Get an API key: https://dashboard.apiverve.com
- Full catalog: https://apiverve.com/marketplace
