# Estimate

{% hint style="warning" %}
API Key is required for all **Estimate** endpoints.
{% endhint %}

## Create a new Estimate event.

<mark style="color:green;">`POST`</mark> `https://api.carbonlink.io/v1/estimates`

#### Request Body

| Name        | Type   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| ----------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| kgCO2e      | number | <p>Weight of carbon emissions to remove from circulation, in kilograms.</p><p></p><p>Note: If both <code>kgCO2e</code> and <code>products</code> parameters are provided, the total combined emissions will be added to this estimate.</p>                                                                                                                                                                                                                                                                                                                                                       |
| products    | object | <p>This attribute computes the unit emission rate for this set of <strong>Products</strong>.</p><p></p><p>Key-value pairs where the key of each pair represents the ID of the <strong>Product</strong> to add to this estimate with a value corresponding to the quantity (# of units) of the <strong>Product</strong> to apply to this estimate.</p><p></p><p>Example:</p><p><code>{ "prod\_123": 1, "prod\_456": 3 }</code></p><p></p><p>Note: If both <code>kgCO2e</code> and <code>products</code> parameters are provided, the total combined emissions will be added to this estimate.</p> |
| customerRef | string | Internal reference to customer. (i.e. email address or another user identifier)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |

{% tabs %}
{% tab title="200: OK Your estimate is now being processing." %}

```json
{
    estimateId: "YOUR-ESTIMATE-ID"
}
```

{% endtab %}
{% endtabs %}

## Retrieve an existing Estimate event.

<mark style="color:blue;">`GET`</mark> `https://api.carbonlink.io/v1/estimates`

Use query parameters to search for an Estimate event by the event ID.

#### Query Parameters

| Name                                 | Type   | Description |
| ------------------------------------ | ------ | ----------- |
| id<mark style="color:red;">\*</mark> | string | Event ID    |

{% tabs %}
{% tab title="200: OK Estimate event" %}

```json
{
  id: "est_12345678",
  kgCO2e: 123.45,
  price: 230.91,
  default_asset: "asset_123456...",
  breakdown: {
    "co2": 0.12,
    "ch4": 0.48,
    "sf6": 0.40
  },
  products: {
    "prod_123...": {
        id: "prod_123...",
        ...
    },
    "prod_456...": {
        id: "prod_456...",
        ...
    }
  },
  shipping_details: {
    distance: {
      unit: "mile",
      value: 12.12
    },
    route: "land",
    weight: {
      unit: "kg",
      value: 100
    },
  },
  active: true,
}
```

{% endtab %}
{% endtabs %}

## List all Estimate events.

<mark style="color:blue;">`GET`</mark> `https://api.carbonlink.io/v1/estimates`

{% tabs %}
{% tab title="200: OK List of Estimate events." %}

```json
[
    {
      id: "est_12345678",
      kgCO2e: 123.45,
      price: 230.91,
      default_asset: "asset_123456...",
      breakdown: {...},
      products: {...},
      shipping_details: {...},
      active: true,
    }
    {...}
]
```

{% endtab %}
{% endtabs %}
