screen size not supported

Login API response JSON example

Last updated 2026-05-20

When to use this

Use this for a /auth/login response: the authenticated user payload plus a short-lived access token and a long-lived refresh token. Drop it into a login-form unit test or a session-bootstrap mock.

Example JSON

Successful POST /auth/login response.
{
  "id": 1,
  "username": "emilys",
  "email": "emily.johnson@x.example",
  "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;
}