Skip to content

PATCH /scenarios/[id]

Partially update an existing scenario.

Updates specific fields in a scenario without affecting other fields. This endpoint uses PATCH semantics - you only need to include the fields you want to update. All other fields will remain unchanged.

Required: RSA signature-based authentication

X-Auth-Client-ID: {clientId}
X-Auth-Access-Token: {accessToken}
X-Auth-Timestamp: {timestamp}
X-Auth-Nonce: {nonce}
X-Auth-Signature: {signature}

Method: PATCH

URL: https://api.quickli.com/api/v1/scenarios/id

Path Parameters:

  • id (required) - Scenario ObjectId

Headers:

X-Auth-Client-ID: {clientId}
X-Auth-Access-Token: {accessToken}
X-Auth-Timestamp: {timestamp}
X-Auth-Nonce: {nonce}
X-Auth-Signature: {signature}
Content-Type: application/json

Body (at least one field required):

{
"households": [...],
"income": [...],
"rental_income": [...],
"securities": [...],
"self_employed_income": [...],
"home_loans": [...],
"liabilities": [...],
"living_expenses": [...],
"additional_info": {...}
}

Returns the complete updated scenario (same format as GET).

{
"data": {
"id": "507f1f77bcf86cd799439011",
"teamId": "507f191e810c19729de860ea",
"description": "Family home purchase",
"createdBy": "broker@example.com",
"dateCreated": "2025-11-03T10:30:00.000Z",
"lastEditedBy": "broker@example.com",
"lastEditedOn": "2025-11-03T11:00:00.000Z",
"scenario": { /* Complete updated scenario */ }
},
"meta": {
"timestamp": "2025-11-03T11:00:00.000Z",
"version": "v1"
}
}

No fields provided for update.

Invalid credentials.

Scenario belongs to a team you don’t have access to.

Scenario doesn’t exist or you don’t have permission.

Invalid scenario data.

Terminal window
# Update only households
curl -X PATCH https://api.quickli.com/api/v1/scenarios/507f1f77bcf86cd799439011 \
-H "X-Auth-Client-ID: {clientId}" \
-H "X-Auth-Access-Token: {accessToken}" \
-H "X-Auth-Timestamp: {timestamp}" \
-H "X-Auth-Nonce: {nonce}" \
-H "X-Auth-Signature: {signature}" \
-H "Content-Type: application/json" \
-d '{
"households": [{
"id": "household-1",
"status": "single",
"num_adults": 1,
"num_dependants": 2,
"postcode": 3000,
"shared_with_households": []
}]
}'
# Update only income
curl -X PATCH https://api.quickli.com/api/v1/scenarios/507f1f77bcf86cd799439011 \
-H "X-Auth-Client-ID: {clientId}" \
-H "X-Auth-Access-Token: {accessToken}" \
-H "X-Auth-Timestamp: {timestamp}" \
-H "X-Auth-Nonce: {nonce}" \
-H "X-Auth-Signature: {signature}" \
-H "Content-Type: application/json" \
-d '{
"income": [{
"id": "income-1",
"which_household": 0,
"payg": 120000
}]
}'
# Update multiple fields
curl -X PATCH https://api.quickli.com/api/v1/scenarios/507f1f77bcf86cd799439011 \
-H "Authorization: Bearer ${CLIENT_SECRET}:${API_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"households": [...],
"income": [...]
}'

Change postcode or number of dependants without affecting income or loans:

await updateScenario(scenarioId, {
households: [{
id: 'household-1',
status: 'single',
num_adults: 1,
num_dependants: 3, // Changed from 2 to 3
postcode: 2000,
shared_with_households: []
}]
});
// Income, home_loans, and all other fields remain unchanged

Add a new income source without re-sending the entire scenario:

// Fetch current income
const scenario = await getScenario(scenarioId);
// Add new income
await updateScenario(scenarioId, {
income: [
...scenario.scenario.income,
{
id: 'income-2',
which_household: 0,
payg: 25000
}
]
});
// Households, liabilities, and all other fields remain unchanged

Update loan details without affecting applicant information:

const scenario = await getScenario(scenarioId);
scenario.scenario.home_loans[0].loan_amount = 700000;
await updateScenario(scenarioId, {
home_loans: scenario.scenario.home_loans
});
// Income, households, and all other fields remain unchanged

Update households and income together while preserving other fields:

await updateScenario(scenarioId, {
households: [...], // Updated households
income: [...] // Updated income
});
// liabilities, living_expenses, and all other fields remain unchanged
// Only send what you want to change
await updateScenario(scenarioId, {
households: [...]
});
// Efficient - single DB operation
// Safe - other fields preserved
// Had to fetch, modify, and send everything back
const scenario = await getScenario(scenarioId);
scenario.scenario.households = [...];
await updateScenario(scenarioId, {
scenario: scenario.scenario // All fields required
});
// Less efficient - fetch + update
// Risk of race conditions
  • Partial updates: Only provided fields are modified - omitted fields remain unchanged
  • Efficient: Single database operation, no fetch required
  • Safe: No risk of overwriting fields you didn’t intend to change
  • Cannot change teamId: Team ownership is immutable after creation
  • lastEditedBy and lastEditedOn are automatically updated
  • At least one scenario field must be provided

Last updated: 2025-11-19