{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/postzen-dev/json-schema/postzen-dev-api-keys-list-response-schema.json",
  "title": "ApiKeysListResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/postzen-dev-api-keys-api-openapi.yml#/components/schemas/ApiKeysListResponse",
  "type": "object",
  "required": [
    "apiKeys"
  ],
  "properties": {
    "apiKeys": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ApiKey"
      }
    }
  },
  "$defs": {
    "ApiKey": {
      "type": "object",
      "required": [
        "id",
        "name",
        "keyPreview",
        "createdAt",
        "lastUsedAt",
        "scope",
        "profileIds",
        "permission"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "API key id."
        },
        "name": {
          "type": "string",
          "description": "Human-readable label."
        },
        "keyPreview": {
          "type": "string",
          "description": "Masked preview of the key, for example `pzn_live_a1b2c3d4e...`. The full key is never retrievable after creation."
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "lastUsedAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "Last time the key authenticated a request, or `null` if it has never been used."
        },
        "scope": {
          "type": "string",
          "enum": [
            "full",
            "profiles"
          ],
          "description": "`full` grants access to all profiles; `profiles` restricts the key to `profileIds`."
        },
        "profileIds": {
          "type": "array",
          "description": "Profiles the key is restricted to. Empty for full-scope keys.",
          "items": {
            "$ref": "#/$defs/ApiKeyProfileRef"
          }
        },
        "permission": {
          "type": "string",
          "enum": [
            "read-write",
            "read"
          ],
          "description": "`read` keys may only call `GET` endpoints; `read-write` keys may call every endpoint."
        }
      }
    },
    "ApiKeyProfileRef": {
      "type": "object",
      "required": [
        "_id",
        "name",
        "color"
      ],
      "properties": {
        "_id": {
          "type": "string",
          "description": "PostZen profile id."
        },
        "name": {
          "type": "string"
        },
        "color": {
          "type": "string",
          "description": "Hex color in `#rrggbb` format."
        }
      }
    }
  }
}