{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/usps/json-schema/usps-resource-owner-claims-schema.json",
  "title": "Resource Owner/User Claims",
  "description": "The claims collected for the user when they have authorized access to a third-party client application. The claims collected for each application may be unique, based on default and optional claims.",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/usps-userinfo-openapi.yml#/components/schemas/ResourceOwnerClaims",
  "readOnly": true,
  "required": [
    "sub"
  ],
  "allOf": [
    {
      "$ref": "#/$defs/StandardClaims"
    },
    {
      "$ref": "#/$defs/AdditionalClaims"
    },
    {
      "type": "object"
    }
  ],
  "additionalProperties": true,
  "$defs": {
    "Accounts": {
      "title": "EPS Payment Accounts",
      "description": "A list of EPS payment account identifiers.",
      "type": "string"
    },
    "AdditionalClaims": {
      "title": "Additional Claims",
      "description": "Claims collected and assertions made about an authenticated user and USPS customer. Additional, USPS-specific claims collected and asserted about a USPS customer.",
      "readOnly": true,
      "type": "object",
      "properties": {
        "payment_accounts": {
          "description": "A list of payment accounts which have been authorized by the USPS customer for use by the third-party application for payment of USPS goods and services. An EPS payment account or a permit may be used for payment.",
          "type": "object",
          "properties": {
            "accounts": {
              "$ref": "#/$defs/Accounts"
            },
            "permits": {
              "$ref": "#/$defs/Permits"
            }
          },
          "additionalProperties": false
        },
        "mail_owners": {
          "description": "The mail owner claims belonging to the resource owner/user.",
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "crid": {
                "$ref": "#/$defs/CRID"
              },
              "mids": {
                "description": "A list of comma and space separated mailer Identifiers.",
                "type": "string"
              }
            },
            "additionalProperties": false
          }
        }
      },
      "additionalProperties": true
    },
    "CRID": {
      "title": "Customer Registration Identifier",
      "description": "A specific business location identified in a mailing.",
      "readOnly": true,
      "type": "string",
      "minLength": 8,
      "maxLength": 16
    },
    "Permits": {
      "title": "Permit Numbers",
      "description": "A list of permit numbers, each assigned to a ZIP code.",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "permitNumber": {
            "description": "A permit number.",
            "type": "string"
          },
          "permitZIP": {
            "description": "The ZIP code to which the permit is assigned.",
            "type": "string"
          }
        },
        "additionalProperties": false
      }
    },
    "StandardClaims": {
      "title": "IANA Registered, Standard Claims",
      "description": "Claims collected and assertions made about an authenticated user and USPS customer. Industry-standard claims whose names are officially registered in Internet Assigned Numbers Authority (IANA) for OpenID Connect use.",
      "readOnly": true,
      "type": "object",
      "properties": {
        "sub": {
          "description": "The unique identifier of the user's account.",
          "type": "string"
        },
        "updated_at": {
          "description": "The date and time that the user's account information has been updated.",
          "type": "string",
          "format": "date"
        }
      },
      "additionalProperties": true
    }
  }
}