{
  "openapi": "3.1.0",
  "info": {
    "title": "Reporting",
    "version": "v1"
  },
  "tags": [
    {
      "name": "Authentication"
    },
    {
      "name": "Users"
    },
    {
      "name": "Borrower Activities"
    },
    {
      "name": "Transaction Statuses"
    }
  ],
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "servers": [
    {
      "url": "https://api.snapdocs.com",
      "description": "Production"
    },
    {
      "url": "https://api.cs-demo0.snpd.io",
      "description": "Demo"
    },
    {
      "url": "https://api.cx-int0.snpd.io",
      "description": "Integrator"
    }
  ],
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "schemas": {
      "meta": {
        "type": "object",
        "description": "The object storing metadata about the returned transaction status results.",
        "properties": {
          "current_page": {
            "type": "integer",
            "description": "The current page of the paginated results."
          },
          "next_page": {
            "type": [
              "integer",
              "null"
            ],
            "description": "The next page number of the paginated results."
          },
          "page_size": {
            "type": "integer",
            "description": "The number of results per page."
          },
          "total_count": {
            "type": "integer",
            "description": "The total number of results."
          },
          "total_pages": {
            "type": "integer",
            "description": "The total number of pages of paginated results."
          }
        }
      },
      "closing_error": {
        "properties": {
          "detail": {
            "type": "string"
          },
          "title": {
            "type": "string"
          }
        }
      },
      "get_borrower_activities": {
        "properties": {
          "data": {
            "type": "array",
            "description": "The array storing individual Borrower activities results.",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "integer",
                  "description": "The internal unique identifier for a Snapdocs closing."
                },
                "appointment_date_time": {
                  "type": "string",
                  "description": "The new timestamp if the Settlement agent made changes to the original appointment date time sent in for closing creation."
                },
                "appointment_original_date_time": {
                  "type": "string",
                  "description": "The original appointment date and time sent by the Lender for closing creation. If there are changes in the appointment date and time, this field will be populated accordingly."
                },
                "closing_created_date_time": {
                  "type": "string",
                  "description": "The timestamp when the closing was created in Snapdocs system."
                },
                "closing_type": {
                  "type": "string",
                  "description": "The closing type sent by the Lender associated with each closing."
                },
                "doc_preview_available_date_time": {
                  "type": "string",
                  "description": "The timestamp when the document was sent to the Borrower for review. There will be a row for each Borrower."
                },
                "doc_preview_completed_date_time": {
                  "type": "string",
                  "description": "The timestamp when the Borrower has reviewed the available document. There will be a row for each Borrower."
                },
                "esign_status": {
                  "type": "string",
                  "description": "The current status of eSigning for each Borrower."
                },
                "esigning_completed_date_time": {
                  "type": "string",
                  "description": "The timestamp when the Borrower has completed eSigning. There will be a row for each Borrower."
                },
                "esigning_start_date_time": {
                  "type": "string",
                  "description": "The timestamp when the Borrower starts the eSigning process. There will be a row for each Borrower."
                },
                "file_number": {
                  "type": "string",
                  "description": "The file number / loan number which was sent to Snapdocs for each closing."
                },
                "last_modified_date_time": {
                  "type": "string",
                  "description": "The timestamp when any of the above fields are updated in the target table. This will be the timestamp used in query to find incremental updates."
                },
                "property_state": {
                  "type": "string",
                  "description": "This field will be used in the near future."
                },
                "settlement_office_email_address": {
                  "type": "string",
                  "description": "The email address of the Settlement office handling the closing."
                },
                "settlement_office_name": {
                  "type": "string",
                  "description": "The name of the Settlement office handling the closing."
                },
                "signer_email_address": {
                  "type": "string",
                  "description": "The Borrower's email of this closing. There will be a row for each Borrower."
                },
                "signer_first_name": {
                  "type": "string",
                  "description": "The Borrower's first name of this closing. There will be a row for each Borrower."
                },
                "signer_id": {
                  "type": "string",
                  "description": "This is the unique UserID for each Borrower."
                },
                "signer_last_name": {
                  "type": "string",
                  "description": "The Borrower's last name of this closing. There will be a row for each Borrower."
                },
                "signer_removed_date_time": {
                  "type": "string",
                  "description": "The timestamp when the Borrower was deactivated in the Snapdocs system and a new Borrower was created."
                },
                "status": {
                  "type": "string",
                  "description": "The current status of the closing in Snapdocs system."
                },
                "status_change_date_time": {
                  "type": "string",
                  "description": "The latest timestamp when the transaction status was updated to either Close, Canceled or Reopen."
                },
                "wet_sign_status": {
                  "type": "string",
                  "description": "The current status of the Wet sign."
                }
              }
            }
          },
          "meta": {
            "$ref": "#/components/schemas/meta"
          }
        },
        "example": {
          "data": [
            {
              "id": 1000,
              "appointment_date_time": "2020-10-26T19:23:18.056Z",
              "appointment_original_date_time": "2020-10-26T19:23:18.056Z",
              "closing_created_date_time": "2020-10-26T19:23:18.056Z",
              "closing_type": "Wet Signing",
              "doc_preview_available_date_time": "2020-10-26T19:23:18.056Z",
              "doc_preview_completed_date_time": "2020-10-26T19:23:18.056Z",
              "esign_status": "Done",
              "esigning_completed_date_time": "2020-10-26T19:23:18.056Z",
              "esigning_start_date_time": "2020-10-26T19:23:18.056Z",
              "file_number": "1000",
              "last_modified_date_time": "2020-10-26T13:23:18.000Z",
              "property_state": "Done",
              "settlement_office_email_address": "email@email.com",
              "settlement_office_name": "Office",
              "signer_email_address": "email1000@example.com",
              "signer_first_name": "Larry",
              "signer_id": "3456",
              "signer_last_name": "Lenderson",
              "signer_removed_date_time": "2020-10-26T13:23:18-06:00",
              "status": "Created",
              "status_change_date_time": "2020-10-26T19:23:18.056Z",
              "wet_sign_status": "Done"
            }
          ],
          "meta": {
            "current_page": 1,
            "next_page": null,
            "page_size": 200,
            "total_count": 1,
            "total_pages": 1
          }
        }
      },
      "get_users": {
        "properties": {
          "data": {
            "type": "array",
            "description": "The array storing individual user results.",
            "items": {
              "type": "object",
              "properties": {
                "first_name": {
                  "type": "string",
                  "description": "The first name of the Lender user who logged into Snapdocs system."
                },
                "last_name": {
                  "type": "string",
                  "description": "The last name of the Lender user who logged into Snapdocs system."
                },
                "email_address": {
                  "type": "string",
                  "description": "The email address of the Lender user who logged into Snapdocs system."
                },
                "role": {
                  "type": "string",
                  "description": "The role of the Lender user logging in (e.g., Closure, Admin, Loan Officer, etc.)"
                },
                "isactive": {
                  "type": "boolean",
                  "description": "The current status of the Lender user. Display `True` if it's an active user. Display `False` if it's an Inactive users."
                },
                "last_action_date_time": {
                  "type": "string",
                  "description": "The last time this Lender user logged into the platform. This timestamp will be used to filter query using Start and End Timestamp in the API request."
                }
              }
            }
          },
          "meta": {
            "$ref": "#/components/schemas/meta"
          }
        },
        "example": {
          "data": [
            {
              "first_name": "John",
              "last_name": "Smith",
              "email_address": "john.smith@email.com",
              "role": "Closer",
              "isactive": true,
              "last_action_date_time": "2020-10-26T19:23:18.056Z"
            }
          ],
          "meta": {
            "current_page": 1,
            "next_page": null,
            "page_size": 200,
            "total_count": 1,
            "total_pages": 1
          }
        }
      },
      "get_transaction_statuses": {
        "properties": {
          "data": {
            "type": "array",
            "description": "The array storing storing individual transaction status results.",
            "items": {
              "type": "object",
              "properties": {
                "appointment_date_time": {
                  "type": "string",
                  "description": "The original appointment date and time sent by the Lender for closing creation. If there are changes in the appointment date and time, this field will be populated accordingly."
                },
                "closing_created_at": {
                  "type": "string",
                  "description": "The timestamp when the closing was created in Snapdocs system."
                },
                "closing_type": {
                  "type": "string",
                  "description": "The closing type sent by the Lender associated with each closing."
                },
                "esign_status": {
                  "type": "string",
                  "description": "The current status of eSigning."
                },
                "esigning_completed_date_time": {
                  "type": "string",
                  "description": "The timestamp when the Borrower has completed eSigning. There will be a row for each Borrower."
                },
                "file_number": {
                  "type": "string",
                  "description": "The file number / loan number which was sent to Snapdocs for each closing."
                },
                "id": {
                  "type": "integer",
                  "description": "The internal ClosingID."
                },
                "last_modified_date_time": {
                  "type": "string",
                  "description": "The timestamp when any of the above fields are updated in the target table. This will be the timestamp used in query to find incremental updates."
                },
                "property_state": {
                  "type": "string",
                  "description": "This field will be used in the near future."
                },
                "settlement_office_email_address": {
                  "type": "string",
                  "description": "The email address of the Settlement office handling the closing."
                },
                "settlement_office_name": {
                  "type": "string",
                  "description": "The name of the Settlement office handling the closing."
                },
                "signer_first_name": {
                  "type": "string",
                  "description": "The Borrower's first name of this closing. There will be a row for each Borrower."
                },
                "signer_last_name": {
                  "type": "string",
                  "description": "The Borrower's last name of this closing. There will be a row for each Borrower."
                },
                "status": {
                  "type": "string",
                  "description": "The current status of the closing in Snapdocs system."
                },
                "status_change_date_time": {
                  "type": "string",
                  "description": "The latest timestamp when the transaction status was updated to either Close, Canceled or Reopen."
                },
                "wet_sign_status": {
                  "type": "string",
                  "description": "The current status of the Wet sign."
                }
              }
            }
          },
          "meta": {
            "$ref": "#/components/schemas/meta"
          }
        },
        "example": {
          "data": [
            {
              "appointment_date_time": "2020-10-26T19:23:18.058Z",
              "closing_created_at": "2020-10-26T19:23:18.058Z",
              "closing_type": "Wet Signing",
              "esign_status": "Done",
              "esigning_completed_date_time": "2020-10-26T19:23:18.058Z",
              "file_number": "1000",
              "id": 1000,
              "last_modified_date_time": "2020-10-26T19:23:18.058Z",
              "property_state": "Done",
              "settlement_office_email_address": "email@email.com",
              "settlement_office_name": "Office",
              "signer_first_name": "Sally",
              "signer_last_name": "Signer",
              "status": "Created",
              "status_change_date_time": "2020-10-26T19:23:18.058Z",
              "wet_sign_status": "Done"
            }
          ],
          "meta": {
            "current_page": 1,
            "next_page": null,
            "page_size": 200,
            "total_count": 1,
            "total_pages": 1
          }
        }
      }
    }
  },
  "paths": {
    "/insights/v1/borrower_activities": {
      "get": {
        "summary": "Get borrower activities",
        "tags": [
          "Borrower Activities"
        ],
        "description": "This endpoint will return all data associated with Borrowers Activities.",
        "operationId": "BorrowerActivitiesIndex",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "current_page",
            "in": "query",
            "schema": {
              "type": "integer",
              "example": 1,
              "description": "The current page of results returned."
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "schema": {
              "type": "integer",
              "example": 200,
              "description": "The number of records per page of results returned."
            }
          },
          {
            "name": "start_timestamp",
            "in": "query",
            "schema": {
              "type": "string",
              "example": "2020-09-28T23:59:59.999Z",
              "description": "The start timestamp filters results returned starting on or after this last_action_date_time. If no timestamp is supplied, this will default to the beginning of the current day."
            }
          },
          {
            "name": "end_timestamp",
            "in": "query",
            "schema": {
              "type": "string",
              "example": "2020-09-29T23:59:59.999Z",
              "description": "The end timestamp filters results returned starting on or after this last_action_date_time. If no timestamp is supplied, this will default to the end of the current day."
            }
          },
          {
            "name": "order_by",
            "in": "query",
            "schema": {
              "example": "asc",
              "enum": [
                "desc"
              ],
              "type": "string",
              "description": "The sort order in which records should be returned based on the last_action_date_time. Defaults to 'desc' if no value is supplied."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "successful",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/get_borrower_activities"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized. The Authorization header was missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "errors": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "status": {
                            "type": "string",
                            "example": "401"
                          },
                          "title": {
                            "type": "string",
                            "example": "Unauthorized"
                          },
                          "detail": {
                            "type": "string",
                            "example": "Authorization is invalid"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/insights/v1/transaction_statuses": {
      "get": {
        "summary": "Get transaction statuses",
        "tags": [
          "Transaction Statuses"
        ],
        "description": "This endpoint will return all data associated with Transaction Statuses.",
        "operationId": "TransactionStatusesIndex",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "current_page",
            "in": "query",
            "schema": {
              "type": "integer",
              "example": 1,
              "description": "The current page of results returned."
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "schema": {
              "type": "integer",
              "example": 200,
              "description": "The number of records per page of results returned."
            }
          },
          {
            "name": "start_timestamp",
            "in": "query",
            "schema": {
              "type": "string",
              "example": "2020-09-28T23:59:59.999Z",
              "description": "The start timestamp filters results returned starting on or after this last_action_date_time. If no timestamp is supplied, this will default to the beginning of the current day."
            }
          },
          {
            "name": "end_timestamp",
            "in": "query",
            "schema": {
              "type": "string",
              "example": "2020-09-29T23:59:59.999Z",
              "description": "The end timestamp filters results returned starting on or after this last_action_date_time. If no timestamp is supplied, this will default to the end of the current day."
            }
          },
          {
            "name": "order_by",
            "in": "query",
            "schema": {
              "example": "asc",
              "enum": [
                "desc"
              ],
              "type": "string",
              "description": "The sort order in which records should be returned based on the last_action_date_time. Defaults to 'desc' if no value is supplied."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "successful",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/get_transaction_statuses"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized. The Authorization header was missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "errors": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "status": {
                            "type": "string",
                            "example": "401"
                          },
                          "title": {
                            "type": "string",
                            "example": "Unauthorized"
                          },
                          "detail": {
                            "type": "string",
                            "example": "Authorization is invalid"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/insights/v1/users": {
      "get": {
        "summary": "Get users",
        "tags": [
          "Users"
        ],
        "description": "This endpoint will return all the data associated with Users.",
        "operationId": "UsersIndex",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "current_page",
            "in": "query",
            "schema": {
              "type": "integer",
              "example": 1,
              "description": "The current page of results returned."
            }
          },
          {
            "name": "page_size",
            "in": "query",
            "schema": {
              "type": "integer",
              "example": 200,
              "description": "The number of records per page of results returned."
            }
          },
          {
            "name": "start_timestamp",
            "in": "query",
            "schema": {
              "type": "string",
              "example": "2020-09-28T23:59:59.999Z",
              "description": "The start timestamp filters results returned starting on or after this last_action_date_time. If no timestamp is supplied, this will default to the beginning of the current day."
            }
          },
          {
            "name": "end_timestamp",
            "in": "query",
            "schema": {
              "type": "string",
              "example": "2020-09-29T23:59:59.999Z",
              "description": "The end timestamp filters results returned starting on or after this last_action_date_time. If no timestamp is supplied, this will default to the end of the current day."
            }
          },
          {
            "name": "order_by",
            "in": "query",
            "schema": {
              "example": "asc",
              "enum": [
                "desc"
              ],
              "type": "string",
              "description": "The sort order in which records should be returned based on the last_action_date_time. Defaults to 'desc' if no value is supplied."
            }
          }
        ],
        "responses": {
          "200": {
            "description": "successful",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/get_users"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized. The Authorization header was missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "errors": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "status": {
                            "type": "string",
                            "example": "401"
                          },
                          "title": {
                            "type": "string",
                            "example": "Unauthorized"
                          },
                          "detail": {
                            "type": "string",
                            "example": "Authorization is invalid"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}