{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/samesake-co-uk/json-schema/samesake-co-uk-record-view-schema.json",
  "title": "RecordView",
  "description": "A record as Samesake holds it: its details as the source sent them (all cleared once it's deleted), the person it belongs to, and the records matched to it.",
  "x-generated": "2026-11-27",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/samesake-co-uk-openapi.yml#/components/schemas/RecordView",
  "required": [
    "recordId",
    "sourceSystemCode",
    "sourceRecordId",
    "title",
    "firstName",
    "lastName",
    "email",
    "dateOfBirth",
    "addressLine1",
    "addressLine2",
    "postcode",
    "phones",
    "personId",
    "deleted",
    "linkedRecords"
  ],
  "type": "object",
  "properties": {
    "recordId": {
      "type": "string",
      "description": "Samesake's ID for the record. It never changes."
    },
    "sourceSystemCode": {
      "type": "string",
      "description": "The code of the record's source."
    },
    "sourceRecordId": {
      "type": "string",
      "description": "Your ID for the record in its source."
    },
    "title": {
      "type": [
        "null",
        "string"
      ],
      "description": "Title."
    },
    "firstName": {
      "type": [
        "null",
        "string"
      ],
      "description": "First name."
    },
    "lastName": {
      "type": [
        "null",
        "string"
      ],
      "description": "Last name."
    },
    "email": {
      "type": [
        "null",
        "string"
      ],
      "description": "Email address."
    },
    "dateOfBirth": {
      "type": [
        "null",
        "string"
      ],
      "description": "Date of birth, as sent."
    },
    "addressLine1": {
      "type": [
        "null",
        "string"
      ],
      "description": "First line of the address."
    },
    "addressLine2": {
      "type": [
        "null",
        "string"
      ],
      "description": "Second line of the address."
    },
    "postcode": {
      "type": [
        "null",
        "string"
      ],
      "description": "Postcode, as sent."
    },
    "phones": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Phone numbers, as sent."
    },
    "personId": {
      "type": [
        "null",
        "string"
      ],
      "description": "Samesake's ID for the person the record belongs to: every record matched to the same person has the same one. Null until the record has been matched. It changes if people are merged or split."
    },
    "deleted": {
      "type": "boolean",
      "description": "Whether the record has been deleted. A deleted record's details are removed; its IDs stay."
    },
    "linkedRecords": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/LinkedRecordView"
      },
      "description": "The records matched to this one, from any source: their IDs, not their details."
    }
  },
  "additionalProperties": {
    "maxLength": 200,
    "type": [
      "null",
      "string"
    ],
    "description": "Your organisation's custom fields, each under its API name, null when the record has no value."
  },
  "$defs": {
    "LinkType": {
      "enum": [
        "Auto",
        "Confirmed"
      ],
      "type": "string",
      "description": "`Auto`: Samesake matched the records itself. `Confirmed`: a reviewer confirmed the match."
    },
    "LinkedRecordView": {
      "required": [
        "recordId",
        "sourceSystemCode",
        "sourceRecordId",
        "linkType"
      ],
      "type": "object",
      "properties": {
        "recordId": {
          "type": "string",
          "description": "Samesake's ID for the record."
        },
        "sourceSystemCode": {
          "type": "string",
          "description": "The code of the record's source."
        },
        "sourceRecordId": {
          "type": "string",
          "description": "The source's own ID for the record."
        },
        "linkType": {
          "$ref": "#/$defs/LinkType"
        }
      },
      "description": "A record matched to another."
    }
  }
}