{
  "openapi": "3.0.1",
  "info": {
    "title": "Auto Validation",
    "version": "v1.1"
  },
  "tags": [
    {
      "name": "Auto Validation"
    }
  ],
  "paths": {
    "/auto_validation_documents": {
      "post": {
        "summary": "Submit auto-validation data via CSV",
        "tags": [
          "Auto Validation"
        ],
        "description": "Use this endpoint to submit auto-validation data in bulk via a CSV file\n\nExample CSV:\n```            \nMERS MIN,Lender Loan Number,1st Payment Date,Original Loan Amount,Note Rate,P&I,Maturity Date, Street Address,City,State,Zip Code\n999938087932884825,999938087932884825_LoanNumber,04/25/2019,\"330,000.00\",4.000,500.50,04/25/2049,2949 Waterbury Road,Stowe,VT,05662            \n```\n",
        "operationId": "submitAutoValidationCsv",
        "parameters": [],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/auto_validation_document"
                }
              }
            }
          },
          "403": {
            "description": "forbidden: your role does not allow to proceed"
          }
        },
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "format": "binary",
                    "description": "CSV file contents"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/auto_validation_entries": {
      "get": {
        "summary": "Show auto-validation data in aggregate",
        "tags": [
          "Auto Validation"
        ],
        "description": "Use this endpoint to retrieve auto-validation data associated with multiple enotes\n\nResults are ordered by `updated_at`, most recently updated first.\n\nBy default only the latest entry per MIN is returned. When data is resubmitted for a\nMIN, or an enote is redrawn, a new entry is created and the previous one is retained\nbut no longer considered latest — pass `include_past_data=true` to include those.\n",
        "parameters": [
          {
            "name": "per_page",
            "in": "query",
            "description": "How many results to retrieve per call",
            "schema": {
              "type": "integer",
              "example": 25
            }
          },
          {
            "name": "page",
            "in": "query",
            "description": "Page number of results to retrieve",
            "schema": {
              "type": "integer",
              "example": 1
            }
          },
          {
            "name": "start_date",
            "in": "query",
            "description": "Restricts to entries whose `updated_at` is on or after this value (inclusive). Note that this filters on when the entry was last updated — validation completing or an error being manually resolved both bump `updated_at` — not when the data was first submitted. Accepts a date (`2023-06-01`, interpreted as midnight UTC) or a full ISO 8601 timestamp (`2023-06-01T09:30:00Z`).",
            "schema": {
              "type": "string",
              "example": "2023-06-22T00:00:00.000Z"
            }
          },
          {
            "name": "end_date",
            "in": "query",
            "description": "Restricts to entries whose `updated_at` is on or before this value (inclusive). Filters on `updated_at`, with the same caveats as `start_date`. Accepts a date (`2023-06-01`, interpreted as midnight UTC) or a full ISO 8601 timestamp (`2023-06-01T09:30:00Z`).",
            "schema": {
              "type": "string",
              "example": "2023-06-22T23:59:59.999Z"
            }
          },
          {
            "name": "auto_validated",
            "in": "query",
            "description": "Restricts to entries that either passed (`true`) or failed (`false`) validation. Entries still awaiting a matching enote count as not validated and are returned by `false`. Omit to return entries in both states.",
            "schema": {
              "type": "string",
              "example": "false"
            }
          },
          {
            "name": "include_past_data",
            "in": "query",
            "description": "Set to `true` to also return entries superseded by newer data for the same MIN. Defaults to `false`, which returns only the latest entry per MIN.",
            "schema": {
              "type": "string",
              "example": "true"
            }
          }
        ],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/auto_validation_entries"
                }
              }
            }
          },
          "403": {
            "description": "forbidden: your role does not allow to proceed"
          }
        }
      }
    },
    "/auto_validation_entries/{min_number}": {
      "get": {
        "summary": "Show auto-validation data for single enote",
        "tags": [
          "Auto Validation"
        ],
        "description": "Use this endpoint to retrieve all auto-validation data associated with an enote",
        "operationId": "getAutoValidationEntry",
        "parameters": [
          {
            "name": "min_number",
            "in": "path",
            "required": true,
            "description": "MIN number of the enote to retrieve auto-validation data for",
            "schema": {
              "type": "string",
              "example": "123456789012345678"
            }
          }
        ],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/auto_validation_entry"
                }
              }
            }
          },
          "403": {
            "description": "forbidden: your role does not allow to proceed"
          },
          "404": {
            "description": "Not Found"
          }
        }
      },
      "post": {
        "summary": "Submit auto-validation data",
        "tags": [
          "Auto Validation"
        ],
        "description": "Use this endpoint to submit expected data associated with an enote\n\nExample JSON request body:\n```\n  {              \n    \"Lender Loan Number\": \"999938091211784532_LoanNumber\",              \n    \"1st Payment Date\": \"04/25/2019\",\n    \"Original Loan Amount\": \"330,000.00\",\n    \"Note Rate\": \"4.000\",\n    \"P&I\": \"500.50\",\n    \"Maturity Date\": \"04/25/2049\",\n    \"Street Address\": \"2949 Waterbury Road\",\n    \"City\": \"Stowe\",\n    \"State\": \"VT\",\n    \"Zip Code\": \"05662\"\n  }           \n```\n",
        "operationId": "submitAutoValidationEntry",
        "parameters": [
          {
            "name": "min_number",
            "in": "path",
            "required": true,
            "description": "MIN number of the enote to submit auto-validation data for",
            "schema": {
              "type": "string",
              "example": "123456789012345678"
            }
          }
        ],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/auto_validation_entry"
                }
              }
            }
          },
          "400": {
            "description": "Bad request: min number is invalid"
          },
          "403": {
            "description": "forbidden: your role does not allow to proceed"
          }
        }
      }
    }
  },
  "servers": [
    {
      "url": "https://demo.snapdocsevault.com/api",
      "description": "Snapdocs Evault demo environment"
    },
    {
      "url": "https://www.snapdocsevault.com/api",
      "description": "Snapdocs Evault production environment"
    }
  ],
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "schemas": {
      "auto_validation_document": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "example": "5279e4ca-cd04-49b3-9863-d94e9acc35fe",
                "description": "The document id"
              },
              "attributes": {
                "type": "object",
                "properties": {
                  "evault_id": {
                    "type": "string",
                    "format": "uuid",
                    "example": "e726f0ee-7c5b-441c-804c-0e91e9ab404a",
                    "description": "id of the evault object"
                  },
                  "file_name": {
                    "type": "string",
                    "example": "auto_validation.csv",
                    "description": "The saved filename"
                  },
                  "processed_row_count": {
                    "type": "integer",
                    "example": 20,
                    "description": "how many rows of data were successfully imported"
                  },
                  "ignored_row_count": {
                    "type": "integer",
                    "example": 3,
                    "description": "how many rows of data were skipped"
                  },
                  "failed_rows": {
                    "type": "object",
                    "description": "details on rows that failed to import",
                    "properties": {
                      "missing_min": {
                        "type": "array",
                        "items": {
                          "type": "integer"
                        },
                        "example": [
                          1,
                          2
                        ],
                        "description": "The CSV line numbers that failed due to a missing MIN number"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "auto_validation_entry_data": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "5279e4ca-cd04-49b3-9863-d94e9acc35fe",
            "description": "The entry id"
          },
          "attributes": {
            "type": "object",
            "properties": {
              "evault_id": {
                "type": "string",
                "format": "uuid",
                "example": "e726f0ee-7c5b-441c-804c-0e91e9ab404a",
                "description": "id of the evault object"
              },
              "min_number": {
                "type": "string",
                "example": "999938091211784532",
                "description": "MERS min number associated with the relevant enote"
              },
              "auto_validated": {
                "type": "boolean",
                "example": true,
                "description": "tells whether entry has been auto validated"
              },
              "emortgage_package_id": {
                "type": "string",
                "format": "uuid",
                "example": "e726f0ee-7c5b-441c-804c-0e91e9ab404a",
                "description": "id of the emortgage_package object"
              },
              "document_id": {
                "type": "string",
                "format": "uuid",
                "example": "e726f0ee-7c5b-441c-804c-0e91e9ab404a",
                "description": "id of the document (enote) the entry was validated against, null until a matching enote is found"
              },
              "document_errors": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/document_error"
                }
              },
              "document_attribute_errors": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/document_attribute_error"
                }
              }
            }
          }
        }
      },
      "document_attribute_error": {
        "type": "object",
        "description": "an error related to the attributes of the document, if included in auto validation, like an ARM, POA, or Modification error",
        "properties": {
          "id": {
            "type": "string",
            "example": "5279e4ca-cd04-49b3-9863-d94e9acc35fe",
            "description": "The error id"
          },
          "error_key": {
            "type": "string",
            "example": "ARM",
            "description": "an uppercased key identifying the type of attribute error",
            "enum": [
              "ARM",
              "POA",
              "MODIFICATION"
            ]
          },
          "description": {
            "type": "string",
            "example": "eNote is an ARM Note",
            "description": "a description of the attribute error"
          },
          "manually_resolved": {
            "type": "boolean",
            "example": false,
            "description": "whether this error has been manually resolved"
          }
        }
      },
      "document_error": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "5279e4ca-cd04-49b3-9863-d94e9acc35fe",
            "description": "The error id"
          },
          "attributes": {
            "type": "object",
            "properties": {
              "data": {
                "type": "object",
                "properties": {
                  "data": {
                    "type": "string",
                    "example": "100 Montgomery Street",
                    "description": "value provided via the entry data"
                  },
                  "enote": {
                    "type": "string",
                    "example": "100 Montgomery St",
                    "description": "value parsed from the enote XML"
                  }
                }
              },
              "code": {
                "type": "string",
                "example": "1120",
                "description": "a code for the error type"
              },
              "csv_header": {
                "type": "string",
                "example": "Street Address",
                "description": "relevant header in the data file or key in the request body"
              },
              "description": {
                "type": "string",
                "example": "is missing or does not match",
                "description": "a description of the error"
              },
              "exception_type": {
                "type": "string",
                "example": "Non Fatal",
                "description": "severity level of auto-validation failure"
              }
            }
          }
        }
      },
      "auto_validation_entry": {
        "type": "object",
        "properties": {
          "data": {
            "$ref": "#/components/schemas/auto_validation_entry_data"
          }
        }
      },
      "auto_validation_entries": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/auto_validation_entry_data"
            }
          }
        }
      }
    }
  }
}