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

Return a correctly signed JWT that expired an hour ago

GEThttps://api.testingapis.com/api/auth/jwt/expired

Use it against GET /api/auth/jwt/me to test how a client handles 401 for expired tokens.

Responses

200
The expired token.

Example

Request
curl -X GET "https://api.testingapis.com/api/auth/jwt/expired"
Run in Studio
Response200 OK
{
  "accessToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1laWRlbnRpZmllciI…
  "tokenType": "Bearer",
  "expiredAt": "2026-09-30T17:26:38Z",
  "message": "Correctly signed but expired. GET /api/auth/jwt/me with it should return 401.
}

Code examples

JavaScript (fetch)
const response = await fetch("https://api.testingapis.com/api/auth/jwt/expired");
console.log(response.status, await response.text());
Python (requests)
import requests

response = requests.request(
    "GET",
    "https://api.testingapis.com/api/auth/jwt/expired",
    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/auth/jwt/expired"))
            .method("GET", HttpRequest.BodyPublishers.noBody())
            .build();

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