{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "v": {
      "type": "number",
      "const": 1
    },
    "id": {
      "type": "string",
      "pattern": "^[a-zA-Z0-9_-]{1,100}$"
    },
    "identity": {
      "type": "object",
      "properties": {
        "issuer": {
          "type": "string",
          "const": "https://auth.agentid.com"
        },
        "sub": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200
        },
        "email": {
          "type": "string",
          "maxLength": 320,
          "format": "email",
          "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
        },
        "state": {
          "type": "string",
          "const": "verified"
        },
        "verified_at": {
          "anyOf": [
            {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "issuer",
        "sub",
        "email",
        "state",
        "verified_at"
      ],
      "additionalProperties": false
    },
    "owner_link": {
      "type": "object",
      "properties": {
        "state": {
          "type": "string",
          "const": "verified"
        },
        "verified_at": {
          "type": "string",
          "format": "date-time",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
        }
      },
      "required": [
        "state",
        "verified_at"
      ],
      "additionalProperties": false
    },
    "checks": {
      "maxItems": 5,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "enum": [
              "identity",
              "inbox",
              "retry_wait",
              "task",
              "distraction"
            ]
          },
          "result": {
            "type": "string",
            "enum": [
              "passed",
              "failed",
              "pending",
              "expired"
            ]
          },
          "checked_at": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          },
          "valid_until": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "check_version": {
            "type": "string",
            "const": "1"
          },
          "execution": {
            "type": "string",
            "enum": [
              "browser",
              "api",
              "unknown"
            ]
          }
        },
        "required": [
          "id",
          "result",
          "checked_at",
          "valid_until",
          "check_version",
          "execution"
        ],
        "additionalProperties": false
      }
    },
    "history": {
      "type": "object",
      "properties": {
        "observations": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "sources": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "under_review": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        },
        "reviewed": {
          "type": "integer",
          "minimum": 0,
          "maximum": 9007199254740991
        }
      },
      "required": [
        "observations",
        "sources",
        "under_review",
        "reviewed"
      ],
      "additionalProperties": false
    },
    "record_state": {
      "type": "string",
      "enum": [
        "active",
        "paused",
        "revoked"
      ]
    },
    "visibility": {
      "type": "string",
      "enum": [
        "public",
        "private"
      ]
    },
    "revision": {
      "type": "integer",
      "exclusiveMinimum": 0,
      "maximum": 9007199254740991
    },
    "as_of": {
      "type": "string",
      "format": "date-time",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
    },
    "refresh_by": {
      "type": "string",
      "format": "date-time",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
    }
  },
  "required": [
    "v",
    "id",
    "identity",
    "checks",
    "history",
    "record_state",
    "visibility",
    "revision",
    "as_of",
    "refresh_by"
  ],
  "additionalProperties": false,
  "$id": "https://opencatalog.sh/schema/record-v1.schema.json",
  "title": "Agent Record v1",
  "$defs": {
    "Record": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "object",
      "properties": {
        "v": {
          "type": "number",
          "const": 1
        },
        "id": {
          "type": "string",
          "pattern": "^[a-zA-Z0-9_-]{1,100}$"
        },
        "identity": {
          "type": "object",
          "properties": {
            "issuer": {
              "type": "string",
              "const": "https://auth.agentid.com"
            },
            "sub": {
              "type": "string",
              "minLength": 1,
              "maxLength": 200
            },
            "email": {
              "type": "string",
              "maxLength": 320,
              "format": "email",
              "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
            },
            "state": {
              "type": "string",
              "const": "verified"
            },
            "verified_at": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "required": [
            "issuer",
            "sub",
            "email",
            "state",
            "verified_at"
          ],
          "additionalProperties": false
        },
        "owner_link": {
          "type": "object",
          "properties": {
            "state": {
              "type": "string",
              "const": "verified"
            },
            "verified_at": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
            }
          },
          "required": [
            "state",
            "verified_at"
          ],
          "additionalProperties": false
        },
        "checks": {
          "maxItems": 5,
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "enum": [
                  "identity",
                  "inbox",
                  "retry_wait",
                  "task",
                  "distraction"
                ]
              },
              "result": {
                "type": "string",
                "enum": [
                  "passed",
                  "failed",
                  "pending",
                  "expired"
                ]
              },
              "checked_at": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              },
              "valid_until": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "check_version": {
                "type": "string",
                "const": "1"
              },
              "execution": {
                "type": "string",
                "enum": [
                  "browser",
                  "api",
                  "unknown"
                ]
              }
            },
            "required": [
              "id",
              "result",
              "checked_at",
              "valid_until",
              "check_version",
              "execution"
            ],
            "additionalProperties": false
          }
        },
        "history": {
          "type": "object",
          "properties": {
            "observations": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "sources": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "under_review": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            },
            "reviewed": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          },
          "required": [
            "observations",
            "sources",
            "under_review",
            "reviewed"
          ],
          "additionalProperties": false
        },
        "record_state": {
          "type": "string",
          "enum": [
            "active",
            "paused",
            "revoked"
          ]
        },
        "visibility": {
          "type": "string",
          "enum": [
            "public",
            "private"
          ]
        },
        "revision": {
          "type": "integer",
          "exclusiveMinimum": 0,
          "maximum": 9007199254740991
        },
        "as_of": {
          "type": "string",
          "format": "date-time",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
        },
        "refresh_by": {
          "type": "string",
          "format": "date-time",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
        }
      },
      "required": [
        "v",
        "id",
        "identity",
        "checks",
        "history",
        "record_state",
        "visibility",
        "revision",
        "as_of",
        "refresh_by"
      ],
      "additionalProperties": false
    },
    "Envelope": {
      "$schema": "https://json-schema.org/draft/2020-12/schema",
      "type": "object",
      "properties": {
        "format": {
          "type": "string",
          "const": "oc.record.v1"
        },
        "record": {
          "type": "object",
          "properties": {
            "v": {
              "type": "number",
              "const": 1
            },
            "id": {
              "type": "string",
              "pattern": "^[a-zA-Z0-9_-]{1,100}$"
            },
            "identity": {
              "type": "object",
              "properties": {
                "issuer": {
                  "type": "string",
                  "const": "https://auth.agentid.com"
                },
                "sub": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 200
                },
                "email": {
                  "type": "string",
                  "maxLength": 320,
                  "format": "email",
                  "pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
                },
                "state": {
                  "type": "string",
                  "const": "verified"
                },
                "verified_at": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "date-time",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "required": [
                "issuer",
                "sub",
                "email",
                "state",
                "verified_at"
              ],
              "additionalProperties": false
            },
            "owner_link": {
              "type": "object",
              "properties": {
                "state": {
                  "type": "string",
                  "const": "verified"
                },
                "verified_at": {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                }
              },
              "required": [
                "state",
                "verified_at"
              ],
              "additionalProperties": false
            },
            "checks": {
              "maxItems": 5,
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "enum": [
                      "identity",
                      "inbox",
                      "retry_wait",
                      "task",
                      "distraction"
                    ]
                  },
                  "result": {
                    "type": "string",
                    "enum": [
                      "passed",
                      "failed",
                      "pending",
                      "expired"
                    ]
                  },
                  "checked_at": {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                  },
                  "valid_until": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "date-time",
                        "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "check_version": {
                    "type": "string",
                    "const": "1"
                  },
                  "execution": {
                    "type": "string",
                    "enum": [
                      "browser",
                      "api",
                      "unknown"
                    ]
                  }
                },
                "required": [
                  "id",
                  "result",
                  "checked_at",
                  "valid_until",
                  "check_version",
                  "execution"
                ],
                "additionalProperties": false
              }
            },
            "history": {
              "type": "object",
              "properties": {
                "observations": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "sources": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "under_review": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "reviewed": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                }
              },
              "required": [
                "observations",
                "sources",
                "under_review",
                "reviewed"
              ],
              "additionalProperties": false
            },
            "record_state": {
              "type": "string",
              "enum": [
                "active",
                "paused",
                "revoked"
              ]
            },
            "visibility": {
              "type": "string",
              "enum": [
                "public",
                "private"
              ]
            },
            "revision": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            },
            "as_of": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
            },
            "refresh_by": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
            }
          },
          "required": [
            "v",
            "id",
            "identity",
            "checks",
            "history",
            "record_state",
            "visibility",
            "revision",
            "as_of",
            "refresh_by"
          ],
          "additionalProperties": false
        },
        "attestation": {
          "type": "string",
          "minLength": 1,
          "maxLength": 12000
        }
      },
      "required": [
        "format",
        "record",
        "attestation"
      ],
      "additionalProperties": false
    }
  }
}
