{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/usewrit-app/json-schema/usewrit-app-secret-schema.json",
  "title": "Secret",
  "description": "Secret METADATA (the value/ciphertext is never returned). `name` mirrors `key` (cloud parity). Credential secrets surface their non-secret `username`; card secrets surface only `card_last4`.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/usewrit-app-secrets-api-openapi.yml#/components/schemas/Secret",
  "type": "object",
  "required": [
    "id",
    "key",
    "name",
    "description",
    "category",
    "is_credential",
    "is_card",
    "username",
    "card_last4",
    "created_at",
    "updated_at",
    "last_used_at",
    "use_count"
  ],
  "properties": {
    "id": {
      "type": "integer",
      "format": "int64"
    },
    "key": {
      "type": "string"
    },
    "name": {
      "type": "string",
      "description": "Alias of `key`."
    },
    "description": {
      "type": [
        "string",
        "null"
      ]
    },
    "category": {
      "type": [
        "string",
        "null"
      ],
      "description": "e.g. `credentials`, `card`, `api_keys`."
    },
    "is_credential": {
      "type": "boolean",
      "description": "True only for a real `{username, password}` pair."
    },
    "is_card": {
      "type": "boolean"
    },
    "username": {
      "type": [
        "string",
        "null"
      ],
      "description": "The credential pair's username (never the password)."
    },
    "card_last4": {
      "type": [
        "string",
        "null"
      ],
      "description": "Last 4 digits of a card secret's number (never the full PAN/CVC)."
    },
    "created_at": {
      "type": "string"
    },
    "updated_at": {
      "type": [
        "string",
        "null"
      ]
    },
    "last_used_at": {
      "type": [
        "string",
        "null"
      ]
    },
    "use_count": {
      "type": [
        "integer",
        "null"
      ],
      "format": "int64"
    }
  }
}