get
https://api.weatherit.ai/v1/policies
Find a policy by quote_id or payment_reference. At least one query parameter is required.
Recent Requests
Log in to see full request history
| Time | Status | User Agent | |
|---|---|---|---|
Retrieving recent requests… | |||
Loading…
Lookup Paths
flowchart LR
A["GET /policies"] --> B{"Query parameter?"}
B -->|"?quote_id=uuid"| C["Direct policy table<br/>lookup by quote_id"]
B -->|"?payment_reference=ref"| D["Transactions table →<br/>Policy table join"]
B -->|"Neither"| E["400 MISSING_PARAMETER"]
C --> F{"Found?"}
D --> F
F -->|"Yes"| G["200 + policy summary"]
F -->|"No"| H["200 + policy: null"]
style A fill:#e3f2fd
style G fill:#e8f5e9
style H fill:#fff3e0
style E fill:#fce4ec
What This Endpoint Does
- Searches for Policy: Finds a policy using quote_id or payment_reference
- Returns Summary: Provides basic policy info if found
- Handles Not Found: Returns null policy if no match (not an error)
When to Use This Endpoint
- Post-Purchase Lookup: Find policy_id after purchase using payment_reference
- Quote Conversion Check: Verify if a quote was converted to a policy
- Reconciliation: Match payments to policies
Query Parameters
| Parameter | Required | Description |
|---|---|---|
| quote_id | One required | UUID of the quote used to create the policy |
| payment_reference | One required | Payment reference used during purchase |
Provide exactly one parameter. The quote_id parameter does a direct policy lookup, while payment_reference searches via the transactions table. If both are provided, quote_id takes precedence.
Understanding the Response
policy object (null if not found):
| Field | Description |
|---|---|
| policy_id | UUID for policy operations |
| quote_id | Original quote that was purchased |
| policy_number | Human-readable reference |
| status | Policy status (active, cancelled, completed) |
| created_at | When policy was created |
Response Behaviour
- Policy found: Returns policy summary with 200 status
- Policy not found: Returns
"policy": nullwith 200 status (not an error) - Missing parameters: Returns 400 error
Error Handling
| Error | Code | Description |
|---|---|---|
| MISSING_PARAMETER | 400 | Neither quote_id nor payment_reference provided |
| VALIDATION_ERROR | 400 | Invalid parameter format |
Best Practices
- Use for lookup only: For full policy details, use
GET /policies/{policyId} - Check for null: Policy being null is a valid response, not an error
- Prefer quote_id: More reliable than payment_reference for exact matches
