Reload a saved contract
Get a saved contract's payload back, with fresh pricing, so the contract form can be refilled. The console uses this call when a draft, a duplicate or an amendment is opened.
The contract is looked up by ID and returned as it was last saved. Before returning, the call:
- sets
contractSourcetodealhuborconsole, - replaces
pricingwith the current catalog in the contract's currency (for Reseller contracts,resellerPricinginstead), - maps old Studio AI plan names to
ProorLite, - refreshes
rooftops[].rooftopNamefrom the live rooftop name when the rooftop already has ateamId, - fills
line_itemsandline_items_latest.
For contracts already in Contracted or Contract-Live, it can also correct billingDetails.billingEntity from the dealer group's billing customer record. Nothing is written. If a refresh step fails, the stored value is returned.
Send the bearer token of a signed-in Spyne Console user in Authorization: Bearer YOUR_TOKEN. The token is checked against the user validation endpoint on every call.
Before you call it
- You need a
contractId. It comes fromdata.contractIdof an earlier Save or submit a contract call, or from the contract history list. - The call is synchronous. It waits for the contract read and the pricing and rooftop name refresh. The rate limit is not documented.
Request
- Authenticate: send the
Authorization: Bearer YOUR_TOKENheader. - Name the contract: pass
contractIdas a query parameter.
Headers
| Parameter | Type | Required | Description |
|---|---|---|---|
Authorization | string | Required | Bearer YOUR_TOKEN |
Query parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
contractId | string | Required | ID of the contract to load. |
Sample request
curl -X GET "https://api.spyne.ai/credit/v6/contracting/prefill-contract-data?contractId=CONTRACT_ID" \
-H "Authorization: Bearer YOUR_TOKEN"import requests
res = requests.get(
"https://api.spyne.ai/credit/v6/contracting/prefill-contract-data",
params={"contractId": "CONTRACT_ID"},
headers={"Authorization": "Bearer YOUR_TOKEN"},
)
print(res.status_code, res.json())const res = await fetch(
"https://api.spyne.ai/credit/v6/contracting/prefill-contract-data?contractId=CONTRACT_ID",
{ headers: { Authorization: "Bearer YOUR_TOKEN" } }
);
console.log(res.status, await res.json());Sample response
The 200 response is shortened.
{
"message": "Contract payload fetched successfully",
"error": false,
"code": "",
"details": null,
"data": {
"isDraft": true,
"contractDetails": { "enterpriseId": "ENTERPRISE_ID", "currency": "USD", "dealType": "New Deal", "customerType": "Individual Dealer", "managerName": "" },
"customerDetails": { "legalName": "Example Motors LLC", "brandName": "Example Motors" },
"rooftops": [{ "rooftopName": "Example Motors", "bundle": "bundle-1", "productsLines": [] }],
"signatoryDetails": { "name": "Jane Doe", "email": "[email protected]" },
"billingDetails": { "billingFrequency": 12 },
"terms": { "contractTerm": 12 },
"summary": { "totalOneTimeFee": 0, "totalMonthlyRecurringFee": 0, "totalAnnuallyRecurringFee": 0 },
"pricing": { "conversationalAi": { "type": "<type>", "allowedProducts": {}, "items": {} } },
"contractSource": "console",
"line_items": { "type": "bundle", "value": { "bundle-1": {} } },
"line_items_latest": { "type": "bundle", "value": { "bundle-1": {} } }
}
}{ "message": "Invalid Token", "error": true, "code": "ERROR_AUTH_401", "details": null, "data": null }{
"message": "Contract not found for the given contract ID",
"error": true,
"code": "ERROR_NOT_FOUND_404",
"details": null,
"data": null
}{
"message": "<error message>",
"error": true,
"code": "ERROR_SERVER_500",
"details": null,
"data": null
}Response parameters
| Parameter | Type | Description |
|---|---|---|
data | object | The contract payload as it was last saved (the same shape as the body of Save or submit a contract), plus the fields below. |
data.contractSource | string | dealhub if the contract came from a DealHub quote, otherwise console. |
data.pricing | object | Current pricing catalog in the contract currency (non-Reseller contracts). |
data.resellerPricing | object | Current reseller pricing catalog (Reseller contracts only). |
data.line_items | object or null | Stored line items, or line items computed from the contract tree when none are stored. |
data.line_items_latest | object or null | Same value as line_items. |
Errors
| Status | Reason | When it happens |
|---|---|---|
400 | Missing input | contractId is not sent. The framework rejects the request before the handler runs. The body is not documented in code. |
401 | Invalid or missing token | No Bearer token, or the token failed validation. |
404 | Contract not found | No contract has this ID. |
408 | Request timed out | The token validation call could not connect. |
500 | Server error | Any other error, including a contractId that is not a valid ID format. The message is the underlying error text. |
What happens next
Refill the form with data, let the user edit, then call Save or submit a contract with the same contractId while the contract is still a draft.
Called before: Get contract config. Called after: Save or submit a contract.
Updated about 1 hour ago
