{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/apisign-io/json-schema/apisign-io-stored-fields-schema.json",
  "title": "StoredFields",
  "description": "Field data as stored on a contract or template",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/apisign-io-templates-api-openapi.yml#/components/schemas/StoredFields",
  "type": [
    "object",
    "null"
  ],
  "properties": {
    "fields": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/FieldDefinition"
      }
    },
    "signers": {
      "type": "array",
      "description": "Per-signer field assignments, matched to signers by signing_order",
      "items": {
        "type": "object",
        "properties": {
          "signing_order": {
            "type": "integer"
          },
          "signerFields": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      }
    }
  },
  "$defs": {
    "FieldDefinition": {
      "type": "object",
      "required": [
        "name",
        "type",
        "completedBy"
      ],
      "properties": {
        "name": {
          "type": "string",
          "description": "Variable name without braces"
        },
        "type": {
          "type": "string",
          "description": "signature, initials, signer_name, timestamp, text, email, phone or date"
        },
        "completedBy": {
          "type": "string",
          "enum": [
            "signer",
            "creator"
          ]
        },
        "label": {
          "type": "string",
          "description": "Prompt shown for a text field"
        }
      }
    }
  }
}