# Quickstart

> From an API key to a tower on screen.

By the end of this page you will have this on screen, drawn from your own request:

1. **Get a key**

   Keys are issued on request. Follow [Get an API key](https://towers.vinsa.dev/docs/start/api-key.md), then keep the key in an environment variable on your server:

   ```sh
   export TOWERS_API_URL="https://towers-api.vinsa.dev"
   export TOWERS_API_KEY="twr_..."
   ```

2. **Describe a program**

   Save this as `program.json`. It is one risk with a quota share and two excess layers; the second carries its reinsurer panel.

   ```json title="program.json"
   {
     "program": {
       "contracts": [
         {
           "contractRef": "QS-1",
           "currency": "USD",
           "layers": [
             {
               "layerName": "Quota share",
               "layerRef": "QS-1",
               "layerType": "QSR",
               "lowerLimit": 0,
               "isUnlimited": true,
               "participationShare": 100,
               "retainedShare": 20
             }
           ]
         },
         {
           "contractRef": "XL-1",
           "currency": "USD",
           "layers": [
             {
               "layerName": "First excess",
               "layerRef": "XL-1",
               "layerType": "XOL",
               "accumulateBasis": "CLM",
               "lowerLimit": 2500000,
               "upperLimit": 5000000,
               "isUnlimited": false,
               "order": 100
             }
           ]
         },
         {
           "contractRef": "XL-2",
           "currency": "USD",
           "layers": [
             {
               "layerName": "Second excess",
               "layerRef": "XL-2",
               "layerType": "XOL",
               "accumulateBasis": "CLM",
               "lowerLimit": 5000000,
               "upperLimit": 10000000,
               "isUnlimited": false,
               "order": 100,
               "lineBasis": "of whole",
               "lines": [
                 {
                   "reinsurer": "Alder Re",
                   "writtenShare": 50,
                   "status": "signed"
                 },
                 {
                   "reinsurer": "Birch Syndicate",
                   "writtenShare": 30,
                   "status": "firm order"
                 },
                 {
                   "reinsurer": "Cedar Mutual",
                   "writtenShare": 20,
                   "status": "quoted"
                 }
               ]
             }
           ]
         }
       ],
       "risks": [
         {
           "riskId": "R-1001",
           "insuredName": "Harbour Logistics",
           "contractRefs": [
             "QS-1",
             "XL-1",
             "XL-2"
           ]
         }
       ]
     }
   }
   ```

3. **Call the API**

   ```sh
   curl "$TOWERS_API_URL/api/v1/towers" \
     -H "Authorization: Bearer $TOWERS_API_KEY" \
     -H "Content-Type: application/json" \
     -d @program.json
   ```

   You get back one tower with three bands. Shortened here:

   ```json
   {
     "warnings": [],
     "limitations": [],
     "unlimitedDisplayHeight": 1000000,
     "risks": [
       {
         "riskId": "R-1001",
         "insuredName": "Harbour Logistics",
         "towers": [
           {
             "towerNo": 1,
             "towerName": "Tower",
             "bands": [
               { "hyFrom": 0, "hyTo": 2500000, "verticalBlocks": [ ... ] },
               { "hyFrom": 2500000, "hyTo": 5000000, "verticalBlocks": [ ... ] },
               { "hyFrom": 5000000, "hyTo": 10000000, "verticalBlocks": [ ... ] }
             ],
             "unlimitedBands": []
           }
         ]
       }
     ]
   }
   ```

4. **Install the package**

   **npm**

   ```sh
   npm install @vinsa/towers
   ```

   **pnpm**

   ```sh
   pnpm add @vinsa/towers
   ```

   **yarn**

   ```sh
   yarn add @vinsa/towers
   ```

5. **Draw it**

   Pass the response to `<Towers />` exactly as it arrived.

   ```tsx
   import { Towers } from '@vinsa/towers';
   import type { TowersResponse } from '@vinsa/towers';
   import '@vinsa/towers/styles.css';

   export function ProgramTowers({ response }: { response: TowersResponse }) {
     return <Towers data={response} />;
   }
   ```

## Next

- Wire the call into your stack: [Next.js](https://towers.vinsa.dev/docs/guides/nextjs.md) or [an existing portal](https://towers.vinsa.dev/docs/guides/existing-portal.md).
- Send your real data: [Request reference](https://towers.vinsa.dev/docs/api/request.md).
- Make it match your product: [Theming](https://towers.vinsa.dev/docs/react/theming.md).
