# JWTPayload

**Kind:** Type

**Source:** [`src/utils/jwt/types.ts`](https://github.com/honojs/hono/blob/main/src/utils/jwt/types.ts#L131)

**Part of:** [Utils](subsystem-src-utils)

JWT Payload

`JWTPayload` describes the decoded payload data carried by a JSON Web Token. JWT parsing, validation, and authorization code can use this type to pass token claims through the application with a shared shape.

## Definition

```ts
{ [key: string]: unknown exp?: number nbf?: number iat?: number iss?: string aud?: string | string[] }
```

## Diagram

```mermaid
graph LR
  Token[JWT] -->|decode and validate| Payload[JWTPayload]
  Payload --> Auth[Authorization logic]
  Payload --> Request[Request context]
```

## Usage

```ts
import type { JWTPayload } from './utils/jwt/types';

declare function getVerifiedPayload(request: Request): JWTPayload;

function authorizeRequest(request: Request) {
  const payload = getVerifiedPayload(request);

  // Read claims declared by JWTPayload before making access decisions.
  return payload;
}
```

## AI Coding Instructions

- Import `JWTPayload` with `import type` when it is only used for TypeScript checking.
- Only create a `JWTPayload` after the JWT has been decoded and validated.
- Keep claim access aligned with the fields declared in `src/utils/jwt/types.ts`.
- Do not treat decoded payload data as trusted until JWT signature and expiry checks have completed.
