Purchase Multi-Quote

Purchase all quotes in a multi-quote batch with a single payment transaction. Each quote can have its own booking reference.

This operation is idempotent — use X-Request-Id for safe retries.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…

Atomic Purchase Flow

sequenceDiagram
    participant P as Partner
    participant API as WeatherIT API
    participant DB as Database

    P->>API: POST /quotes/multi/{id}/purchase<br/>+ X-Request-Id (idempotency)
    API->>API: Check idempotency cache (7-day TTL)
    API->>DB: Validate all quotes in batch

    loop For each quote (sequential)
        API->>DB: accept_and_pay_quote
        alt Success
            DB-->>API: Policy created
        else Failure
            DB-->>API: Error
            Note over API: Entire batch fails
            API-->>P: 500 TRANSACTION_FAILED
        end
    end

    API-->>P: 200 All policies created

What This Endpoint Does

  1. Validates Batch: Confirms all quotes in the batch are still valid
  2. Atomic Purchase: Purchases all selected quotes together or none
  3. Creates Policies: Generates policy numbers and activates coverage for each
  4. Returns Summary: Provides transaction details and all created policies

When to Use This Endpoint

Call this endpoint when:

  • Customer has selected coverage options from a multi-quote batch
  • Payment has been processed for the combined total
  • You want to create multiple policies in a single transaction
  • You need rollback protection (all succeed or none)

Request Parameters

ParameterRequiredDescription
customer.emailYesCustomer email for policy documents
customer.firstNameYesCustomer first name (min 2 chars)
customer.lastNameYesCustomer last name (min 1 char)
customer.phoneNoContact phone for claims support
payment.transactionIdYesYour payment processor's transaction ID
purchases[].quoteIdYesQuote ID to purchase (from pricing_options)
purchases[].bookingReferenceNoBooking reference for this specific quote
bookingReferenceNoShared booking reference for all quotes

Understanding the Response

multi_purchase object contains:

FieldDescription
multi_idUUID of the multi-quote batch
transaction_idYour payment reference
policies[]Array of created policies
paymentCombined payment summary

policies[] for each policy:

FieldDescription
quote_idOriginal quote purchased
policy_idUUID for policy operations
policy_numberHuman-readable reference (e.g., "WIT-2025-00001")
statusPolicy status (typically "active")
premium_paidPremium for this policy

payment summary:

FieldDescription
total_amountCombined premium for all policies
currencyCurrency code (e.g., "AUD")
statusPayment status
transaction_timestampWhen purchase was processed

Error Handling

ErrorCodeDescription
MULTI_QUOTE_NOT_FOUND404Batch doesn't exist
QUOTE_EXPIRED410One or more quotes have expired
QUOTE_ALREADY_CONVERTED409Quote already purchased
VALIDATION_ERROR400Missing/invalid request fields
PARTIAL_FAILURE422Some quotes failed validation - entire transaction rolled back

Idempotency

Include X-Request-Id header for safe retries. The endpoint caches responses for 168 hours (7 days) - retrying with the same request-id returns the original response.

Best Practices

  1. Verify totals: Ensure payment amount matches sum of selected quote premiums
  2. Use idempotency: Always include X-Request-Id for production requests
  3. Store all policy_ids: Each policy in the batch may need individual operations later
  4. Handle rollbacks: If purchase fails, the entire batch is rolled back - create new quotes

Next Steps

After successful purchase:

  1. Send confirmation email with all policy numbers
  2. Store each policy_id linked to your bookings
  3. Use GET /policies/{id} to retrieve individual policy details
  4. Use POST /policies/{id}/cancel if a booking is cancelled
Path Params
uuid
required

UUID of the multi-quote batch

Body Params
customer
object
required
payment
object
required
string

Shared booking reference (can be overridden per purchase)

purchases
array of objects
required
purchases*
Headers
string

Idempotency key for safe retries. Send the same key and the same body when retrying. If a request with this key already completed within the TTL window (7 days for financial operations), the original response is returned with X-Idempotent-Replayed: true and nothing is re-executed. While the first request is still processing, a retry gets 409 CONFLICT_ERROR (details.reason = request_in_progress, Retry-After: 1). Reusing a key with a different body gets 422 VALIDATION_ERROR (details.reason = idempotency_key_reused). 5xx responses are not stored, so a retry after one executes again.

Responses

Language
Credentials
Bearer
API Key
URL
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json