{
  "openapi": "3.1.0",
  "x-fern-explorer": false,
  "info": {
    "title": "Ediphai API",
    "version": "1.0.0",
    "description": "ediphai.record/v1. Responses are open: ignore unknown fields, and treat an unknown state or rule as not terminal."
  },
  "servers": [
    {
      "url": "https://apps.ediphai.com"
    }
  ],
  "security": [
    {
      "bearerKey": []
    }
  ],
  "paths": {
    "/v1/definitions/{key}/versions/{version}": {
      "parameters": [
        {
          "name": "key",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "version",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "put": {
        "operationId": "putDefinition",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Definition"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Unchanged: this version was already stored with the same definition",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefinitionReceipt"
                }
              }
            }
          },
          "201": {
            "description": "Stored and applied, on a test or a live key",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DefinitionReceipt"
                }
              }
            }
          },
          "4XX": {
            "description": "Refused: read rule, pointer, fix and retryable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "5XX": {
            "description": "Refused: read rule, pointer, fix and retryable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/records/{record_type}/{record_id}": {
      "parameters": [
        {
          "name": "record_type",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "record_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "get": {
        "description": "Read the current revision without its body, subjects or person-link outcome. Needs records:status. A deleted record answers 410.",
        "operationId": "getRecordStatus",
        "responses": {
          "200": {
            "description": "Current record receipt",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecordReceipt"
                }
              }
            }
          },
          "410": {
            "description": "Deleted record receipt with a null hash",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletedRecordReceipt"
                }
              }
            }
          },
          "4XX": {
            "description": "Refused: read rule, pointer, fix and retryable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "5XX": {
            "description": "Refused: read rule, pointer, fix and retryable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "description": "Delete one record. It is hidden from every view once the next build runs, and any later revision of it is refused with `deleted`. Needs the records:delete scope.",
        "operationId": "deleteRecord",
        "responses": {
          "200": {
            "description": "Deleted, or already deleted: the receipt with state deleted and a null hash",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletedRecordReceipt"
                }
              }
            }
          },
          "4XX": {
            "description": "Refused: read rule, pointer, fix and retryable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "5XX": {
            "description": "Refused: read rule, pointer, fix and retryable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/records/{record_type}/{record_id}/sections/{section}": {
      "parameters": [
        {
          "name": "record_type",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "record_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        },
        {
          "name": "section",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "delete": {
        "description": "Delete one section of a record. It is hidden from every view once the next build runs, in every revision of the record, later ones included; the record and its other sections stay. Needs the records:delete scope.",
        "operationId": "deleteSection",
        "responses": {
          "200": {
            "description": "Deleted, or already deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletedSectionReceipt"
                }
              }
            }
          },
          "4XX": {
            "description": "Refused: read rule, pointer, fix and retryable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "5XX": {
            "description": "Refused: read rule, pointer, fix and retryable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/subjects/{external_id}": {
      "parameters": [
        {
          "name": "external_id",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          }
        }
      ],
      "delete": {
        "description": "Delete every record of one subject from this source, up to a page per call: each is hidden from every view once the next build runs, and any later revision of it is refused with `deleted`. Any reviewer's decision about who the subject is is dropped, so a new record for the subject is linked on its own evidence. Call again until `complete` is true. Needs the records:delete scope.",
        "operationId": "deleteSubject",
        "responses": {
          "200": {
            "description": "Deleted up to a page; complete says whether any record remains",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeletedSubjectReceipt"
                }
              }
            }
          },
          "4XX": {
            "description": "Refused: read rule, pointer, fix and retryable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "5XX": {
            "description": "Refused: read rule, pointer, fix and retryable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/v1/records": {
      "get": {
        "description": "List current heads from this source by received_at, including deletions. Needs records:status. Follow next_cursor until null.",
        "parameters": [
          {
            "name": "since",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "RFC 3339 timestamp with an offset; inclusive"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500
            },
            "description": "Page size; defaults to 500"
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Opaque next_cursor from the previous page; send unchanged"
          }
        ],
        "operationId": "reconcileRecords",
        "responses": {
          "200": {
            "description": "One page of current record heads",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReconciliationPage"
                }
              }
            }
          },
          "4XX": {
            "description": "Refused: read rule, pointer, fix and retryable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "5XX": {
            "description": "Refused: read rule, pointer, fix and retryable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "parameters": [
          {
            "name": "validate",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "true",
                "false"
              ]
            },
            "description": "true: run every check a real submission runs and store nothing"
          }
        ],
        "operationId": "postRecords",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "allOf": [
                      {
                        "$ref": "#/components/schemas/Envelope"
                      },
                      {
                        "type": "object",
                        "properties": {
                          "record_type": {
                            "const": "formation.assessment_result"
                          },
                          "record_type_version": {
                            "const": 1
                          },
                          "body": {
                            "$ref": "#/components/schemas/AssessmentResultBody"
                          }
                        }
                      }
                    ]
                  },
                  {
                    "type": "object",
                    "required": [
                      "records"
                    ],
                    "additionalProperties": false,
                    "description": "A batch: at most 100 records and at most 5 MB in all",
                    "properties": {
                      "records": {
                        "type": "array",
                        "minItems": 1,
                        "maxItems": 100,
                        "items": {
                          "allOf": [
                            {
                              "$ref": "#/components/schemas/Envelope"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "record_type": {
                                  "const": "formation.assessment_result"
                                },
                                "record_type_version": {
                                  "const": 1
                                },
                                "body": {
                                  "$ref": "#/components/schemas/AssessmentResultBody"
                                }
                              }
                            }
                          ]
                        }
                      }
                    }
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "One record: a duplicate of a stored revision, or valid in validate mode. A batch: one outcome per record",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/RecordReceipt"
                    },
                    {
                      "$ref": "#/components/schemas/RecordBatchResult"
                    }
                  ]
                }
              }
            }
          },
          "202": {
            "description": "Stored durably; the receipt names its processing state",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RecordReceipt"
                }
              }
            }
          },
          "4XX": {
            "description": "Refused: read rule, pointer, fix and retryable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "5XX": {
            "description": "Refused: read rule, pointer, fix and retryable",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "ediphai_test_... or ediphai_live_..."
      }
    },
    "schemas": {
      "Envelope": {
        "title": "Envelope",
        "type": "object",
        "properties": {
          "record_type": {
            "type": "string",
            "maxLength": 128,
            "pattern": "^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*)*$"
          },
          "record_type_version": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991
          },
          "record_id": {
            "type": "string",
            "pattern": "^[A-Za-z0-9._:-]{1,128}$",
            "description": "Unique within (source, record_type)"
          },
          "revision": {
            "type": "integer",
            "exclusiveMinimum": 0,
            "maximum": 9007199254740991,
            "description": "Monotonic per record; a millisecond timestamp is allowed"
          },
          "occurred_at": {
            "type": "string",
            "pattern": "^(\\d{4})(?:-(\\d{2})(?:-(\\d{2})(?:T(\\d{2}):(\\d{2}):(\\d{2})(?:\\.\\d{1,9})?(?:Z|[+-](\\d{2}):(\\d{2})))?)?)?$",
            "description": "An RFC 3339 timestamp with an offset (2026-10-12T19:04:11Z), a day (2003-05-04), a month (2003-05) or a year (2003)"
          },
          "subjects": {
            "minItems": 1,
            "maxItems": 50,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "role": {
                  "type": "string",
                  "pattern": "^[a-z][a-z0-9_]{0,63}$",
                  "description": "Identifier for every section, item, role, level, qualifier and declarer: a lowercase letter, then lowercase letters, digits or underscores, at most 64 characters"
                },
                "external_id": {
                  "type": "string",
                  "pattern": "^[A-Za-z0-9._:-]{1,128}$",
                  "description": "One namespace per source across all its record types"
                },
                "claims": {
                  "type": "object",
                  "properties": {
                    "source_refs": {
                      "maxItems": 10,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "system": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 64,
                            "description": "A referenceable people source in the church's registry, otherwise 422"
                          },
                          "id": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 128
                          },
                          "basis": {
                            "type": "string",
                            "enum": [
                              "staff_assigned",
                              "staff_entered",
                              "lookup_confirmed",
                              "self_reported"
                            ]
                          }
                        },
                        "required": [
                          "system",
                          "id",
                          "basis"
                        ],
                        "additionalProperties": false
                      }
                    },
                    "first_name": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "last_name": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "date_of_birth": {
                      "type": "string",
                      "pattern": "^(\\d{4})(?:-(\\d{2})(?:-(\\d{2})(?:T(\\d{2}):(\\d{2}):(\\d{2})(?:\\.\\d{1,9})?(?:Z|[+-](\\d{2}):(\\d{2})))?)?)?$",
                      "description": "A full date (1986-03-14)"
                    },
                    "birth_year": {
                      "description": "For sources that know only the year. Never send it with date_of_birth",
                      "type": "integer",
                      "minimum": 1000,
                      "maximum": 9999
                    },
                    "email": {
                      "type": "string",
                      "minLength": 3,
                      "maxLength": 320
                    },
                    "phone_e164": {
                      "type": "string",
                      "format": "e164",
                      "pattern": "^\\+[1-9]\\d{6,14}$"
                    },
                    "phone_verified": {
                      "type": "boolean"
                    }
                  },
                  "additionalProperties": false,
                  "not": {
                    "required": [
                      "date_of_birth",
                      "birth_year"
                    ]
                  }
                }
              },
              "required": [
                "role",
                "external_id"
              ],
              "additionalProperties": false
            }
          },
          "consent": {
            "description": "Optional provenance, stored as sent, never interpreted",
            "type": "object",
            "properties": {
              "captured_at": {
                "type": "string",
                "pattern": "^(\\d{4})(?:-(\\d{2})(?:-(\\d{2})(?:T(\\d{2}):(\\d{2}):(\\d{2})(?:\\.\\d{1,9})?(?:Z|[+-](\\d{2}):(\\d{2})))?)?)?$",
                "description": "An RFC 3339 timestamp with an offset (2026-10-12T19:04:11Z), a day (2003-05-04), a month (2003-05) or a year (2003)"
              },
              "policy_ref": {
                "type": "string",
                "maxLength": 200
              }
            },
            "additionalProperties": {}
          },
          "body": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {},
            "description": "Validated against record_type@record_type_version and its definition"
          },
          "source_detail": {
            "description": "At most 32 KB; stored, never modelled",
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {}
          }
        },
        "required": [
          "record_type",
          "record_type_version",
          "record_id",
          "revision",
          "occurred_at",
          "subjects",
          "body"
        ],
        "additionalProperties": false
      },
      "Definition": {
        "title": "Definition",
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "pattern": "^([a-z][a-z0-9_]{0,63}\\.)?[a-z][a-z0-9_]{0,63}$",
            "description": "A key. Platform definitions prefix their declarer's namespace (rock.disc); church keys never contain a dot"
          },
          "declarer": {
            "description": "The declaring source, or a platform namespace such as rock",
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]{0,63}$"
          },
          "scope": {
            "description": "church unless a platform seed declares global",
            "type": "string",
            "enum": [
              "church",
              "global"
            ]
          },
          "kind": {
            "type": "string",
            "enum": [
              "assessment"
            ]
          },
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "supersedes": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$",
                "description": "The app's own version label"
              },
              {
                "type": "null"
              }
            ]
          },
          "roles": {
            "minItems": 1,
            "maxItems": 10,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string",
                  "pattern": "^[a-z][a-z0-9_]{0,63}$",
                  "description": "Identifier for every section, item, role, level, qualifier and declarer: a lowercase letter, then lowercase letters, digits or underscores, at most 64 characters"
                },
                "min": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "max": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "key",
                "min",
                "max"
              ],
              "additionalProperties": false
            }
          },
          "respondents": {
            "description": "Who may answer; self only when not declared",
            "minItems": 1,
            "maxItems": 10,
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "self"
                    }
                  },
                  "required": [
                    "kind"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "const": "observer"
                    },
                    "role": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_]{0,63}$",
                      "description": "Identifier for every section, item, role, level, qualifier and declarer: a lowercase letter, then lowercase letters, digits or underscores, at most 64 characters"
                    },
                    "min_count": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "kind",
                    "role",
                    "min_count"
                  ],
                  "additionalProperties": false
                }
              ]
            }
          },
          "sections": {
            "minItems": 1,
            "maxItems": 50,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string",
                  "pattern": "^[a-z][a-z0-9_]{0,63}$",
                  "description": "Identifier for every section, item, role, level, qualifier and declarer: a lowercase letter, then lowercase letters, digits or underscores, at most 64 characters"
                },
                "label": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "order": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "sensitivity": {
                  "type": "string",
                  "enum": [
                    "standard",
                    "restricted"
                  ]
                },
                "sensitivity_categories": {
                  "minItems": 1,
                  "maxItems": 11,
                  "type": "array",
                  "items": {
                    "type": "string",
                    "enum": [
                      "identity",
                      "contact",
                      "demographic",
                      "financial",
                      "health",
                      "pastoral",
                      "safety",
                      "formation",
                      "engagement",
                      "none",
                      "unclassified"
                    ]
                  },
                  "description": "Why the data is sensitive. Inherited from section to item; defaults to formation for assessments. Enforces nothing"
                }
              },
              "required": [
                "key",
                "label",
                "order"
              ],
              "additionalProperties": false
            }
          },
          "items": {
            "minItems": 1,
            "maxItems": 1000,
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "key": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_]{0,63}$",
                      "description": "Identifier for every section, item, role, level, qualifier and declarer: a lowercase letter, then lowercase letters, digits or underscores, at most 64 characters"
                    },
                    "section": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_]{0,63}$",
                      "description": "Identifier for every section, item, role, level, qualifier and declarer: a lowercase letter, then lowercase letters, digits or underscores, at most 64 characters"
                    },
                    "label": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "description": {
                      "type": "string",
                      "maxLength": 2000
                    },
                    "sensitivity": {
                      "type": "string",
                      "enum": [
                        "standard",
                        "restricted"
                      ]
                    },
                    "sensitivity_categories": {
                      "minItems": 1,
                      "maxItems": 11,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "identity",
                          "contact",
                          "demographic",
                          "financial",
                          "health",
                          "pastoral",
                          "safety",
                          "formation",
                          "engagement",
                          "none",
                          "unclassified"
                        ]
                      },
                      "description": "Why the data is sensitive. Inherited from section to item; defaults to formation for assessments. Enforces nothing"
                    },
                    "qualifiers": {
                      "maxItems": 20,
                      "type": "array",
                      "items": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "key": {
                                "type": "string",
                                "pattern": "^[a-z][a-z0-9_]{0,63}$",
                                "description": "Identifier for every section, item, role, level, qualifier and declarer: a lowercase letter, then lowercase letters, digits or underscores, at most 64 characters"
                              },
                              "value_type": {
                                "type": "string",
                                "const": "category"
                              },
                              "categories": {
                                "minItems": 1,
                                "maxItems": 500,
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 200
                                }
                              }
                            },
                            "required": [
                              "key",
                              "value_type",
                              "categories"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "key": {
                                "type": "string",
                                "pattern": "^[a-z][a-z0-9_]{0,63}$",
                                "description": "Identifier for every section, item, role, level, qualifier and declarer: a lowercase letter, then lowercase letters, digits or underscores, at most 64 characters"
                              },
                              "value_type": {
                                "type": "string",
                                "const": "number"
                              },
                              "min": {
                                "type": "number"
                              },
                              "max": {
                                "type": "number"
                              }
                            },
                            "required": [
                              "key",
                              "value_type"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "reverse_keyed": {
                      "type": "boolean"
                    },
                    "value_type": {
                      "type": "string",
                      "const": "score"
                    },
                    "scale": {
                      "type": "object",
                      "properties": {
                        "min": {
                          "type": "number"
                        },
                        "max": {
                          "type": "number"
                        },
                        "step": {
                          "type": "number",
                          "exclusiveMinimum": 0
                        },
                        "higher_means": {
                          "type": "string",
                          "maxLength": 100
                        }
                      },
                      "required": [
                        "min",
                        "max"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "key",
                    "section",
                    "label",
                    "value_type",
                    "scale"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "key": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_]{0,63}$",
                      "description": "Identifier for every section, item, role, level, qualifier and declarer: a lowercase letter, then lowercase letters, digits or underscores, at most 64 characters"
                    },
                    "section": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_]{0,63}$",
                      "description": "Identifier for every section, item, role, level, qualifier and declarer: a lowercase letter, then lowercase letters, digits or underscores, at most 64 characters"
                    },
                    "label": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "description": {
                      "type": "string",
                      "maxLength": 2000
                    },
                    "sensitivity": {
                      "type": "string",
                      "enum": [
                        "standard",
                        "restricted"
                      ]
                    },
                    "sensitivity_categories": {
                      "minItems": 1,
                      "maxItems": 11,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "identity",
                          "contact",
                          "demographic",
                          "financial",
                          "health",
                          "pastoral",
                          "safety",
                          "formation",
                          "engagement",
                          "none",
                          "unclassified"
                        ]
                      },
                      "description": "Why the data is sensitive. Inherited from section to item; defaults to formation for assessments. Enforces nothing"
                    },
                    "qualifiers": {
                      "maxItems": 20,
                      "type": "array",
                      "items": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "key": {
                                "type": "string",
                                "pattern": "^[a-z][a-z0-9_]{0,63}$",
                                "description": "Identifier for every section, item, role, level, qualifier and declarer: a lowercase letter, then lowercase letters, digits or underscores, at most 64 characters"
                              },
                              "value_type": {
                                "type": "string",
                                "const": "category"
                              },
                              "categories": {
                                "minItems": 1,
                                "maxItems": 500,
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 200
                                }
                              }
                            },
                            "required": [
                              "key",
                              "value_type",
                              "categories"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "key": {
                                "type": "string",
                                "pattern": "^[a-z][a-z0-9_]{0,63}$",
                                "description": "Identifier for every section, item, role, level, qualifier and declarer: a lowercase letter, then lowercase letters, digits or underscores, at most 64 characters"
                              },
                              "value_type": {
                                "type": "string",
                                "const": "number"
                              },
                              "min": {
                                "type": "number"
                              },
                              "max": {
                                "type": "number"
                              }
                            },
                            "required": [
                              "key",
                              "value_type"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "reverse_keyed": {
                      "type": "boolean"
                    },
                    "value_type": {
                      "type": "string",
                      "const": "ordinal"
                    },
                    "levels": {
                      "minItems": 2,
                      "maxItems": 100,
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "key": {
                            "type": "string",
                            "pattern": "^[a-z][a-z0-9_]{0,63}$",
                            "description": "Identifier for every section, item, role, level, qualifier and declarer: a lowercase letter, then lowercase letters, digits or underscores, at most 64 characters"
                          },
                          "label": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 200
                          }
                        },
                        "required": [
                          "key",
                          "label"
                        ],
                        "additionalProperties": false
                      },
                      "description": "Ordered, lowest first"
                    }
                  },
                  "required": [
                    "key",
                    "section",
                    "label",
                    "value_type",
                    "levels"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "key": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_]{0,63}$",
                      "description": "Identifier for every section, item, role, level, qualifier and declarer: a lowercase letter, then lowercase letters, digits or underscores, at most 64 characters"
                    },
                    "section": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_]{0,63}$",
                      "description": "Identifier for every section, item, role, level, qualifier and declarer: a lowercase letter, then lowercase letters, digits or underscores, at most 64 characters"
                    },
                    "label": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "description": {
                      "type": "string",
                      "maxLength": 2000
                    },
                    "sensitivity": {
                      "type": "string",
                      "enum": [
                        "standard",
                        "restricted"
                      ]
                    },
                    "sensitivity_categories": {
                      "minItems": 1,
                      "maxItems": 11,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "identity",
                          "contact",
                          "demographic",
                          "financial",
                          "health",
                          "pastoral",
                          "safety",
                          "formation",
                          "engagement",
                          "none",
                          "unclassified"
                        ]
                      },
                      "description": "Why the data is sensitive. Inherited from section to item; defaults to formation for assessments. Enforces nothing"
                    },
                    "qualifiers": {
                      "maxItems": 20,
                      "type": "array",
                      "items": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "key": {
                                "type": "string",
                                "pattern": "^[a-z][a-z0-9_]{0,63}$",
                                "description": "Identifier for every section, item, role, level, qualifier and declarer: a lowercase letter, then lowercase letters, digits or underscores, at most 64 characters"
                              },
                              "value_type": {
                                "type": "string",
                                "const": "category"
                              },
                              "categories": {
                                "minItems": 1,
                                "maxItems": 500,
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 200
                                }
                              }
                            },
                            "required": [
                              "key",
                              "value_type",
                              "categories"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "key": {
                                "type": "string",
                                "pattern": "^[a-z][a-z0-9_]{0,63}$",
                                "description": "Identifier for every section, item, role, level, qualifier and declarer: a lowercase letter, then lowercase letters, digits or underscores, at most 64 characters"
                              },
                              "value_type": {
                                "type": "string",
                                "const": "number"
                              },
                              "min": {
                                "type": "number"
                              },
                              "max": {
                                "type": "number"
                              }
                            },
                            "required": [
                              "key",
                              "value_type"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "reverse_keyed": {
                      "type": "boolean"
                    },
                    "value_type": {
                      "type": "string",
                      "const": "rank"
                    },
                    "rank": {
                      "type": "object",
                      "properties": {
                        "total": {
                          "type": "integer",
                          "minimum": 1,
                          "maximum": 9007199254740991
                        },
                        "direction": {
                          "type": "string",
                          "enum": [
                            "one_is_strongest",
                            "total_is_strongest"
                          ]
                        }
                      },
                      "required": [
                        "total",
                        "direction"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "key",
                    "section",
                    "label",
                    "value_type",
                    "rank"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "key": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_]{0,63}$",
                      "description": "Identifier for every section, item, role, level, qualifier and declarer: a lowercase letter, then lowercase letters, digits or underscores, at most 64 characters"
                    },
                    "section": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_]{0,63}$",
                      "description": "Identifier for every section, item, role, level, qualifier and declarer: a lowercase letter, then lowercase letters, digits or underscores, at most 64 characters"
                    },
                    "label": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "description": {
                      "type": "string",
                      "maxLength": 2000
                    },
                    "sensitivity": {
                      "type": "string",
                      "enum": [
                        "standard",
                        "restricted"
                      ]
                    },
                    "sensitivity_categories": {
                      "minItems": 1,
                      "maxItems": 11,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "identity",
                          "contact",
                          "demographic",
                          "financial",
                          "health",
                          "pastoral",
                          "safety",
                          "formation",
                          "engagement",
                          "none",
                          "unclassified"
                        ]
                      },
                      "description": "Why the data is sensitive. Inherited from section to item; defaults to formation for assessments. Enforces nothing"
                    },
                    "qualifiers": {
                      "maxItems": 20,
                      "type": "array",
                      "items": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "key": {
                                "type": "string",
                                "pattern": "^[a-z][a-z0-9_]{0,63}$",
                                "description": "Identifier for every section, item, role, level, qualifier and declarer: a lowercase letter, then lowercase letters, digits or underscores, at most 64 characters"
                              },
                              "value_type": {
                                "type": "string",
                                "const": "category"
                              },
                              "categories": {
                                "minItems": 1,
                                "maxItems": 500,
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 200
                                }
                              }
                            },
                            "required": [
                              "key",
                              "value_type",
                              "categories"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "key": {
                                "type": "string",
                                "pattern": "^[a-z][a-z0-9_]{0,63}$",
                                "description": "Identifier for every section, item, role, level, qualifier and declarer: a lowercase letter, then lowercase letters, digits or underscores, at most 64 characters"
                              },
                              "value_type": {
                                "type": "string",
                                "const": "number"
                              },
                              "min": {
                                "type": "number"
                              },
                              "max": {
                                "type": "number"
                              }
                            },
                            "required": [
                              "key",
                              "value_type"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "reverse_keyed": {
                      "type": "boolean"
                    },
                    "value_type": {
                      "type": "string",
                      "const": "category"
                    },
                    "categories": {
                      "minItems": 1,
                      "maxItems": 500,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      }
                    }
                  },
                  "required": [
                    "key",
                    "section",
                    "label",
                    "value_type",
                    "categories"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "key": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_]{0,63}$",
                      "description": "Identifier for every section, item, role, level, qualifier and declarer: a lowercase letter, then lowercase letters, digits or underscores, at most 64 characters"
                    },
                    "section": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_]{0,63}$",
                      "description": "Identifier for every section, item, role, level, qualifier and declarer: a lowercase letter, then lowercase letters, digits or underscores, at most 64 characters"
                    },
                    "label": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "description": {
                      "type": "string",
                      "maxLength": 2000
                    },
                    "sensitivity": {
                      "type": "string",
                      "enum": [
                        "standard",
                        "restricted"
                      ]
                    },
                    "sensitivity_categories": {
                      "minItems": 1,
                      "maxItems": 11,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "identity",
                          "contact",
                          "demographic",
                          "financial",
                          "health",
                          "pastoral",
                          "safety",
                          "formation",
                          "engagement",
                          "none",
                          "unclassified"
                        ]
                      },
                      "description": "Why the data is sensitive. Inherited from section to item; defaults to formation for assessments. Enforces nothing"
                    },
                    "qualifiers": {
                      "maxItems": 20,
                      "type": "array",
                      "items": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "key": {
                                "type": "string",
                                "pattern": "^[a-z][a-z0-9_]{0,63}$",
                                "description": "Identifier for every section, item, role, level, qualifier and declarer: a lowercase letter, then lowercase letters, digits or underscores, at most 64 characters"
                              },
                              "value_type": {
                                "type": "string",
                                "const": "category"
                              },
                              "categories": {
                                "minItems": 1,
                                "maxItems": 500,
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 200
                                }
                              }
                            },
                            "required": [
                              "key",
                              "value_type",
                              "categories"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "key": {
                                "type": "string",
                                "pattern": "^[a-z][a-z0-9_]{0,63}$",
                                "description": "Identifier for every section, item, role, level, qualifier and declarer: a lowercase letter, then lowercase letters, digits or underscores, at most 64 characters"
                              },
                              "value_type": {
                                "type": "string",
                                "const": "number"
                              },
                              "min": {
                                "type": "number"
                              },
                              "max": {
                                "type": "number"
                              }
                            },
                            "required": [
                              "key",
                              "value_type"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "reverse_keyed": {
                      "type": "boolean"
                    },
                    "value_type": {
                      "type": "string",
                      "const": "ordered_list"
                    },
                    "categories": {
                      "minItems": 1,
                      "maxItems": 500,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 200
                      }
                    },
                    "min_items": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 9007199254740991
                    },
                    "max_items": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 9007199254740991
                    },
                    "unique": {
                      "description": "Values are distinct unless this is false",
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "key",
                    "section",
                    "label",
                    "value_type",
                    "categories"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "key": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_]{0,63}$",
                      "description": "Identifier for every section, item, role, level, qualifier and declarer: a lowercase letter, then lowercase letters, digits or underscores, at most 64 characters"
                    },
                    "section": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_]{0,63}$",
                      "description": "Identifier for every section, item, role, level, qualifier and declarer: a lowercase letter, then lowercase letters, digits or underscores, at most 64 characters"
                    },
                    "label": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "description": {
                      "type": "string",
                      "maxLength": 2000
                    },
                    "sensitivity": {
                      "type": "string",
                      "enum": [
                        "standard",
                        "restricted"
                      ]
                    },
                    "sensitivity_categories": {
                      "minItems": 1,
                      "maxItems": 11,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "identity",
                          "contact",
                          "demographic",
                          "financial",
                          "health",
                          "pastoral",
                          "safety",
                          "formation",
                          "engagement",
                          "none",
                          "unclassified"
                        ]
                      },
                      "description": "Why the data is sensitive. Inherited from section to item; defaults to formation for assessments. Enforces nothing"
                    },
                    "qualifiers": {
                      "maxItems": 20,
                      "type": "array",
                      "items": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "key": {
                                "type": "string",
                                "pattern": "^[a-z][a-z0-9_]{0,63}$",
                                "description": "Identifier for every section, item, role, level, qualifier and declarer: a lowercase letter, then lowercase letters, digits or underscores, at most 64 characters"
                              },
                              "value_type": {
                                "type": "string",
                                "const": "category"
                              },
                              "categories": {
                                "minItems": 1,
                                "maxItems": 500,
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 200
                                }
                              }
                            },
                            "required": [
                              "key",
                              "value_type",
                              "categories"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "key": {
                                "type": "string",
                                "pattern": "^[a-z][a-z0-9_]{0,63}$",
                                "description": "Identifier for every section, item, role, level, qualifier and declarer: a lowercase letter, then lowercase letters, digits or underscores, at most 64 characters"
                              },
                              "value_type": {
                                "type": "string",
                                "const": "number"
                              },
                              "min": {
                                "type": "number"
                              },
                              "max": {
                                "type": "number"
                              }
                            },
                            "required": [
                              "key",
                              "value_type"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "reverse_keyed": {
                      "type": "boolean"
                    },
                    "value_type": {
                      "type": "string",
                      "const": "selected"
                    }
                  },
                  "required": [
                    "key",
                    "section",
                    "label",
                    "value_type"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "key": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_]{0,63}$",
                      "description": "Identifier for every section, item, role, level, qualifier and declarer: a lowercase letter, then lowercase letters, digits or underscores, at most 64 characters"
                    },
                    "section": {
                      "type": "string",
                      "pattern": "^[a-z][a-z0-9_]{0,63}$",
                      "description": "Identifier for every section, item, role, level, qualifier and declarer: a lowercase letter, then lowercase letters, digits or underscores, at most 64 characters"
                    },
                    "label": {
                      "type": "string",
                      "minLength": 1,
                      "maxLength": 200
                    },
                    "description": {
                      "type": "string",
                      "maxLength": 2000
                    },
                    "sensitivity": {
                      "type": "string",
                      "enum": [
                        "standard",
                        "restricted"
                      ]
                    },
                    "sensitivity_categories": {
                      "minItems": 1,
                      "maxItems": 11,
                      "type": "array",
                      "items": {
                        "type": "string",
                        "enum": [
                          "identity",
                          "contact",
                          "demographic",
                          "financial",
                          "health",
                          "pastoral",
                          "safety",
                          "formation",
                          "engagement",
                          "none",
                          "unclassified"
                        ]
                      },
                      "description": "Why the data is sensitive. Inherited from section to item; defaults to formation for assessments. Enforces nothing"
                    },
                    "qualifiers": {
                      "maxItems": 20,
                      "type": "array",
                      "items": {
                        "oneOf": [
                          {
                            "type": "object",
                            "properties": {
                              "key": {
                                "type": "string",
                                "pattern": "^[a-z][a-z0-9_]{0,63}$",
                                "description": "Identifier for every section, item, role, level, qualifier and declarer: a lowercase letter, then lowercase letters, digits or underscores, at most 64 characters"
                              },
                              "value_type": {
                                "type": "string",
                                "const": "category"
                              },
                              "categories": {
                                "minItems": 1,
                                "maxItems": 500,
                                "type": "array",
                                "items": {
                                  "type": "string",
                                  "minLength": 1,
                                  "maxLength": 200
                                }
                              }
                            },
                            "required": [
                              "key",
                              "value_type",
                              "categories"
                            ],
                            "additionalProperties": false
                          },
                          {
                            "type": "object",
                            "properties": {
                              "key": {
                                "type": "string",
                                "pattern": "^[a-z][a-z0-9_]{0,63}$",
                                "description": "Identifier for every section, item, role, level, qualifier and declarer: a lowercase letter, then lowercase letters, digits or underscores, at most 64 characters"
                              },
                              "value_type": {
                                "type": "string",
                                "const": "number"
                              },
                              "min": {
                                "type": "number"
                              },
                              "max": {
                                "type": "number"
                              }
                            },
                            "required": [
                              "key",
                              "value_type"
                            ],
                            "additionalProperties": false
                          }
                        ]
                      }
                    },
                    "reverse_keyed": {
                      "type": "boolean"
                    },
                    "value_type": {
                      "type": "string",
                      "const": "text"
                    },
                    "max_length": {
                      "description": "Characters; 10,000 when not declared",
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 100000
                    }
                  },
                  "required": [
                    "key",
                    "section",
                    "label",
                    "value_type"
                  ],
                  "additionalProperties": false
                }
              ]
            }
          },
          "reading": {
            "type": "object",
            "properties": {
              "primary": {
                "type": "string",
                "enum": [
                  "source_primary",
                  "none"
                ]
              },
              "order_by": {
                "type": "string",
                "enum": [
                  "source_rank",
                  "value",
                  "none"
                ]
              }
            },
            "required": [
              "primary",
              "order_by"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "kind",
          "name",
          "roles",
          "sections",
          "items"
        ],
        "additionalProperties": false
      },
      "DefinitionReceipt": {
        "title": "DefinitionReceipt",
        "type": "object",
        "properties": {
          "key": {
            "type": "string"
          },
          "version": {
            "type": "string"
          },
          "declarer": {
            "type": "string",
            "description": "The source that declared it; the key is namespaced by it"
          },
          "scope": {
            "type": "string",
            "const": "church"
          },
          "env": {
            "type": "string",
            "enum": [
              "test",
              "live"
            ]
          },
          "status": {
            "type": "string",
            "description": "applied: in use at once, in the environment of the key that sent it"
          },
          "supersedes": {
            "type": [
              "string",
              "null"
            ]
          },
          "line": {
            "type": "string",
            "description": "The version that started the compatible line this version joins"
          },
          "compatible": {
            "description": "Whether it is compatible with the version it supersedes; null when it supersedes none. false starts a new line",
            "type": [
              "boolean",
              "null"
            ]
          },
          "reasons": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Why it is not compatible, one line each"
          },
          "hash": {
            "type": "string",
            "description": "sha256 of the canonical definition; an identical re-PUT answers 200 with this receipt"
          }
        },
        "required": [
          "key",
          "version",
          "declarer",
          "scope",
          "env",
          "status",
          "supersedes",
          "line",
          "compatible",
          "reasons",
          "hash"
        ]
      },
      "AssessmentResultBody": {
        "title": "AssessmentResultBody",
        "type": "object",
        "properties": {
          "definition": {
            "type": "object",
            "properties": {
              "key": {
                "type": "string",
                "pattern": "^([a-z][a-z0-9_]{0,63}\\.)?[a-z][a-z0-9_]{0,63}$",
                "description": "A key. Platform definitions prefix their declarer's namespace (rock.disc); church keys never contain a dot"
              },
              "version": {
                "type": "string",
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$",
                "description": "The app's own version label"
              }
            },
            "required": [
              "key",
              "version"
            ],
            "additionalProperties": false
          },
          "status": {
            "type": "string",
            "enum": [
              "completed"
            ]
          },
          "started_at": {
            "type": "string",
            "pattern": "^(\\d{4})(?:-(\\d{2})(?:-(\\d{2})(?:T(\\d{2}):(\\d{2}):(\\d{2})(?:\\.\\d{1,9})?(?:Z|[+-](\\d{2}):(\\d{2})))?)?)?$",
            "description": "An RFC 3339 timestamp with an offset (2026-10-12T19:04:11Z), a day (2003-05-04), a month (2003-05) or a year (2003)"
          },
          "completed_at": {
            "type": "string",
            "pattern": "^(\\d{4})(?:-(\\d{2})(?:-(\\d{2})(?:T(\\d{2}):(\\d{2}):(\\d{2})(?:\\.\\d{1,9})?(?:Z|[+-](\\d{2}):(\\d{2})))?)?)?$",
            "description": "An RFC 3339 timestamp with an offset (2026-10-12T19:04:11Z), a day (2003-05-04), a month (2003-05) or a year (2003)"
          },
          "respondent": {
            "description": "self when absent",
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "self"
                  }
                },
                "required": [
                  "kind"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "kind": {
                    "type": "string",
                    "const": "observer"
                  },
                  "role": {
                    "type": "string",
                    "pattern": "^[a-z][a-z0-9_]{0,63}$",
                    "description": "Identifier for every section, item, role, level, qualifier and declarer: a lowercase letter, then lowercase letters, digits or underscores, at most 64 characters"
                  },
                  "count": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 9007199254740991
                  }
                },
                "required": [
                  "kind",
                  "role",
                  "count"
                ],
                "additionalProperties": false
              }
            ]
          },
          "results": {
            "minItems": 1,
            "maxItems": 1000,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "item": {
                  "type": "string",
                  "pattern": "^[a-z][a-z0-9_]{0,63}$",
                  "description": "Identifier for every section, item, role, level, qualifier and declarer: a lowercase letter, then lowercase letters, digits or underscores, at most 64 characters"
                },
                "value": {
                  "anyOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "string"
                    },
                    {
                      "type": "boolean"
                    },
                    {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Typed by the item. null is reported with no value; \"not_offered\" means the source never presented it"
                },
                "qualifiers": {
                  "type": "object",
                  "propertyNames": {
                    "type": "string",
                    "pattern": "^[a-z][a-z0-9_]{0,63}$",
                    "description": "Identifier for every section, item, role, level, qualifier and declarer: a lowercase letter, then lowercase letters, digits or underscores, at most 64 characters"
                  },
                  "additionalProperties": {
                    "type": [
                      "string",
                      "number"
                    ]
                  }
                },
                "coverage": {
                  "type": "object",
                  "properties": {
                    "answered": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    },
                    "total": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 9007199254740991
                    }
                  },
                  "required": [
                    "answered",
                    "total"
                  ],
                  "additionalProperties": false
                },
                "source_rank": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 9007199254740991
                },
                "source_primary": {
                  "type": "boolean"
                }
              },
              "required": [
                "item",
                "value"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "definition",
          "status",
          "completed_at",
          "results"
        ],
        "additionalProperties": false
      },
      "RecordReceipt": {
        "title": "RecordReceipt",
        "type": "object",
        "properties": {
          "outcome": {
            "description": "POST only. accepted: stored now. duplicate: this revision was already stored with the same envelope. valid: validate mode, nothing stored",
            "type": "string"
          },
          "state": {
            "description": "accepted, processed, quarantined, deleted; absent in validate mode. An unknown state is not terminal",
            "type": "string"
          },
          "current": {
            "description": "POST only. false when a higher revision was already stored, so this one is kept as history",
            "type": "boolean"
          },
          "record_type": {
            "type": "string"
          },
          "record_id": {
            "type": "string"
          },
          "revision": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "definition": {
            "type": "object",
            "properties": {
              "key": {
                "type": "string"
              },
              "version": {
                "type": "string"
              }
            },
            "required": [
              "key",
              "version"
            ]
          },
          "hash": {
            "type": "string",
            "description": "sha256 of the canonical envelope"
          },
          "counts": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            "description": "Results per definition section"
          },
          "received_at": {
            "description": "When Ediphai stored it; absent in validate mode",
            "type": "string"
          }
        },
        "required": [
          "record_type",
          "record_id",
          "revision",
          "definition",
          "hash",
          "counts"
        ]
      },
      "DeletedRecordReceipt": {
        "title": "DeletedRecordReceipt",
        "type": "object",
        "properties": {
          "outcome": {
            "description": "POST only. accepted: stored now. duplicate: this revision was already stored with the same envelope. valid: validate mode, nothing stored",
            "type": "string"
          },
          "state": {
            "type": "string",
            "const": "deleted"
          },
          "current": {
            "description": "POST only. false when a higher revision was already stored, so this one is kept as history",
            "type": "boolean"
          },
          "record_type": {
            "type": "string"
          },
          "record_id": {
            "type": "string"
          },
          "revision": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "definition": {
            "type": "object",
            "properties": {
              "key": {
                "type": "string"
              },
              "version": {
                "type": "string"
              }
            },
            "required": [
              "key",
              "version"
            ]
          },
          "hash": {
            "type": "null",
            "description": "Null: a deleted record keeps no hash"
          },
          "counts": {
            "type": "object",
            "propertyNames": {
              "type": "string"
            },
            "additionalProperties": {
              "type": "integer",
              "minimum": -9007199254740991,
              "maximum": 9007199254740991
            },
            "description": "Results per definition section"
          },
          "received_at": {
            "description": "When Ediphai stored it; absent in validate mode",
            "type": "string"
          }
        },
        "required": [
          "state",
          "record_type",
          "record_id",
          "revision",
          "definition",
          "hash",
          "counts"
        ]
      },
      "DeletedSectionReceipt": {
        "title": "DeletedSectionReceipt",
        "type": "object",
        "properties": {
          "record_type": {
            "type": "string"
          },
          "record_id": {
            "type": "string"
          },
          "section": {
            "type": "string",
            "description": "The section's key in the record's definition"
          },
          "state": {
            "type": "string",
            "const": "deleted",
            "description": "The section is deleted in every revision of the record, later ones included"
          }
        },
        "required": [
          "record_type",
          "record_id",
          "section",
          "state"
        ]
      },
      "DeletedSubjectReceipt": {
        "title": "DeletedSubjectReceipt",
        "type": "object",
        "properties": {
          "external_id": {
            "type": "string"
          },
          "deleted": {
            "type": "integer",
            "minimum": 0,
            "maximum": 9007199254740991,
            "description": "Records this call deleted"
          },
          "complete": {
            "type": "boolean",
            "description": "Every record of the subject from this source is deleted. When false, call again"
          }
        },
        "required": [
          "external_id",
          "deleted",
          "complete"
        ]
      },
      "RecordBatchResult": {
        "title": "RecordBatchResult",
        "type": "object",
        "properties": {
          "results": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "index": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991,
                  "description": "The record's position in the batch"
                },
                "status": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991,
                  "description": "The status the record would have had alone: 202, 200, or a refusal. Retry only a retryable problem"
                },
                "receipt": {
                  "type": "object",
                  "properties": {
                    "outcome": {
                      "description": "POST only. accepted: stored now. duplicate: this revision was already stored with the same envelope. valid: validate mode, nothing stored",
                      "type": "string"
                    },
                    "state": {
                      "description": "accepted, processed, quarantined, deleted; absent in validate mode. An unknown state is not terminal",
                      "type": "string"
                    },
                    "current": {
                      "description": "POST only. false when a higher revision was already stored, so this one is kept as history",
                      "type": "boolean"
                    },
                    "record_type": {
                      "type": "string"
                    },
                    "record_id": {
                      "type": "string"
                    },
                    "revision": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "definition": {
                      "type": "object",
                      "properties": {
                        "key": {
                          "type": "string"
                        },
                        "version": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "key",
                        "version"
                      ]
                    },
                    "hash": {
                      "type": "string",
                      "description": "sha256 of the canonical envelope"
                    },
                    "counts": {
                      "type": "object",
                      "propertyNames": {
                        "type": "string"
                      },
                      "additionalProperties": {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      "description": "Results per definition section"
                    },
                    "received_at": {
                      "description": "When Ediphai stored it; absent in validate mode",
                      "type": "string"
                    }
                  },
                  "required": [
                    "record_type",
                    "record_id",
                    "revision",
                    "definition",
                    "hash",
                    "counts"
                  ]
                },
                "problem": {
                  "type": "object",
                  "properties": {
                    "type": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "status": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "detail": {
                      "type": "string"
                    },
                    "pointer": {
                      "type": "string",
                      "description": "JSON Pointer into the request; '' when the whole request is at fault"
                    },
                    "rule": {
                      "type": "string",
                      "description": "A rule from the catalogue in the docs; new rules may be added"
                    },
                    "fix": {
                      "type": "string"
                    },
                    "retryable": {
                      "type": "boolean",
                      "description": "true: send the same request again later. false: change the request first"
                    },
                    "retry_after_ms": {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    "errors": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "pointer": {
                            "type": "string"
                          },
                          "rule": {
                            "type": "string"
                          },
                          "fix": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "pointer",
                          "rule",
                          "fix"
                        ]
                      }
                    }
                  },
                  "required": [
                    "type",
                    "title",
                    "status",
                    "pointer",
                    "rule",
                    "fix",
                    "retryable"
                  ]
                }
              },
              "required": [
                "index",
                "status"
              ]
            }
          }
        },
        "required": [
          "results"
        ]
      },
      "ReconciliationPage": {
        "title": "ReconciliationPage",
        "type": "object",
        "properties": {
          "records": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "record_type": {
                  "type": "string"
                },
                "record_id": {
                  "type": "string"
                },
                "revision": {
                  "type": "integer",
                  "minimum": -9007199254740991,
                  "maximum": 9007199254740991
                },
                "hash": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "state": {
                  "type": "string",
                  "description": "An unknown state is not terminal"
                },
                "received_at": {
                  "type": "string"
                }
              },
              "required": [
                "record_type",
                "record_id",
                "revision",
                "hash",
                "state",
                "received_at"
              ]
            }
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "records",
          "next_cursor"
        ]
      },
      "Problem": {
        "title": "Problem",
        "type": "object",
        "properties": {
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "detail": {
            "type": "string"
          },
          "pointer": {
            "type": "string",
            "description": "JSON Pointer into the request; '' when the whole request is at fault"
          },
          "rule": {
            "type": "string",
            "description": "A rule from the catalogue in the docs; new rules may be added"
          },
          "fix": {
            "type": "string"
          },
          "retryable": {
            "type": "boolean",
            "description": "true: send the same request again later. false: change the request first"
          },
          "retry_after_ms": {
            "type": "integer",
            "minimum": -9007199254740991,
            "maximum": 9007199254740991
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "pointer": {
                  "type": "string"
                },
                "rule": {
                  "type": "string"
                },
                "fix": {
                  "type": "string"
                }
              },
              "required": [
                "pointer",
                "rule",
                "fix"
              ]
            }
          }
        },
        "required": [
          "type",
          "title",
          "status",
          "pointer",
          "rule",
          "fix",
          "retryable"
        ]
      }
    }
  }
}
