# Generating Estimate Links

Here’s a cleaner and more structured version of the steps you provided for interacting with the Cognito Identity Pool and making an API request:

***

#### **Environment Configuration**

| **Environment** | **Identity Pool ID**                             |
| --------------- | ------------------------------------------------ |
| **Production**  | `us-east-1:50d520ef-0cd0-45c6-8798-33e0163fcde7` |
| **Sandbox**     | `us-east-1:16a18d1f-dab5-4b76-a836-3ed99a37afd9` |

***

#### **Steps to Authenticate and Make a Request**

**Step 1: Get an Unauthenticated Identity ID**

Use the `aws cognito-identity get-id` command to retrieve an unauthenticated identity ID from the identity pool.

**Command:**

```bash
bashCopy codeaws cognito-identity get-id --identity-pool-id us-east-1:16a18d1f-dab5-4b76-a836-3ed99a37afd9
```

**Step 2: Exchange Identity ID for an OpenID Token**

Use the `aws cognito-identity get-open-id-token` command to exchange the identity ID for an OpenID token.

**Command:**

```bash
bashCopy codeaws cognito-identity get-open-id-token --identity-id "us-east-1:45d3ecbe-5ec1-c35d-9818-5a1707fa1158"
```

The response will include a `Token` value. This token is valid for approximately **10 minutes**.

**Step 3: Use the OpenID Token to Make an API Request**

Include the `Token` value as the `Authorization` header in your API request.

**Command:**

```bash
bashCopy codecurl --location 'https://api.sandbox.authenticinsurance.com/estimate' \
--header 'Authorization: ${TOKEN}' \
--header 'Content-Type: application/json' \
--data '{
    "product": ["GENERAL_LIABILITY"],
    "revenue": 1000000,
    "state": "OH",
    "class_description": "Office Cleaning Service"
}'
```

***

#### **Key Notes**

* The **OpenID token** is valid for \~10 minutes. Ensure to refresh it as needed.
* Replace the `Identity Pool ID` and API endpoint according to your environment:
  * Sandbox: `us-east-1:16a18d1f-dab5-4b76-a836-3ed99a37afd9`
  * Production: `us-east-1:50d520ef-0cd0-45c6-8798-33e0163fcde7`
