---
title: "JWT Encode"
method: POST
path: "/jwt/encode"
---

# JWT Encode

`POST /jwt/encode`

## Request

- Base URL: `https://client.apimetrics.io/api/2`
- URL: `https://client.apimetrics.io/api/2/jwt/encode`
- Auth: API key in header `Authorization`
- TypeScript: <https://skmtc.dev/apicontext/apis/api-settings/docs/jwt/encode/post.ts> (a function with typed inputs; its response is checked against the schema)

## Request body

- object
  - `headers` object: The JWT headers
    - `alg` string, required: The algorithm to use to sign the JWT - e.g. HS256, RS256, PS256, none
    - `typ` string: The JWT type
    - `kid` string: The kid of the signing certificate. For signing with KMS, this must be uploaded in the organization Certificates page.
  - `claims` object: The JWT claims or payload
    - `iat` boolean: Issued at time. Use `true` to use the current time. May also be a string duration (e.g. `1m` to specify a time in the future).
    - `nbf` boolean: Valid not before time. Use `true` to use the current time. May also be a string duration (e.g. `1m` to specify a minute in the future).
    - `exp` boolean: The JWT expiry time. Use `true` to use an hour in the future. May also be a string duration (e.g. `1m` to specify a minute in the future).
    - `aud` string: Audience for JWT
    - `sub` string: Subject for JWT
    - `iss` string: Issuer for JWT
    - `jti` string: JWT ID - ensure each new JWT is unique. Recommended to use `%%GUID%%`
  - `key` string: The key to use for signing. DO NOT USE FOR KMS Signing.
  - `output` string: The output format. Use `json` for full output.
  - `override_alg` string: Algorithm to use instead of the headers.alg value - for building a JWS where you provide your own signing. E.g. "none"

## Response `200`

200

---

[API](https://skmtc.dev/apicontext/apis/api-settings.md) - [All operations](https://skmtc.dev/apicontext/apis/api-settings/llms.txt) - [OpenAPI document](https://skmtc.dev/apicontext/apis/api-settings/revisions/2e9a62324e82?raw)
