{
  "openapi": "3.0.1",
  "info": {
    "title": "eNote Creation",
    "version": "v1.1"
  },
  "tags": [
    {
      "name": "eNote Creation"
    }
  ],
  "paths": {
    "/document_requests": {
      "post": {
        "summary": "Create a new document request",
        "tags": [
          "eNote Creation"
        ],
        "description": "Use this endpoint to create a new eNote in your eVault",
        "parameters": [],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "responses": {
          "201": {
            "description": "created a new version of the eNote",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/document_request"
                }
              }
            }
          },
          "400": {
            "description": "bad request: some data was missing or invalid",
            "content": {
              "application/json": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/document_request_missing_data"
                    },
                    {
                      "$ref": "#/components/schemas/document_request_mers_min_error"
                    },
                    {
                      "$ref": "#/components/schemas/document_request_invalid_form_error"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "unauthorized: unable to proceed with authentication"
          },
          "403": {
            "description": "forbidden: your role does not allow to proceed"
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/document_request_payload"
              }
            }
          }
        }
      }
    },
    "/document_requests/{document_request_id}": {
      "get": {
        "summary": "Get document request by id",
        "tags": [
          "eNote Creation"
        ],
        "description": "Use this endpoint to get the data on a document request you previously created",
        "parameters": [
          {
            "name": "document_request_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "5279e4ca-cd04-49b3-9863-d94e9acc35fe",
              "description": "the unique identifier for the document request"
            }
          }
        ],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/document_request"
                }
              }
            }
          },
          "404": {
            "description": "Not Found"
          }
        }
      }
    },
    "/documents/{document_id}/audit_certificate": {
      "get": {
        "summary": "Retrieve a PDF audit certificate for the note across all versions",
        "tags": [
          "eNote Creation"
        ],
        "description": "Use this endpoint to retrieve a PDF audit certificate for the note across all versions",
        "parameters": [
          {
            "name": "document_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "5279e4ca-cd04-49b3-9863-d94e9acc35fe",
              "description": "the unique identifier for the document"
            }
          }
        ],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/documents/{document_id}/cancel": {
      "post": {
        "summary": "Cancel a pending unsigned note or reverse registration on a registered note",
        "tags": [
          "eNote Creation"
        ],
        "description": "Use this endpoint to cancel a pending unsigned note or reverse registration on a registered note",
        "parameters": [
          {
            "name": "document_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "5279e4ca-cd04-49b3-9863-d94e9acc35fe",
              "description": "the unique identifier for the document"
            }
          }
        ],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "example": "5279e4ca-cd04-49b3-9863-d94e9acc35fe",
                          "description": "The document id"
                        },
                        "type": {
                          "type": "string",
                          "example": "documents",
                          "description": "The type of object"
                        },
                        "attributes": {
                          "type": "object",
                          "properties": {
                            "status": {
                              "type": "string",
                              "example": "canceled",
                              "description": "the status of the document"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "bad request: document cannot be canceled"
          }
        }
      }
    },
    "/documents/{document_id}/reverse_registration": {
      "post": {
        "summary": "Reverse registration in MERS for a registered note",
        "tags": [
          "eNote Creation"
        ],
        "description": "Use this endpoint to reverse registration in MERS for a registered note",
        "parameters": [
          {
            "name": "document_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "5279e4ca-cd04-49b3-9863-d94e9acc35fe",
              "description": "the unique identifier for the document"
            }
          }
        ],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "responses": {
          "202": {
            "description": "accepted"
          },
          "400": {
            "description": "bad request: document is not registered"
          }
        }
      }
    },
    "/emortgage_packages/{emortgage_package_id}/preview": {
      "get": {
        "summary": "Retrieve a PDF preview copy of the note version before signing",
        "tags": [
          "eNote Creation"
        ],
        "description": "Use this endpoint to retrieve a PDF preview copy of a note version before signing",
        "parameters": [
          {
            "name": "emortgage_package_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "5279e4ca-cd04-49b3-9863-d94e9acc35fe",
              "description": "the unique identifier for the emortgage package to preview"
            }
          }
        ],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/emortgage_packages/{emortgage_package_id}/cancel": {
      "post": {
        "summary": "Cancel a specific version (emortgage package) of a document",
        "tags": [
          "eNote Creation"
        ],
        "description": "Use this endpoint to cancel a pending unsigned note or reverse registration on a registered note",
        "parameters": [
          {
            "name": "emortgage_package_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "example": "5279e4ca-cd04-49b3-9863-d94e9acc35fe",
              "description": "the unique identifier for the emortgage package to cancel"
            }
          }
        ],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "example": "5279e4ca-cd04-49b3-9863-d94e9acc35fe",
                          "description": "The emortgage package id"
                        },
                        "type": {
                          "type": "string",
                          "example": "emortgage_packages",
                          "description": "The type of object"
                        },
                        "attributes": {
                          "type": "object",
                          "properties": {
                            "status": {
                              "type": "string",
                              "example": "canceled",
                              "description": "the status of the document"
                            },
                            "document_id": {
                              "type": "string",
                              "example": "dc6ebb60-e293-42b8-96ed-882e56d66f16",
                              "description": "The id of the document associated with the emortgage package"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "bad request: document cannot be canceled"
          }
        }
      }
    }
  },
  "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": {
      "link": {
        "type": "object",
        "properties": {
          "href": {
            "type": "string",
            "description": "uri to access the link",
            "example": "/b/123"
          },
          "rel": {
            "type": "string",
            "description": "relation of the link to the object",
            "example": "action"
          },
          "type": {
            "type": "string",
            "description": "http verb",
            "example": "GET"
          }
        },
        "description": "self descriptive link"
      },
      "borrower": {
        "type": "object",
        "required": [
          "name_attributes",
          "email",
          "order"
        ],
        "properties": {
          "name_attributes": {
            "type": "object",
            "required": [
              "first_name",
              "last_name"
            ],
            "properties": {
              "first_name": {
                "type": "string",
                "example": "David"
              },
              "middle_name": {
                "type": "string",
                "example": "John"
              },
              "last_name": {
                "type": "string",
                "example": "Green"
              },
              "name_suffix": {
                "type": "string",
                "example": "Jr"
              }
            }
          },
          "email": {
            "type": "string",
            "format": "email",
            "example": "david.green@example.com"
          },
          "order": {
            "type": "integer",
            "example": 1,
            "description": "order of the borrower to appear in the Note"
          }
        }
      },
      "document_request_payload": {
        "type": "object",
        "properties": {
          "document_request": {
            "type": "object",
            "properties": {
              "data": {
                "type": "object",
                "description": "data to create the eNote",
                "required": [
                  "form",
                  "mers_min",
                  "loan_number",
                  "execution",
                  "property_address",
                  "loan",
                  "lender",
                  "pay_to",
                  "late_charge"
                ],
                "properties": {
                  "form": {
                    "type": "string",
                    "example": "3200",
                    "description": "Form type of the eNote",
                    "enum": [
                      "3200",
                      "3202",
                      "3210",
                      "3220",
                      "3230",
                      "3233",
                      "3239",
                      "3247",
                      "3246",
                      "3249",
                      "3250",
                      "3441",
                      "3442",
                      "3501",
                      "3501.02",
                      "3501.10",
                      "3501.30",
                      "3501.39",
                      "3501.46",
                      "3501.47",
                      "3501.49",
                      "3501.50",
                      "3502",
                      "3502.02",
                      "3502.10",
                      "3502.30",
                      "3502.39",
                      "3502.46",
                      "3502.47",
                      "3502.49",
                      "3502.50"
                    ]
                  },
                  "include": {
                    "type": "object",
                    "description": "specifies which optional state specific language to include in the note",
                    "properties": {
                      "AL": {
                        "type": "object",
                        "description": "Alabama specific language",
                        "properties": {
                          "use_caution_text": {
                            "type": "boolean",
                            "description": "whether to include caution text at the end of the note for a note with property address in Alabama",
                            "default": false
                          },
                          "use_late_charge_text": {
                            "type": "boolean",
                            "description": "whether to include specific text in a note with property address in Alabama in Late Charge and Overdue Payment section",
                            "default": false
                          }
                        }
                      },
                      "IN": {
                        "type": "object",
                        "description": "Indiana specific language",
                        "properties": {
                          "use_caution_text": {
                            "type": "boolean",
                            "description": "whether to include caution text at the end of the note for a note with property address in Indiana",
                            "default": false
                          }
                        }
                      },
                      "MD": {
                        "type": "object",
                        "description": "Maryland specific language",
                        "properties": {
                          "use_choice_of_law_text": {
                            "type": "boolean",
                            "description": "whether to include choice of law text at the end of the note for a note with property address in Maryland",
                            "default": false
                          }
                        }
                      },
                      "MS": {
                        "type": "object",
                        "description": "Mississippi specific language",
                        "properties": {
                          "use_late_charge_text": {
                            "type": "boolean",
                            "description": "whether to include specific text in a note with property address in Mississippi in Lat Charge and Overdue Payment section",
                            "default": false
                          }
                        }
                      },
                      "TX": {
                        "type": "object",
                        "description": "Texas specific language",
                        "properties": {
                          "use_caution_text": {
                            "type": "boolean",
                            "description": "whether to include caution text at the end of the note for a note with property address in Texas",
                            "default": false
                          }
                        }
                      }
                    }
                  },
                  "mers_min": {
                    "type": "string",
                    "example": "999938044537169292",
                    "description": "the MERS mortgage identification number for the document"
                  },
                  "loan_number": {
                    "type": "string",
                    "description": "the identifier assigned by the originating lender to be referenced as the loan ID/Number on all settlement documents, notes, riders, etc…"
                  },
                  "broker_mers_org_id": {
                    "type": "string",
                    "description": "the MERS org ID of the broker organization. When set, a Registration And Transfer of Control action will be used to register the note."
                  },
                  "execution": {
                    "type": "object",
                    "required": [
                      "city",
                      "state",
                      "date"
                    ],
                    "properties": {
                      "city": {
                        "type": "string",
                        "description": "city of execution",
                        "example": "Sugarland"
                      },
                      "state": {
                        "type": "string",
                        "description": "state of the execution location",
                        "example": "Texas"
                      },
                      "date": {
                        "type": "string",
                        "description": "date of execution",
                        "example": "December 20, 2019"
                      }
                    }
                  },
                  "property_address": {
                    "type": "object",
                    "description": "address of the property being purchased",
                    "required": [
                      "street_address",
                      "city",
                      "postal_code",
                      "state",
                      "county"
                    ],
                    "properties": {
                      "street_address": {
                        "type": "string",
                        "description": "full street address",
                        "example": "100 Montgomery Street"
                      },
                      "city": {
                        "type": "string",
                        "example": "San Francisco"
                      },
                      "postal_code": {
                        "type": "string",
                        "example": "94104"
                      },
                      "state": {
                        "type": "string",
                        "example": "CA",
                        "pattern": "^[A-Z]{2}$"
                      },
                      "county": {
                        "type": "string",
                        "example": "San Francisco"
                      },
                      "country": {
                        "type": "string",
                        "default": "USA"
                      }
                    }
                  },
                  "loan": {
                    "type": "object",
                    "description": "information about the loan",
                    "required": [
                      "scheduled_first_payment_date",
                      "loan_maturity_date",
                      "original_principal_and_interest_payment_amount",
                      "terms",
                      "originator_unparsed_name",
                      "originator_NMLSID"
                    ],
                    "properties": {
                      "scheduled_first_payment_date": {
                        "type": "string",
                        "example": "April 1, 2019"
                      },
                      "loan_maturity_date": {
                        "type": "string",
                        "example": "March 1, 2034"
                      },
                      "original_principal_and_interest_payment_amount": {
                        "type": "string",
                        "description": "the dollar amount of the P&I payment as stated on the Note",
                        "example": "1,500.00"
                      },
                      "terms": {
                        "type": "object",
                        "description": "terms of the loan",
                        "required": [
                          "original_loan_amount",
                          "note_rate_percent",
                          "payment_remittance_day"
                        ],
                        "properties": {
                          "original_loan_amount": {
                            "type": "string",
                            "description": "mount of the mortgage as stated on the original Note",
                            "example": "1,349,000.00"
                          },
                          "note_rate_percent": {
                            "type": "string",
                            "description": "the interest rate as disclosed in the Note",
                            "example": "4.300"
                          },
                          "payment_remittance_day": {
                            "type": "string",
                            "description": "the day of the month on which the loan payment is to be remitted",
                            "example": "3",
                            "pattern": "^\\d{1,2}$"
                          },
                          "agency_case_identifier": {
                            "type": "string",
                            "description": "the agency case identifier, required for FHA and VA loans",
                            "example": "123456789012",
                            "pattern": "^\\d{10,12}"
                          }
                        }
                      },
                      "originator_unparsed_name": {
                        "type": "string",
                        "description": "loan originator (company) name",
                        "example": "Simple Lending Mortgage Company"
                      },
                      "originator_NMLSID": {
                        "type": "string",
                        "description": "loan originator NMLSID",
                        "example": "101101",
                        "pattern": "^\\d{6}$"
                      }
                    }
                  },
                  "lender": {
                    "type": "object",
                    "description": "information about the lender",
                    "required": [
                      "unparsed_name",
                      "contact_NMLSID"
                    ],
                    "properties": {
                      "unparsed_name": {
                        "type": "string",
                        "description": "the name of the party or entity designated as the lender for the loan",
                        "example": "Simple Lending Mortgage Company, a Texas Corporation"
                      },
                      "contact_name": {
                        "type": "string",
                        "example": "Peter Brokeman"
                      },
                      "contact_NMLSID": {
                        "type": "string",
                        "example": "400400",
                        "pattern": "^\\d{6}$"
                      }
                    }
                  },
                  "pay_to": {
                    "type": "object",
                    "description": "address where to send the loan payment",
                    "required": [
                      "street_address",
                      "city",
                      "postal_code",
                      "state"
                    ],
                    "properties": {
                      "street_address": {
                        "type": "string",
                        "description": "full street address",
                        "example": "100 Montgomery Street"
                      },
                      "city": {
                        "type": "string",
                        "example": "San Francisco"
                      },
                      "postal_code": {
                        "type": "string",
                        "example": "94104"
                      },
                      "state": {
                        "type": "string",
                        "example": "CA",
                        "pattern": "^[A-Z]{2}$"
                      }
                    }
                  },
                  "late_charge": {
                    "type": "object",
                    "required": [
                      "grace_period",
                      "rate"
                    ],
                    "properties": {
                      "grace_period": {
                        "type": "string",
                        "description": "the grace period in days for this loan before a late charge will be applied",
                        "example": "11",
                        "pattern": "^\\d{1,2,3}"
                      },
                      "rate": {
                        "type": "string",
                        "description": "the percentage a borrower is required to pay for failure to make a regular installment within the period specified on the Note",
                        "example": "4.321"
                      },
                      "maximum_amount": {
                        "type": "string",
                        "description": "maximum late charge amount required by West Virginia",
                        "example": "1000"
                      },
                      "minimum_amount": {
                        "type": "string",
                        "description": "minimum late charge amount",
                        "example": "1000"
                      }
                    }
                  },
                  "borrowers_attributes": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/borrower"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "document_request": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "example": "5279e4ca-cd04-49b3-9863-d94e9acc35fe",
                "description": "The document request id"
              },
              "type": {
                "type": "string",
                "example": "document_requests",
                "description": "The type of object"
              },
              "attributes": {
                "type": "object",
                "properties": {
                  "evault_id": {
                    "type": "string",
                    "format": "uuid",
                    "example": "e726f0ee-7c5b-441c-804c-0e91e9ab404a",
                    "description": "id of the evault object"
                  },
                  "signing_path_id": {
                    "type": "string",
                    "format": "uuid",
                    "example": "5696b7cb-1a2d-4842-a035-c24ac5b2c6c8",
                    "description": "id of the signing path object"
                  },
                  "document_id": {
                    "type": "string",
                    "format": "uuid",
                    "example": "94028d76-bdd0-45a9-9fdd-d0f49ae5726f",
                    "description": "id of the document object"
                  },
                  "emortgage_package_id": {
                    "type": "string",
                    "format": "uuid",
                    "example": "e4bac3b7-4133-4b3f-a41e-75c65a14bb95",
                    "description": "id of this version of the document"
                  },
                  "registration_status": {
                    "type": "string",
                    "example": "initiated",
                    "description": "registration status of this document",
                    "enum": [
                      "initiated",
                      "active",
                      "inactive"
                    ]
                  },
                  "emortgage_package_status": {
                    "type": "string",
                    "example": "initiated",
                    "description": "status of this version of the document",
                    "enum": [
                      "initiated",
                      "sealed",
                      "canceled",
                      "edelivered",
                      "pending_seal"
                    ]
                  },
                  "document_registered_at": {
                    "type": "string",
                    "example": "",
                    "description": "date the document was registered to MERS"
                  },
                  "borrowers": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "format": "uuid",
                          "description": "id of the Borrower object"
                        },
                        "order": {
                          "type": "integer",
                          "description": "Borrower order number",
                          "example": 1
                        },
                        "full_name": {
                          "type": "string",
                          "description": "Full name of the borrower",
                          "example": "David F. Green Jr"
                        },
                        "email": {
                          "type": "string",
                          "description": "email of the borrower",
                          "example": "david.green@example.com"
                        },
                        "signing_url": {
                          "type": "string",
                          "description": "uri for the borrower to access the document for signing",
                          "example": "/b/6da9114ac18d3c87d0d561ef1"
                        },
                        "status": {
                          "type": "string",
                          "description": "status of the signing participant",
                          "enum": [
                            "created",
                            "in_progress",
                            "signed",
                            "canceled",
                            "declined"
                          ]
                        },
                        "links": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/link"
                          },
                          "description": "self descriptive links to access: the signing experience (\"signing\"), download the pdf preview of the eNote (\"preview\"), update the borrower tax identifier (\"update\")"
                        }
                      }
                    }
                  },
                  "links": {
                    "type": "array",
                    "items": {
                      "$ref": "#/components/schemas/link"
                    },
                    "description": "self descriptive link to: cancel a document (\"cancel\"), download the pdf preview of the document (\"preview\"), download the signed pdf preview of the document (\"signed_preview\"), get the audit certificate (\"audit_certificate\"), get the document_request object (\"self\")"
                  }
                }
              }
            }
          }
        }
      },
      "document_request_missing_data": {
        "type": "object",
        "properties": {
          "errors": {
            "type": "object",
            "properties": {
              "data": {
                "type": "array",
                "items": {
                  "type": "string",
                  "example": "The property '<json path>' did not contain a required property of '<property name>' in schema document-creation-payload"
                }
              }
            }
          }
        }
      },
      "document_request_mers_min_error": {
        "type": "object",
        "properties": {
          "errors": {
            "type": "object",
            "properties": {
              "min_number": {
                "type": "array",
                "items": {
                  "type": "string",
                  "example": "The property '<json path>' did not contain a required property of '<property name>' in schema document-creation-payload"
                }
              }
            }
          }
        }
      },
      "document_request_invalid_form_error": {
        "type": "object",
        "properties": {
          "errors": {
            "type": "object",
            "properties": {
              "form": {
                "type": "string",
                "example": "invalid form type"
              }
            }
          }
        }
      }
    }
  }
}