New in 2.4: Test runs you can trust See what's new →

Decode a JWT without verifying its signature

GEThttps://api.testingapis.com/api/utils/jwt/decode

Returns the header, the payload and readable exp/iat/nbf claims with an expiry flag. The signature is never verified, so never trust the claims.

Parameters 1

NameTypeDescription
tokenquery · stringThe JWT. If omitted, the Bearer token from the Authorization header is used.

Responses

200
Success.
400
No token, wrong number of parts, or a part is not base64url-encoded JSON.

Example

Request
curl -X GET "https://api.testingapis.com/api/utils/jwt/decode?token={{userJwt}}"
Run in Studio
Response200 OK
{
  "header": {"alg": "HS256", "typ": "JWT"},
  "payload": {
    "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier": "user",
    "http://schemas.microsoft.com/ws/2008/06/identity/claims/role": "user",
    "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress": "user@example.com",
    "jti": "483a95f9-27f2-4fac-8cad-5fbfb00d0864",
    "nbf": 1790792795,
    "exp": 1790793695,
    "iss": "https://api.testingapis.com",
    "aud": "https://api.testingapis.com"
  },
  "signature": "eproOvW-6EYJzoQ8Z6TYiCu90Id1yK-n_tJlKeYKpLY",
  "verified": false,
… (8 more lines)

Code examples

JavaScript (fetch)
const response = await fetch("https://api.testingapis.com/api/utils/jwt/decode?token={{userJwt}}");
console.log(response.status, await response.text());
Python (requests)
import requests

response = requests.request(
    "GET",
    "https://api.testingapis.com/api/utils/jwt/decode?token={{userJwt}}",
    allow_redirects=False,
)
print(response.status_code, response.text)
Java (HttpClient)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        HttpClient client = HttpClient.newBuilder()
            .followRedirects(HttpClient.Redirect.NEVER)
            .build();

        HttpRequest request = HttpRequest.newBuilder()
            .uri(URI.create("https://api.testingapis.com/api/utils/jwt/decode?token={{userJwt}}"))
            .method("GET", HttpRequest.BodyPublishers.noBody())
            .build();

        HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
        System.out.println(response.statusCode() + " " + response.body());
    }
}