Get quote results
POST /v1/quote-requests answers right away with 202 and a quote request whose status is in_progress. Truvo then asks the carriers in the background, and their quotes arrive one at a time over up to 60 seconds.
Each change to the request raises its version: the start of its run, each new quote, and the final status. A read never starts a new rating run. You can hear about the changes in four ways:
The example
The figures in the table come from one quote request:
- The request starts at 0 s. Its
202answer is version 1, and its run starts right after that, at version 2. - Quotes arrive at 4, 9, 15, and 38 seconds. Each one raises the version.
- One carrier never answers, so the request completes at the 60-second deadline with four quotes.
Webhooks
Subscribe a URL to quote_request.updated, quote_request.completed, quote_request.incomplete, and quote_request.failed. Truvo sends a signed POST each time the request changes, and you read the request when an event arrives. Webhooks covers subscriptions, signatures, and retries.
In the example, Truvo sends six events: one when the request starts, one for each quote, and quote_request.completed at 60 s. Each event names only the request and its new version, so read the request to get the quotes.
You need an https URL on a public host that answers 2xx within 15 seconds. The webhook routes answer 404 while Truvo has webhooks turned off.
Quick polling
Without Prefer: wait, a read answers at once. Read the request every few seconds until its status is no longer in_progress.
In the example, a read every 2 seconds takes 31 reads from 0 s to 60 s. Each quote shows up 0 to 2 seconds after it arrives, so the first price shows by 6 s. Each read counts toward your rate limit, so a faster loop uses more of it.
Waiting reads
Add Prefer: wait=20 and since_version to the read:
Prefer: wait=Nholds the read open for up toNseconds, whereNis a whole number from 0 to 20. The read answers as soon as the request changes: a new quote, a new status, or the end of the request.since_versionis theversionfrom the last answer you got, starting with the202answer. If the request is already newer, or its status isn’tin_progress, the read answers at once, so a quote that arrives between two of your reads doesn’t wait for the next change. A version higher than the current one counts as the current one. Withoutsince_version, the wait counts from the version that the read finds first.
In the example, each read sends the version of the answer before it:
A held read answers within about a second of the change. A read that the server held carries Preference-Applied: wait=N, and a read that answered at once doesn’t. When the server can’t hold a read, it answers at once with Retry-After and without Preference-Applied. Wait that many seconds before you read again.
A Prefer value or a since_version that isn’t valid gets 422 with the code invalid_input.
The loop
This loop starts from the version in the 202 answer, waits out Retry-After when an answer has it, and stops when the status is no longer in_progress:
Agents over MCP
An agent that uses the Truvo MCP server calls get_quote_request, which works like a waiting read:
wait_secondstakes the place ofPrefer: wait, from 0 to 20, and the wait is 20 seconds when the agent leaves it out.since_versionworks as it does over HTTP.- Read
statusin thestart_quote_requestresult and eachget_quote_requestresult. While it isin_progress, callget_quote_requestagain with the sameid,wait_seconds: 20, andsince_versionset to theversionyou just read. If you read by handle, send the sameread_handletoo.
In the example, the agent makes the same 8 calls as the waiting reads above, and it can tell the person about each quote as it arrives.
The 60-second deadline
Truvo currently stops collecting answers 60 seconds after it accepts a quote request, then finishes the request with the answers it has.
- A carrier that hasn’t answered by then reads
no_answerinmarket_outcomes. - With no quote or offline quote, all listed carriers giving no answer leaves the request
incomplete, with the reasonno_carrier_answered; a decline beside silence usescarriers_unavailable. You can try a new request later; it may still return no quotes. - If the run could not start or the call broke, the request ends
failed. A run that lists no carriers also staysfailed. - A finished request doesn’t change.
Statuses
Switch on status.
status_details says why the request has its status: a reason and a message that you can show the person. New reasons can arrive in any revision, so show message, and give any switch on reason a default branch. The reasons today:
Read the result
quotesgives the ID and the version of each quote. A carrier can give a quote for each product it prices. To read one quote version, callGET /v1/quotes/{id}?version=.market_outcomeshas one entry for each carrier result on this request:quote,offline_quote,decline,missing_information,pending, orno_answer. Each entry names the carrier bycarrier.idandcarrier.name. A carrier with several quotes has onequoteentry, which names its first quote.offline_quotemeans the carrier offered a price that the person can’t buy online through Truvo.next_actionslists what you can do next.status_details.retry_actionisnullunless the request isincompleteorfailed. When a request failed, follow its retry action. When it is incomplete, follow it only if you try a new request. Use a newIdempotency-Keyfor that request.
failed is an error on Truvo’s side and always says what to do next. incomplete is a finished result where carriers gave no final answer. Neither completed nor incomplete is an error.
A request with zero quotes completes with offline_quotes_only when a carrier offered a price that the person can’t buy online through Truvo, and with no_quotes when every carrier result is a final answer without a quote. It ends incomplete when listed carriers gave no final answer and there is no quote or offline quote. Why did a request finish with no quotes? says what to do in each case.
Quote statuses
Each quote has its own status and status_details.
The reasons today are available for an active quote, and expired for an inactive one. New reasons can arrive in any revision.
Show quotes to a person covers each quote field, the price, and the actions that send the person to buy.