curl --request POST \
--url https://go.aiinsurance.io/api/v1/companies/{companyId}/entities/batch \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"entities": [
{
"ref": "insured",
"entityType": "exposure",
"entityData": {
"exposureName": "Acme Corp HQ",
"exposureType": "company"
}
},
{
"ref": "submission",
"entityType": "submission",
"entityData": {
"submissionType": "newBusiness"
}
},
{
"ref": "quote",
"entityType": "quote",
"entityData": {
"quoteType": "newBusiness",
"referencingSubmission": "ref:submission",
"exposures": [
{
"id": "ref:insured",
"policyRelationshipType": "primary"
}
]
},
"entityCreateOptions": {
"autoAddForms": false
}
}
],
"batchCreateOptions": {
"idempotencyKey": "7f3c9a2e-4b1d-4c8e-9f6a-2d5b8e1c0a47"
}
}
'{
"dryRun": true,
"entities": [
{
"ref": "insured",
"entityType": "exposure"
}
]
}Create Entity Batch
Creates a linked set of new records in one request: exposures, submissions, and new-business or renewal quotes. Every record is saved, or none is: a refused record leaves nothing behind.
Each entry names itself with ref: 1 to 64 letters, digits, - or _,
unique in the batch. A later entry links to it by writing
"ref:<name>" where a record id goes: in a relationship field, such as a
quote’s referencingSubmission, or as the id of an embedded exposure.
Entries save in the order they are listed, so a link must name an earlier
entry of the type the field holds, in a field the caller can write;
anything else returns 400 INVALID_BATCH_REFERENCE before anything is
saved. Text in any other field that starts with ref: stays text. The
response gives each entry’s new id, in request order.
Each entry is saved as Create Entity
saves one record, with the same checks and refusals. A refused entry
answers with the error that create would return, plus entity, which
names the entry’s index, ref and entityType, and nothing is saved.
Idempotency. A save needs batchCreateOptions.idempotencyKey, a
UUID. Sending the same body again with the same key returns 201 with
the same ids and created: false, and saves nothing. The same key with a
different body, or for a batch whose records have since been deleted,
returns 409 IDEMPOTENCY_KEY_REUSED.
Dry run. ?dryRun=true runs every check a save runs and saves
nothing. It returns 200 with each entry’s ref and entityType when
the save would succeed, or the error the save would return. A dry run
takes no idempotency key.
Entries. An entry takes entityData as Create Entity does and, for a
quote, entityCreateOptions.autoAddForms. The batch has one key, so an
entry takes no idempotencyKey or idempotencyOwner of its own, and no
pricingSetup: set a quote’s pricing setup once the batch is saved. A
batch creates no endorsement, cancellation or reinstatement quotes, which
change an existing policy. A batch holds up to 2,100 entries.
Work that follows a save, such as a quote’s recommended forms and automatic OFAC screening, starts once the whole batch is saved. A refused batch or a dry run starts none.
See Batch create.
Required permission: the create permission of every entity type in
the batch: exposure.create, submission.create and quote.create for
a batch that holds all three.
curl --request POST \
--url https://go.aiinsurance.io/api/v1/companies/{companyId}/entities/batch \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"entities": [
{
"ref": "insured",
"entityType": "exposure",
"entityData": {
"exposureName": "Acme Corp HQ",
"exposureType": "company"
}
},
{
"ref": "submission",
"entityType": "submission",
"entityData": {
"submissionType": "newBusiness"
}
},
{
"ref": "quote",
"entityType": "quote",
"entityData": {
"quoteType": "newBusiness",
"referencingSubmission": "ref:submission",
"exposures": [
{
"id": "ref:insured",
"policyRelationshipType": "primary"
}
]
},
"entityCreateOptions": {
"autoAddForms": false
}
}
],
"batchCreateOptions": {
"idempotencyKey": "7f3c9a2e-4b1d-4c8e-9f6a-2d5b8e1c0a47"
}
}
'{
"dryRun": true,
"entities": [
{
"ref": "insured",
"entityType": "exposure"
}
]
}