Issue the policy of an approved operation
const url = 'https://integrador.avalisto.com/v1/rental/policies';const options = { method: 'POST', headers: { 'idempotency-key': 'example', Authorization: 'Bearer <token>', 'Content-Type': 'application/json' }, body: '{"operationId":"example","startDate":"2027-01-01","leaseStartDate":"example","leaseEndDate":"example","leaseReference":"LEASE-0001","landlordId":"example","landlord":{"firstName":"Luis","lastName":"Ejemplo","documentType":"dni","documentNumber":"00000000T","email":"luis@example.com","phone":"600000000","birthDate":"1970-01-31","address":{"street":"Calle Ejemplo","number":"12","details":"3º B","postalCode":"28000","town":"Madrid","province":"Madrid"}},"paymentIban":"ES0000000000000000000000"}'};
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/rental/policies \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --header 'idempotency-key: example' \ --data '{ "operationId": "example", "startDate": "2027-01-01", "leaseStartDate": "example", "leaseEndDate": "example", "leaseReference": "LEASE-0001", "landlordId": "example", "landlord": { "firstName": "Luis", "lastName": "Ejemplo", "documentType": "dni", "documentNumber": "00000000T", "email": "luis@example.com", "phone": "600000000", "birthDate": "1970-01-31", "address": { "street": "Calle Ejemplo", "number": "12", "details": "3º B", "postalCode": "28000", "town": "Madrid", "province": "Madrid" } }, "paymentIban": "ES0000000000000000000000" }'Requires an Idempotency-Key. Retrying with the same key returns the same response; an operation is never issued twice: if it is already issued you get 200 with the existing policy. If you get 503, check GET /v1/rental/operations/{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
Operation id returned by POST /v1/rental/quotes
Coverage start, ISO YYYY-MM-DD
Example
2027-01-01Lease start, ISO. Defaults to startDate
Lease end, ISO
Lease reference. Defaults to the quote externalReference; one of both is required
Example
LEASE-0001Landlord company id (GET /v1/account/landlords). Required if product.requirements.landlord is “required”
Landlord details. Required if product.requirements.landlordDetails is true
object
First name, or company name
Example
LuisLast name (people only)
Example
EjemploIdentity document type
Example
dniIdentity document number
Example
00000000TEmail address
Example
luis@example.comPhone number
Example
600000000ISO date YYYY-MM-DD. Required unless documentType is cif
Example
1970-01-31Landlord address
object
Street name
Example
Calle EjemploStreet number
Example
12Floor, door, staircase… in one line
Example
3º BPostal code (5 digits)
Example
28000Town
Example
MadridProvince
Example
MadridIBAN for the premium payment. Required if product.requirements.paymentAccount is true
Example
ES0000000000000000000000Responses
Sección titulada «Responses»Already issued
object
Identifier
Operation id
Product id
Number
Status
Coverage start (ISO YYYY-MM-DD)
Coverage end (ISO YYYY-MM-DD)
Total premium
object
Amount in currency units
ISO 4217 currency
Property
object
Street
Number
Floor, door, staircase… in one line
Postal code
Town
Province
Use of the property
Commercial name of the insurer as shown in the policy
Policy PDF. Signed URL valid 24 h
Number of claims on the policy
Cancellation date (ISO); null if not cancelled
Example
{ "status": "active", "startDate": "2027-01-01", "endDate": "2027-12-31", "premium": { "amount": 650, "currency": "EUR" }, "property": { "street": "Calle Ejemplo", "number": "12", "details": "3º B", "postalCode": "28000", "town": "Madrid", "province": "Madrid", "use": "residential" }, "claimsCount": 0, "cancelledAt": null}object
Identifier
Operation id
Product id
Number
Status
Coverage start (ISO YYYY-MM-DD)
Coverage end (ISO YYYY-MM-DD)
Total premium
object
Amount in currency units
ISO 4217 currency
Property
object
Street
Number
Floor, door, staircase… in one line
Postal code
Town
Province
Use of the property
Commercial name of the insurer as shown in the policy
Policy PDF. Signed URL valid 24 h
Number of claims on the policy
Cancellation date (ISO); null if not cancelled
Example
{ "status": "active", "startDate": "2027-01-01", "endDate": "2027-12-31", "premium": { "amount": 650, "currency": "EUR" }, "property": { "street": "Calle Ejemplo", "number": "12", "details": "3º B", "postalCode": "28000", "town": "Madrid", "province": "Madrid", "use": "residential" }, "claimsCount": 0, "cancelledAt": null}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 of the issuance could not be confirmed. Check the operation status before retrying; do not retry blindly.