401 Unauthorized JSON response example
Last updated 2026-05-20
Example JSON
Returned by any auth-protected endpoint when no/expired token is sent.
{
"status": 401,
"error": "Unauthorized",
"message": "Authentication required",
"code": "auth_required",
"authenticateHint": "Bearer realm=\"api\""
}Request examples
const res = await fetch('https://jsonexamples.com/http/401/Authentication+required');
if (!res.ok) {
const err = await res.json();
console.error(res.status, err.message);
}Try the live endpoint
Click below to call /http/401/Authentication+required from your browser.
GET
/http/401/Authentication+required{
"hint": "Click 'Run' to call the live endpoint"
}Common variations
Expired-token variant
{
"status": 401,
"error": "Unauthorized",
"message": "Access token expired",
"code": "token_expired"
}Convert this JSON
Generated starting points for TypeScript, JSON Schema, and Zod. Refine before shipping to production.
export interface 401Unauthorized {
"status": number;
"error": string;
"message": string;
"code": string;
"authenticateHint": string;
}