Ir al contenido

Contract a modality

POST
/v1/community/quotes/{id}/contract
curl --request POST \
--url https://integrador.avalisto.com/v1/community/quotes/example/contract \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'idempotency-key: example' \
--data '{ "modalityCode": "example" }'

Requires an Idempotency-Key. Requests the policy for the chosen modality; it is never contracted twice. If you get 503, read the quote before retrying.

id
required
string

Quote id

idempotency-key
required
string

UUID v4. Repeating the key returns the first result without repeating the operation.

Media typeapplication/json
object
modalityCode
required

Code of a modality returned by POST /v1/community/quotes/{id}/price

string

Example generated

{
"modalityCode": "example"
}
Media typeapplication/json
object
id
required

Id

string
productId
required

Product id

string
nullable
status
required

Status

string
Allowed values: analysis_failed analyzed validated priced pending_authorization contract_requested policy_issued community_created discarded
fileName
required

File name

string
policyholderName
required

Policyholder name

string
nullable
annualPremium
required

Total premium of the period

number
nullable
policyNumber
required

Policy number

string
nullable
createdAt
required

ISO 8601, UTC

string
updatedAt
required

ISO 8601, UTC

string
policyholder
required

Policyholder

object
name
required

Name

string
nullable
documentNumber
required

Document number

string
modalities
required

Modalities

Array<object>
object
code
required

Code

string
name
required

Name

string
paymentFrequency
required

Payment frequency code

string
nullable
annualPremium
required

Total premium of the period (taxes included)

number
nullable
contractable
required

Contractable

boolean
selectedModality
required

Selected modality

object
code
required

Code

string
name
required

Name

string
annualPremium
required

Annual premium

number
nullable
policyEffectiveDate
required

Yyyy-MM-dd

string
nullable
communityId
required

Community id

string
nullable

Example

{
"status": "analysis_failed"
}

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"
}
]
}
}