Login API response JSON example

Last updated 2026-05-20

Example JSON

Successful POST /auth/login response.

{
  "id": 1,
  "username": "emilys",
  "email": "[email protected]",
  "firstName": "Emily",
  "lastName": "Johnson",
  "image": "https://jsonexamples.com/image/200?text=User+1",
  "accessToken": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxIiwiaWF0IjoxNzAwMDAwMDAwfQ.signature",
  "refreshToken": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxfQ.refreshSig"
}

Request examples

const res = await fetch('https://jsonexamples.com/auth/login', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ username: 'emilys', password: 'emilyspass' })
});
const session = await res.json();

Common variations

Failed login (compare to 401 Unauthorized)
{
  "message": "Invalid credentials",
  "code": "auth/invalid_credentials"
}
Refresh-token response
{
  "accessToken": "eyJ.new.access",
  "refreshToken": "eyJ.new.refresh"
}

Convert this JSON

Generated starting points for TypeScript, JSON Schema, and Zod. Refine before shipping to production.

export interface Login {
  "id": number;
  "username": string;
  "email": string;
  "firstName": string;
  "lastName": string;
  "image": string;
  "accessToken": string;
  "refreshToken": string;
}
Back to examples

Related examples