Ir al contenido

Issue the policy of an approved operation

POST
/v1/rental/policies
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.

idempotency-key
required
string

UUID v4

Media typeapplication/json
object
operationId
required

Operation id returned by POST /v1/rental/quotes

string
startDate
required

Coverage start, ISO YYYY-MM-DD

string

Example

2027-01-01
leaseStartDate

Lease start, ISO. Defaults to startDate

string
leaseEndDate

Lease end, ISO

string
leaseReference

Lease reference. Defaults to the quote externalReference; one of both is required

string

Example

LEASE-0001
landlordId

Landlord company id (GET /v1/account/landlords). Required if product.requirements.landlord is “required”

string
landlord

Landlord details. Required if product.requirements.landlordDetails is true

object
firstName
required

First name, or company name

string

Example

Luis
lastName

Last name (people only)

string

Example

Ejemplo
documentType
required

Identity document type

string
Allowed values: dni nie nif cif pas

Example

dni
documentNumber
required

Identity document number

string

Example

00000000T
email
required

Email address

string

Example

luis@example.com
phone
required

Phone number

string

Example

600000000
birthDate

ISO date YYYY-MM-DD. Required unless documentType is cif

string

Example

1970-01-31
address
required

Landlord address

object
street
required

Street name

string

Example

Calle Ejemplo
number
required

Street number

string
nullable

Example

12
details
required

Floor, door, staircase… in one line

string
nullable

Example

3º B
postalCode
required

Postal code (5 digits)

string

Example

28000
town
required

Town

string

Example

Madrid
province
required

Province

string

Example

Madrid
paymentIban

IBAN for the premium payment. Required if product.requirements.paymentAccount is true

string

Example

ES0000000000000000000000

Already issued

Media typeapplication/json
object
id
required

Identifier

string
operationId
required

Operation id

string
productId
required

Product id

string
nullable
number
required

Number

string
status
required

Status

string
Allowed values: active cancelled expired
startDate
required

Coverage start (ISO YYYY-MM-DD)

string
endDate
required

Coverage end (ISO YYYY-MM-DD)

string
premium
required

Total premium

object
amount
required

Amount in currency units

number
currency
required

ISO 4217 currency

string
Allowed values: EUR
property
required

Property

object
street
required

Street

string
number
required

Number

string
nullable
details
required

Floor, door, staircase… in one line

string
nullable
postalCode
required

Postal code

string
town
required

Town

string
province
required

Province

string
use
required

Use of the property

string
Allowed values: residential commercial
insurerName
required

Commercial name of the insurer as shown in the policy

string
nullable
documentUrl
required

Policy PDF. Signed URL valid 24 h

string
nullable
claimsCount
required

Number of claims on the policy

number
cancelledAt
required

Cancellation date (ISO); null if not cancelled

string
nullable

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
}
Media typeapplication/json
object
id
required

Identifier

string
operationId
required

Operation id

string
productId
required

Product id

string
nullable
number
required

Number

string
status
required

Status

string
Allowed values: active cancelled expired
startDate
required

Coverage start (ISO YYYY-MM-DD)

string
endDate
required

Coverage end (ISO YYYY-MM-DD)

string
premium
required

Total premium

object
amount
required

Amount in currency units

number
currency
required

ISO 4217 currency

string
Allowed values: EUR
property
required

Property

object
street
required

Street

string
number
required

Number

string
nullable
details
required

Floor, door, staircase… in one line

string
nullable
postalCode
required

Postal code

string
town
required

Town

string
province
required

Province

string
use
required

Use of the property

string
Allowed values: residential commercial
insurerName
required

Commercial name of the insurer as shown in the policy

string
nullable
documentUrl
required

Policy PDF. Signed URL valid 24 h

string
nullable
claimsCount
required

Number of claims on the policy

number
cancelledAt
required

Cancellation date (ISO); null if not cancelled

string
nullable

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)

Media typeapplication/json
object
error
required
object
code
required

Stable error code. Part of the contract.

string
message
required

Developer-oriented message in English

string
requestId
required

Correlation id; the same value as the X-Request-Id response header

string
details

Only for validation_error: which fields failed

Array<object>
object
field
required

Field that failed validation

string
issue
required

What is wrong with the field

string

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

Media typeapplication/json
object
error
required
object
code
required

Stable error code. Part of the contract.

string
message
required

Developer-oriented message in English

string
requestId
required

Correlation id; the same value as the X-Request-Id response header

string
details

Only for validation_error: which fields failed

Array<object>
object
field
required

Field that failed validation

string
issue
required

What is wrong with the field

string

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)

Media typeapplication/json
object
error
required
object
code
required

Stable error code. Part of the contract.

string
message
required

Developer-oriented message in English

string
requestId
required

Correlation id; the same value as the X-Request-Id response header

string
details

Only for validation_error: which fields failed

Array<object>
object
field
required

Field that failed validation

string
issue
required

What is wrong with the field

string

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)

Media typeapplication/json
object
error
required
object
code
required

Stable error code. Part of the contract.

string
message
required

Developer-oriented message in English

string
requestId
required

Correlation id; the same value as the X-Request-Id response header

string
details

Only for validation_error: which fields failed

Array<object>
object
field
required

Field that failed validation

string
issue
required

What is wrong with the field

string

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

Media typeapplication/json
object
error
required
object
code
required

Stable error code. Part of the contract.

string
message
required

Developer-oriented message in English

string
requestId
required

Correlation id; the same value as the X-Request-Id response header

string
details

Only for validation_error: which fields failed

Array<object>
object
field
required

Field that failed validation

string
issue
required

What is wrong with the field

string

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.