# Update a Scenario

Replace the existing scenario.

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "version": "1.0",
    "title": "Consumer Engagement: Loan Opportunities",
    "summary": "Consumer Engagement: Loan Opportunities",
    "description": "Use the Loan Opportunities APIs to create and manage the Opportunities-Loan Scenario tool. This service provides the APIs to create and update loan opportunities, compare up to 10 loan scenarios, convert a loan scenario into a loan, run EBS calculation on the loan scenario object, and ability to email scenario(s), and Eligibility letter to the borrower using the Loan Opportunity notification service."
  },
  "servers": [
    {
      "url": "https://api.elliemae.com",
      "description": "Production"
    },
    {
      "url": "https://concept.api.elliemae.com",
      "description": "UAT"
    }
  ],
  "paths": {
    "/loanOpportunity/v1/loanOpportunities/{opportunityId}/scenarios/{scenarioId}": {
      "put": {
        "tags": [
          "Scenario Management"
        ],
        "summary": "Update a Scenario",
        "description": "Replace the existing scenario.",
        "operationId": "update-a-scenario",
        "parameters": [
          {
            "name": "Authorization",
            "in": "header",
            "description": "Bearer token",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "opportunityId",
            "in": "path",
            "description": "The unique identifier of the opportunity to retrieve.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "scenarioId",
            "in": "path",
            "description": "The unique identifier of the scenario to retrieve.",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ScenarioContract"
              },
              "examples": {
                "Example 1": {
                  "value": {
                    "id": "{{ScenarioId}}",
                    "qualificationStatus": "Failed",
                    "dateCreated": "2020-05-19T20:39:40.1219206Z",
                    "dateModified": "2020-05-19T20:39:40.1219214Z",
                    "terms": {
                      "baseLoanAmount": 909000,
                      "term": "Fifteen",
                      "amortizationTermMonths": 360,
                      "amortizationType": "Fixed",
                      "loanType": "Conventional",
                      "downPaymentAmount": 100000,
                      "downPaymentPercent": 10,
                      "annualTaxesAmount": 9999.96,
                      "annualTaxesPercent": 1,
                      "annualInsuranceAmount": 9999.96,
                      "annualInsurancePercent": 1,
                      "borrowerRequestedLoanAmount": 900000,
                      "rate": 3.5,
                      "aprPercent": 3.628,
                      "monthlyPayment": 4081.82,
                      "points": 10,
                      "program": "Test",
                      "monthlyRealEstateTaxes": 100,
                      "monthlyHazardInsurance": 100,
                      "monthlyMIAmount": 757.5,
                      "monthlyMIPercent": 1,
                      "upfrontMIAmount": 1000,
                      "upfrontMIPercent": 1,
                      "programId": "123",
                      "purchasePrice": 1000000,
                      "subordinateFinancingPayment": 10,
                      "subordinateFinancingBalance": 10
                    },
                    "fee": {
                      "feeType": "OriginationPoints",
                      "payee": "Seller",
                      "description": "OriginationPoints",
                      "feePercent": 1,
                      "fixedFee": 4000,
                      "totalAmount": 13090,
                      "includeInAPR": true
                    },
                    "scenarioCost": {
                      "estimatedClosingCost": 2323.23,
                      "aprAmount": 1234,
                      "lenderCredit": 2345,
                      "sellerCredit": 3456,
                      "totalCost": 658
                    },
                    "totalPayment": 5049.32,
                    "dateStatusUpdated": "2020-05-19T20:39:40.1218878Z",
                    "qualifiers": [
                      {
                        "type": "CashToClose",
                        "fields": {
                          "totalCost": 996522.23,
                          "cashResult": -86672.23,
                          "loanAmount": 909000,
                          "cashAvailable": 840,
                          "cashToCloseAmount": 87512.23
                        },
                        "status": "Failed"
                      },
                      {
                        "type": "Affordability",
                        "fields": {
                          "totalIncome": 5637.264,
                          "housingRatio": 89.57,
                          "totalPayment": 5049.32,
                          "totalExpenses": 22400,
                          "debtToIncomeRatio": 486.93,
                          "housingRatioLimit": 100,
                          "debtToIncomeRatioLimit": 100
                        },
                        "status": "Failed"
                      }
                    ],
                    "qualifierSetting": {
                      "affordabilityQualification": {
                        "id": "9197f447-366f-452e-9eca-56c9adb08f65",
                        "affordabilities": [
                          {
                            "id": "9197f447-366f-452e-9eca-56c9adb08f65",
                            "product": "Conventional",
                            "housingRatio": 100,
                            "debtRatio": 100
                          }
                        ],
                        "updatedDate": "2020-05-19T11:16:17.5877621Z",
                        "updatedBy": "adminuser"
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Accepted"
          },
          "204": {
            "description": "No Content"
          },
          "400": {
            "description": "Bad Request"
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "404": {
            "description": "Not Found"
          },
          "500": {
            "description": "Internal Server Error"
          }
        },
        "servers": [
          {
            "url": "https://api.elliemae.com",
            "description": "Production"
          },
          {
            "url": "https://concept.api.elliemae.com",
            "description": "UAT"
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "ScenarioContract": {
        "type": "object",
        "title": "ScenarioContract",
        "description": "The following objects and attributes make up the EllieMae.LoanOpportunity.Contracts.ScenarioContract object, which represents a loan scenario contract. All attributes are optional unless otherwise specified.",
        "properties": {
          "dateCreated": {
            "type": "string",
            "description": "The date and time the scenario was created.\r\n",
            "format": "date-time"
          },
          "dateModified": {
            "type": "string",
            "description": "The date and time the scenario was modified.\r\n",
            "format": "date-time"
          },
          "dateStatusUpdated": {
            "type": "string",
            "description": "The date and time the qualification status was last updated.\r\n",
            "format": "date-time"
          },
          "fee": {
            "$ref": "#/components/schemas/LoanFeeContract",
            "description": "Fee information provided by the LoanFeeContract object.\r\n"
          },
          "id": {
            "type": "string",
            "description": "The unique, system-generated identifier of the scenario.\r\n"
          },
          "loanReferenceId": {
            "type": "string",
            "description": "The ID to bind the entity in Loan.\r\n"
          },
          "qualificationStatus": {
            "type": "string",
            "description": "The qualification status of the scenario.\r\n"
          },
          "qualifierSetting": {
            "$ref": "#/components/schemas/QualifierSettingContract",
            "description": "Qualifier details provided by the QualifierSettingContract object.\r\n"
          },
          "scenarioCost": {
            "$ref": "#/components/schemas/ScenarioCostContract",
            "description": "Scenario cost details provided by the ScenarioCostContract object.\r\n"
          },
          "scenarioIndicator": {
            "type": "string",
            "description": "Scenario Indicator - A-Z.\r\n"
          },
          "terms": {
            "$ref": "#/components/schemas/ScenarioTermsContract",
            "description": "Required. Scenario term details provided by the ScenarioTermsContract object.\r\n"
          },
          "totalPayment": {
            "type": "number",
            "description": "The total monthly payment for the scenario.",
            "format": "double"
          }
        },
        "required": [
          "terms"
        ]
      },
      "LoanFeeContract": {
        "type": "object",
        "title": "LoanFeeContract",
        "description": "The following objects and attributes make up the EllieMae.LoanOpportunity.Contracts.LoanFeeContractobject, which provides loan fee details. All attributes are optional unless otherwise specified.",
        "properties": {
          "description": {
            "type": "string",
            "description": "Description of the fee.\r\n"
          },
          "entityDeleted": {
            "type": "boolean",
            "description": "Indicates whether the entity was deleted.\r\n"
          },
          "feePercent": {
            "type": "number",
            "description": "Fee percentage.\r\n",
            "format": "double"
          },
          "feeType": {
            "type": "string",
            "description": "Required. Type of fees.\r\n"
          },
          "fixedFee": {
            "type": "number",
            "description": "Fixed fee.\r\n",
            "format": "double"
          },
          "id": {
            "type": "string",
            "description": "The unique, system-generated identifier of this scenario fee.\r\n"
          },
          "includeInAPR": {
            "type": "boolean",
            "description": "Indicates whether the fee is included in APR.\r\n"
          },
          "loanReferenceId": {
            "type": "string",
            "description": "The ID to bind the entity in the loan.\r\n"
          },
          "payee": {
            "type": "string",
            "description": "Indicates the entity that will collect this fee.\r\n"
          },
          "totalAmount": {
            "type": "number",
            "description": "Total amount of fees.\r\n",
            "format": "double"
          }
        }
      },
      "QualifierSettingContract": {
        "type": "object",
        "title": "QualifierSettingContract",
        "description": "The following objects and attributes make up the EllieMae.LoanOpportunity.Contracts.QualifierSettingContract object, which includes information about the qualifier settings. All attributes are optional unless otherwise specified.",
        "properties": {
          "id": {
            "type": "string",
            "description": "The unique, system-generated identifier of this qualifier setting.\r\n"
          },
          "loanReferenceId": {
            "type": "string",
            "description": "The ID to bind the entity in the loan.\r\n"
          },
          "affordabilityQualification ": {
            "$ref": "#/components/schemas/AffordabilityQualificationContract",
            "description": "AffordabilityQualificationContract"
          }
        }
      },
      "AffordabilityQualificationContract": {
        "type": "object",
        "title": "AffordabilityQualificationContract",
        "properties": {
          "affordabilities": {
            "type": "array",
            "description": "Affordabilitys for Qualification.\r\n",
            "items": {
              "$ref": "#/components/schemas/AffordabilityContract"
            }
          },
          "id": {
            "type": "string",
            "description": "The unique, system-generated identifier of this opportunity.\r\n\r\n"
          },
          "updatedBy": {
            "type": "string",
            "description": "Updated By of AffordabilityQualification.\r\n"
          },
          "updatedDate": {
            "type": "string",
            "description": "Updated Date of AffordabilityQualification.\r\n"
          }
        }
      },
      "AffordabilityContract": {
        "type": "object",
        "title": "AffordabilityContract",
        "properties": {
          "debtRatio": {
            "type": "number",
            "description": "Debt Ratio of Affordability.\r\n",
            "format": "double"
          },
          "housingRatio": {
            "type": "number",
            "description": "Housing Ratio of Affordability.\r\n",
            "format": "double"
          },
          "id": {
            "type": "string",
            "description": "The unique, system-generated identifier of this opportunity.\r\n\r\n"
          },
          "product": {
            "type": "string",
            "description": "Product name of Affordability.\r\n"
          }
        },
        "required": [
          "product"
        ]
      },
      "ScenarioCostContract": {
        "type": "object",
        "title": "ScenarioCostContract",
        "description": "The following objects and attributes make up the EllieMae.LoanOpportunity.Contracts.ScenarioCostContract object, which represents a loan ScenarioCost contract. All attributes are optional unless otherwise specified.",
        "properties": {
          "aprAmount": {
            "type": "number",
            "description": "The amount to be included in the APR.\r\n",
            "format": "double"
          },
          "entityId": {
            "type": "string",
            "description": "The unique identifier of the entity.\r\n"
          },
          "estimatedClosingCost": {
            "type": "number",
            "description": "The estimated closing cost.\r\n",
            "format": "double"
          },
          "id": {
            "type": "string",
            "description": "The unique, system-generated identifier of this Scenario Cost.\r\n"
          },
          "isEntityDeleted": {
            "type": "boolean",
            "description": "Indicates whether the entity is deleted.\r\n"
          },
          "lenderCredit": {
            "type": "number",
            "description": "Amount of lender compensation credits.\r\n",
            "format": "double"
          },
          "loanReferenceId": {
            "type": "string",
            "description": "The ID to bind the entity in the loan.\r\n"
          },
          "sellerCredit": {
            "type": "number",
            "description": "Amount of seller credits.\r\n",
            "format": "double"
          },
          "totalCost": {
            "type": "number",
            "description": "The total estimated closing costs.\r\n",
            "format": "double"
          }
        }
      },
      "ScenarioTermsContract": {
        "type": "object",
        "title": "ScenarioTermsContract",
        "description": "The following objects and attributes make up the EllieMae.LoanOpportunity.Contracts.ScenarioTermsContract object, which provides details about the terms for the scenario. All attributes are optional unless otherwise specified.",
        "properties": {
          "adjustableRateMortgage ": {
            "$ref": "#/components/schemas/AdjustableRateMortgageContract",
            "description": "Adjustable rate mortgage details provided by the AdjustableRateMortgageContract."
          },
          "amortizationTermMonths": {
            "type": "integer",
            "description": "Number of months in the loan amortization term."
          },
          "amortizationType": {
            "type": "string",
            "description": "Transaction details amortization type."
          },
          "annualInsuranceAmount": {
            "type": "number",
            "description": "Annual insurance amount in dollars.",
            "format": "double"
          },
          "annualInsurancePercent": {
            "type": "number",
            "description": "Percentage amount of annual insurance.\r\n",
            "format": "double"
          },
          "annualTaxesAmount": {
            "type": "number",
            "description": "Annual tax amount in dollars.",
            "format": "double"
          },
          "annualTaxesPercent": {
            "type": "number",
            "description": "Annual tax percent amount.\r\n",
            "format": "double"
          },
          "aprPercent": {
            "type": "number",
            "description": "Annual percentage rate (APR).\r\n",
            "format": "double"
          },
          "baseLoanAmount": {
            "type": "number",
            "description": "The loan amount.\r\n",
            "format": "double"
          },
          "borrowerRequestedLoanAmount": {
            "type": "number",
            "description": "Borrower required loan amount.\r\n",
            "format": "double"
          },
          "closingCostTemplateId": {
            "type": "string",
            "description": "Unique identifier of the closing cost template used for the loan.\r\n"
          },
          "downPaymentAmount": {
            "type": "number",
            "description": "Transaction details down payment amount.",
            "format": "double"
          },
          "downPaymentPercent": {
            "type": "number",
            "description": "Transaction details down payment percentage.\r\n",
            "format": "double"
          },
          "financedGuaranteePercentage ": {
            "type": "number",
            "description": "The financed guarantee percentage rate.",
            "format": "double"
          },
          "financingType": {
            "type": "string",
            "description": "USDA financing type.\r\n"
          },
          "id": {
            "type": "string",
            "description": "The unique, system-generated identifier of this scenario term."
          },
          "includeMIInAPRCalculation": {
            "type": "boolean",
            "description": "Indicates whether the monthly MI will be included in the APR calculation."
          },
          "loanReferenceId": {
            "type": "string",
            "description": "The ID to bind the entity in the loan."
          },
          "loanType": {
            "type": "string",
            "description": "Required. The type of loan. For example, VA or FHA."
          },
          "monthlyHOAFeeAmount": {
            "type": "number",
            "description": "The monthly cost of HOA fees in dollars with 2 decimals.",
            "format": "double"
          },
          "monthlyHazardInsurance": {
            "type": "number",
            "description": "The monthly cost of Hazard Insurance in dollars.",
            "format": "double"
          },
          "monthlyMIAmount": {
            "type": "number",
            "description": "The monthly cost of mortgage insurance in dollars.",
            "format": "double"
          },
          "monthlyMIPercent": {
            "type": "number",
            "description": "Adjustment Factor - Percentage rate of the monthly mortgage insurance payments that the borrower will make.",
            "format": "double"
          },
          "monthlyPayment": {
            "type": "number",
            "description": "The proposed monthly housing expenses.",
            "format": "double"
          },
          "monthlyRealEstateTaxes": {
            "type": "number",
            "description": "Monthly real estate taxes in dollars.",
            "format": "double"
          },
          "points": {
            "type": "number",
            "description": "Points value.",
            "format": "double"
          },
          "price": {
            "type": "number",
            "description": "Price.",
            "format": "double"
          },
          "program": {
            "type": "string",
            "description": "Product and Pricing program name - from ICE PPE."
          },
          "programId": {
            "type": "string",
            "description": "Unique identifier of the program."
          },
          "purchasePrice": {
            "type": "number",
            "description": "Purchase price.",
            "format": "double"
          },
          "rate": {
            "type": "number",
            "description": "Rate percent."
          },
          "reSubordinatedFirstBalance": {
            "type": "number",
            "description": "Expenses present mortgage payment.",
            "format": "double"
          },
          "reSubordinatedFirstPayment": {
            "type": "number",
            "description": "Expenses proposed mortgage payment.",
            "format": "double"
          },
          "reSubordinatedSecondBalance": {
            "type": "number",
            "description": "Transaction Details subordinate financing.",
            "format": "double"
          },
          "reSubordinatedSecondPayment ": {
            "type": "number",
            "description": "Expenses Present Other Payment.",
            "format": "double"
          },
          "subordinateFinancingBalance": {
            "type": "number",
            "description": "Subordinate Financing Balance.",
            "format": "double"
          },
          "subordinateFinancingPayment": {
            "type": "number",
            "description": "Expenses Proposed Other Payment.\r\n",
            "format": "double"
          },
          "term": {
            "type": "string",
            "description": "Required. The loan term. For example, 30YearsFixed, 15YearsFixed, 5YearsARM."
          },
          "upfrontMIAmount": {
            "type": "number",
            "description": "MortgageInsurancePremium Fees - BorPaidAmount.",
            "format": "double"
          },
          "upfrontMIPercent": {
            "type": "number",
            "description": "Mortgage Insurance Premium Upfront Factor Percentage.",
            "format": "double"
          }
        }
      },
      "AdjustableRateMortgageContract": {
        "type": "object",
        "title": "AdjustableRateMortgageContract",
        "description": "The following objects and attributes make up the EllieMae.LoanOpportunity.Contracts.AdjustableRateMortgageContract object, which includes adjustable rate information. All attributes are optional unless otherwise specified.\n\n",
        "properties": {
          "id": {
            "type": "string",
            "description": "The unique, system-generated identifier of this AdjustableRateMortgage."
          },
          "indexCurrentValuePercent": {
            "type": "number",
            "description": "ARM index current value percentage.",
            "format": "double"
          },
          "indexMarginPercent": {
            "type": "number",
            "description": "ARM index margin percentage.",
            "format": "double"
          },
          "loanReferenceId": {
            "type": "string",
            "description": "The ID to bind the entity in the loan."
          },
          "rateAdjustmentDurationMonthsCount": {
            "type": "integer",
            "description": "ARM rate adjustment duration in months.",
            "format": "int32"
          },
          "rateAdjustmentLifetimeCapPercent": {
            "type": "number",
            "description": "ARM rate adjustment lifetime cap percent.",
            "format": "double"
          },
          "rateAdjustmentPercent": {
            "type": "number",
            "description": "ARM rate adjustment percentage.",
            "format": "double"
          },
          "rateAdjustmentSubsequentCapPercent": {
            "type": "number",
            "description": "ARM rate adjustment subsequent cap percent.",
            "format": "double"
          },
          "subsequentRateAdjustmentMonthsCount": {
            "type": "integer",
            "description": "ARM subsequent rate adjustment in months.",
            "format": "int32"
          }
        }
      }
    }
  },
  "x-readme": {
    "explorer-enabled": false,
    "proxy-enabled": true
  },
  "_id": {
    "buffer": {
      "0": 105,
      "1": 160,
      "2": 117,
      "3": 92,
      "4": 236,
      "5": 39,
      "6": 168,
      "7": 188,
      "8": 217,
      "9": 99,
      "10": 87,
      "11": 218
    }
  }
}
```