Contract the policy of a quoted home
const url = 'https://integrador.avalisto.com/v1/home/policies';const options = { method: 'POST', headers: { 'idempotency-key': 'example', Authorization: 'Bearer <token>', 'Content-Type': 'application/json' }, body: '{"quoteId":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://integrador.avalisto.com/v1/home/policies \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --header 'idempotency-key: example' \ --data '{ "quoteId": "example" }'Requires an Idempotency-Key. A quote is never contracted twice: if it already is, you get 200 with the existing policy. If you get 503, check GET /v1/home/quotes/{id} before retrying.
Authorizations
Sección titulada «Authorizations»Parameters
Sección titulada «Parameters»Header Parameters
Sección titulada «Header Parameters»UUID v4
Request Bodyrequired
Sección titulada «Request Bodyrequired»object
Quote id with an accepted proposal (POST /v1/home/quotes/{id}/proposal)
Example generated
{ "quoteId": "example"}Responses
Sección titulada «Responses»Already contracted
object
Policy id
Quote the policy was contracted from
Product id
Policy number
Status
Coverage start (ISO YYYY-MM-DD)
Coverage end / renewal date (ISO YYYY-MM-DD)
Annual premium
object
Amount in currency units
ISO 4217 currency
Insured home
object
Street
Number
Floor, door, staircase… in one line
Postal code
Town
Province
Use of the property
Commercial name of the insurer
Policy PDF. Signed URL valid 24 h; null if not available yet
Example
{ "status": "active", "premium": { "amount": 650, "currency": "EUR" }, "property": { "street": "Calle Ejemplo", "number": "12", "details": "3º B", "postalCode": "28000", "town": "Madrid", "province": "Madrid", "use": "residential" }}object
Policy id
Quote the policy was contracted from
Product id
Policy number
Status
Coverage start (ISO YYYY-MM-DD)
Coverage end / renewal date (ISO YYYY-MM-DD)
Annual premium
object
Amount in currency units
ISO 4217 currency
Insured home
object
Street
Number
Floor, door, staircase… in one line
Postal code
Town
Province
Use of the property
Commercial name of the insurer
Policy PDF. Signed URL valid 24 h; null if not available yet
Example
{ "status": "active", "premium": { "amount": 650, "currency": "EUR" }, "property": { "street": "Calle Ejemplo", "number": "12", "details": "3º B", "postalCode": "28000", "town": "Madrid", "province": "Madrid", "use": "residential" }}Invalid request (validation_error, invalid_cursor, missing_idempotency_key)
object
object
Stable error code. Part of the contract.
Developer-oriented message in English
Correlation id; the same value as the X-Request-Id response header
Only for validation_error: which fields failed
object
Field that failed validation
What is wrong with the field
Example
{ "error": { "code": "validation_error", "message": "Request validation failed", "requestId": "3f6c2a0e-1b7d-4c55-9a52-2f6c1f0d9e11", "details": [ { "field": "monthlyRent", "issue": "must be a positive number" } ] }}Missing, invalid, expired or revoked credential
object
object
Stable error code. Part of the contract.
Developer-oriented message in English
Correlation id; the same value as the X-Request-Id response header
Only for validation_error: which fields failed
object
Field that failed validation
What is wrong with the field
Example
{ "error": { "code": "validation_error", "message": "Request validation failed", "requestId": "3f6c2a0e-1b7d-4c55-9a52-2f6c1f0d9e11", "details": [ { "field": "monthlyRent", "issue": "must be a positive number" } ] }}Missing scope (forbidden_scope) or product not available (product_not_available)
object
object
Stable error code. Part of the contract.
Developer-oriented message in English
Correlation id; the same value as the X-Request-Id response header
Only for validation_error: which fields failed
object
Field that failed validation
What is wrong with the field
Example
{ "error": { "code": "validation_error", "message": "Request validation failed", "requestId": "3f6c2a0e-1b7d-4c55-9a52-2f6c1f0d9e11", "details": [ { "field": "monthlyRent", "issue": "must be a positive number" } ] }}Resource not found (not_found)
object
object
Stable error code. Part of the contract.
Developer-oriented message in English
Correlation id; the same value as the X-Request-Id response header
Only for validation_error: which fields failed
object
Field that failed validation
What is wrong with the field
Example
{ "error": { "code": "validation_error", "message": "Request validation failed", "requestId": "3f6c2a0e-1b7d-4c55-9a52-2f6c1f0d9e11", "details": [ { "field": "monthlyRent", "issue": "must be a positive number" } ] }}Rate limit or daily quota exceeded; see Retry-After
object
object
Stable error code. Part of the contract.
Developer-oriented message in English
Correlation id; the same value as the X-Request-Id response header
Only for validation_error: which fields failed
object
Field that failed validation
What is wrong with the field
Example
{ "error": { "code": "validation_error", "message": "Request validation failed", "requestId": "3f6c2a0e-1b7d-4c55-9a52-2f6c1f0d9e11", "details": [ { "field": "monthlyRent", "issue": "must be a positive number" } ] }}The result could not be confirmed. Check the quote status before retrying.