# Response reference

> The shape the Towers API returns and the React package draws.

You can pass the response to `<Towers />` without reading it. This page is for when you want to build a table beside the chart, or to draw towers yourself.

For the v1 field changes, see [Migrating from v1](https://towers.vinsa.dev/docs/api/request.md#migrating-from-v1).

The package exports these shapes as TypeScript types: `TowersResponse`, `RiskTowers`, `Tower`, `HorizontalBand`, `VerticalBlock` and `Issue`.

## Structure

```
response
├─ warnings[]              Issues to consider
├─ limitations[]           Issues describing what the Engine cannot derive
├─ unlimitedDisplayHeight  height hint for unlimited towers
└─ risks[]                 one per risk you sent, in the same order
   └─ towers[]             one or more per risk
      ├─ bands[]           horizontal slices, bottom to top
      │  └─ verticalBlocks[]   the pieces of layers in that slice
      └─ unlimitedBands[]  layers with no upper limit
```

A layer that spans several bands appears as one block in each. The React package joins them back into a single rectangle.

## Risk

| Field | Type | |
| --- | --- | --- |
| `riskId` | string | As you sent it. |
| `policyRef` | string or null | |
| `insuredName` | string or null | |
| `towers` | array | The [towers](#tower) for this risk. |

## Tower

| Field | Type | |
| --- | --- | --- |
| `towerNo` | number | Position within the risk, from 1. |
| `towerName` | string | `Tower` for the main one; excess towers are named for their basis, such as `XOL Treaty - Per Event`. |
| `bands` | array | [Bands](#band) with a top, ordered bottom to top. |
| `unlimitedBands` | array | Bands for layers with no upper limit. Their `hyTo` is `null`. |

## Band

| Field | Type | |
| --- | --- | --- |
| `hBandNo` | number | Position in the stack, from 1 at the bottom. |
| `hyFrom` | number | Lower amount. |
| `hyTo` | number or null | Upper amount. `null` when unlimited. |
| `bandRange` | string | The range as text, such as `$2.5M – $5M`. |
| `isUnlimited` | boolean | |
| `verticalBlocks` | array | The [blocks](#block) in this band, left to right. |

## Block

A piece of a Layer or the cedant’s retention within one band.

### Position

| Field | Type | |
| --- | --- | --- |
| `xSpan` | `[number, number]` | Left and right edges as fractions of the tower's width, 0 to 1. |
| `ySpan` | `[number, number]` | Position within the band, normally `[0, 1]`. |
| `isPrimary` | boolean | `false` for a block hidden behind another in the same slot. Draw only primary blocks. |
| `overlapId` | string or null | Shared by blocks that occupy the same slot. |
| `vBlockNo` | number | Position within the band, from 0. |

### What it is

| Field | Type | |
| --- | --- | --- |
| `blockKind` | string (optional) | Reinsurer viewpoint only. Every block is `line`, `otherReinsurers` or `cedant`. |
| `isRetention` | boolean | `true` for the part the cedant keeps. These blocks are added by the API. |
| `layerName`, `layerRef`, `layerType` | string or null | From the Layer. Retention fillers use the name Retention and null ref and type. |
| `contractRef` | string or null | Owning Contract. Null for retention fillers. |
| `sharedRiskCount` | number | Risks listing the Contract; 0 for retention fillers. |
| `reinsurer` | string or null | Set when the block is one reinsurer's line of a layer. |
| `lineStatus` | string or null | That line's status. |
| `label` | string | Suggested text for the block. |

### Amounts and shares

| Field | Type | |
| --- | --- | --- |
| `lowerLimit`, `layerAmount` | number | The Layer's own attachment and amount, not the band's. |
| `upperLimit` | number or null | Null when unlimited. |
| `share` | number | The drawn share of whole: signed, else written. |
| `normalizedShare` | number | The share used to work out the block's width. |
| `cededShare` | number | The share of the layer that reaches reinsurers. |
| `participationShare`, `retainedShare` | number or null | From the Layer. |
| `order` | number or null | The Layer’s Order. Includes the whole-viewpoint default. Null for retention fillers or when missing in the reinsurer viewpoint. |
| `currency` | string or null | Effective Layer currency (override, else Contract currency). Null for retention fillers. |
| `accumulateBasis`, `protection` | string or null | From the Layer. |
| `aad` | number or null | Annual aggregate deductible from the Layer. |

### Colour

| Field | Type | |
| --- | --- | --- |
| `colorKey` | string | Blocks that should share a colour share this key. Each Contract supplies the key for its Layers. Cedant blocks and retention fillers use `retention`. |
| `colorOverride` | string or null | The colour you asked for with `display.colorOverride`. |
| `color` | string | A colour chosen by the API. The React package ignores it and assigns its own fills by `colorKey`. |

## Top level

| Field | Type | |
| --- | --- | --- |
| `risks` | array | |
| `unlimitedDisplayHeight` | number | A height hint for drawing towers that have only unlimited layers. The React package does not need it. |
| `warnings` | Issue[] | Warnings; an empty array when none. |
| `limitations` | Issue[] | Facts the Engine cannot derive; an empty array when none. |

## Issue

| Field | Type | Meaning |
| --- | --- | --- |
| `code` | string | Machine-readable identifier. |
| `message` | string | Explanation. |
| `path` | string (optional) | Path in the request, e.g. `program.contracts[1].layers[0]`. |

Recovery warning codes include `currency-mismatch`, `losses-out-of-order`, `recovery-exceeds-loss`, `sum-insured-missing`, `proportional-term-ignored`, `loss-outside-period`, `reinstatement-period-missing` and `reinstatement-premium-missing`. See the [Recovery warnings and limitations](https://towers.vinsa.dev/docs/api/recoveries.md#warnings-and-limitations) for when each code applies.

Opening position warnings are `opening-position-unknown-layer`, `opening-position-proportional`, `opening-position-aad-exceeded`, `opening-position-limit-exceeded`, `opening-position-uncapped` and `opening-position-inconsistent`. Recovery limitations include `opening-position-agr-running-total`, `split-by-line-no-lines`, `viewpoint-cedant-totals-unavailable` and `signing-unavailable`.

Comparison warnings are `comparison-pair-unknown-candidate`, `comparison-pair-ambiguous-layer`, `comparison-pair-unknown-layer`, `comparison-pair-duplicate`, `comparison-currency-differs` and `comparison-loss-risk-missing`. Comparisons use the reinsurer Layer warnings below and forward recovery warnings and limitations during Loss replay. See the [Comparison warnings and limitations](https://towers.vinsa.dev/docs/api/comparisons.md#warnings-and-limitations).

## Drawing warnings

| Code | Meaning |
| --- | --- |
| `to-stand-over-order` | Firm To stand Lines exceed 100% of the Order; computed Signed shares are unavailable. The code and Layer request path match `/placements`. |
| `signed-share-overflow` | Supplied firm Signed shares exceed 100% of Order by more than `10^-4`. The Layer draws as one unsplit block at Order width, with `reinsurer` and `lineStatus` null. |
| `written-share-overflow` | No Signed shares are available and firm Written shares exceed Order. The Layer draws as one unsplit block at Order width, with `reinsurer` and `lineStatus` null. |

Signing warnings, including `signed-share-ignored`, `signed-share-above-written` (Signed exceeds Written), `to-stand-share-moved` (supplied Signed differs from To stand Written), `signed-total-mismatch` (supplied firm total differs from min(firm Written total, 100) by more than `10^-decimals`, with expected and actual totals), and `zero-order`, are also reported when applicable, with the same request paths as `/placements`. A shared Contract's warnings appear once per source Layer, rather than once per Risk.

## Reinsurer viewpoint

`/placements` includes `ourShareOfWhole` on each Layer as a number or null. Contract and Program `amountPlaced` are `Money[]` or null, and `layerCountByStatus` is `StatusCounts` or null. Both totals are null in the reinsurer viewpoint, covered by the single `viewpoint-layer-facts-unavailable` limitation.

`/recoveries` and comparison Loss replay return Our share Estimates by effective Layer currency in the reinsurer viewpoint. One `viewpoint-cedant-totals-unavailable` limitation at `viewpoint` covers the null cedant totals.

`/recoveries` also reports reinstatement premium Estimates at 100% and at the viewpoint’s share. See the [Recovery response fields](https://towers.vinsa.dev/docs/api/recoveries.md#response) for the Layer year and cumulative Loss position fields.

Both operations can return `viewpoint-other-line`, `viewpoint-order-missing` and `viewpoint-line-exceeds-order`. See [Viewpoints](https://towers.vinsa.dev/docs/api/viewpoints.md) for the share calculation, field availability and issue paths.
