> ## Documentation Index
> Fetch the complete documentation index at: https://deepline.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Clickhouse Usage Cost Get: Inputs, Cost & CLI Example

> Get organization usage costs. Includes inputs, outputs, pricing notes, Deepline CLI examples, and GTM automation guidance.

## Run in Enrichment Spreadsheet

<Info>
  Use this function as a column step in `deepline enrich`.
</Info>

```bash theme={null}
deepline enrich --input leads.csv --output leads.enriched.csv --with 'result=clickhouse_usage_cost_get:{"organizationId":"{{organizationId}}","from_date":"{{from_date}}","to_date":"{{to_date}}"}' --json
```

<Tip>
  Map payload values to spreadsheet columns with `{{column_name}}` placeholders.
</Tip>

## Input Schema

| Name                     | Type     | Required | Default | Description                                                                                                                                             |
| ------------------------ | -------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `payload.organizationId` | `string` | Yes      |         | ID of the requested organization.                                                                                                                       |
| `payload.from_date`      | `string` | Yes      |         | Start date for the report, e.g. 2024-12-19.                                                                                                             |
| `payload.to_date`        | `string` | Yes      |         | End date (inclusive) for the report, e.g. 2024-12-20. This date cannot be more than 30 days after from\_date (for a maximum queried period of 31 days). |
| `payload.filter`         | `array`  | No       |         | Filter criteria to apply when retrieving the usage cost report. Currently, only filtering by resource tags is supported.                                |

<details>
  <summary>Show raw input schema</summary>

  ### Input JSON Schema

  ```json theme={null}
  {
    "type": "object",
    "description": "Returns a grand total and a list of daily, per-entity organization usage cost records for the organization in the queried time period (maximum 31 days). All days in both the request and the response are evaluated based on the UTC timezone.",
    "properties": {
      "organizationId": {
        "type": "string",
        "description": "ID of the requested organization.",
        "format": "uuid"
      },
      "from_date": {
        "type": "string",
        "description": "Start date for the report, e.g. 2024-12-19.",
        "format": "date"
      },
      "to_date": {
        "type": "string",
        "description": "End date (inclusive) for the report, e.g. 2024-12-20. This date cannot be more than 30 days after from_date (for a maximum queried period of 31 days).",
        "format": "date"
      },
      "filter": {
        "type": "array",
        "description": "Filter criteria to apply when retrieving the usage cost report. Currently, only filtering by resource tags is supported.",
        "items": {
          "type": "string"
        }
      }
    },
    "required": [
      "organizationId",
      "from_date",
      "to_date"
    ],
    "additionalProperties": false
  }
  ```
</details>

## Output Schema

| Name          | Type     | Required | Default | Description                                    |
| ------------- | -------- | -------- | ------- | ---------------------------------------------- |
| `result.data` | `object` | Yes      |         | Provider response payload.                     |
| `result.meta` | `object` | No       |         | Additional response metadata (status, paging). |

<details>
  <summary>Show raw output schema</summary>

  ### Output JSON Schema

  ```json theme={null}
  {
    "type": "object",
    "description": "Standard tool result payload.",
    "properties": {
      "data": {
        "type": "object",
        "description": "Provider response payload.",
        "properties": {
          "status": {
            "type": "number",
            "description": "HTTP status code."
          },
          "requestId": {
            "type": "string",
            "description": "Unique id assigned to every request. UUIDv4",
            "format": "uuid"
          },
          "result": {
            "properties": {
              "grandTotalCHC": {
                "type": "number",
                "description": "Grand total cost of usage in ClickHouse Credits (CHCs)."
              },
              "costs": {
                "type": "array",
                "description": "List of daily, per-entity usage cost records.",
                "items": {
                  "properties": {
                    "dataWarehouseId": {
                      "type": "string",
                      "description": "ID of the dataWarehouse this entity belongs to (or is).",
                      "format": "uuid"
                    },
                    "serviceId": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "ID of the service this entity belongs to (or is). Set to null for dataWarehouse entities.",
                      "format": "uuid"
                    },
                    "date": {
                      "type": "string",
                      "description": "Date of the usage. ISO-8601 date, based on the UTC timezone.",
                      "format": "date"
                    },
                    "entityType": {
                      "type": "string",
                      "description": "Type of the entity.",
                      "enum": [
                        "datawarehouse",
                        "service",
                        "clickpipe"
                      ]
                    },
                    "entityId": {
                      "type": "string",
                      "description": "Unique ID of the entity.",
                      "format": "uuid"
                    },
                    "entityName": {
                      "type": "string",
                      "description": "Name of the entity."
                    },
                    "metrics": {
                      "properties": {
                        "storageCHC": {
                          "type": "number",
                          "description": "Cost of storage in ClickHouse Credits (CHCs). Applies to dataWarehouse entities."
                        },
                        "backupCHC": {
                          "type": "number",
                          "description": "Cost of backup in ClickHouse Credits (CHCs). Applies to dataWarehouse entities."
                        },
                        "computeCHC": {
                          "type": "number",
                          "description": "Cost of compute in ClickHouse Credits (CHCs). Applies to service and clickpipe entities."
                        },
                        "dataTransferCHC": {
                          "type": "number",
                          "description": "Cost of data transfer in ClickHouse Credits (CHCs). Applies to clickpipe entities."
                        },
                        "initialLoadCHC": {
                          "type": "number",
                          "description": "Cost of initial load and resyncs in ClickHouse Credits (CHCs). Applies to clickpipe entities."
                        },
                        "publicDataTransferCHC": {
                          "type": "number",
                          "description": "Cost of data transfer in ClickHouse Credits (CHCs). Applies to service entities."
                        },
                        "interRegionTier1DataTransferCHC": {
                          "type": "number",
                          "description": "Cost of tier1 inter-region data transfer in ClickHouse Credits (CHCs). Applies to service entities."
                        },
                        "interRegionTier2DataTransferCHC": {
                          "type": "number",
                          "description": "Cost of tier2 inter-region data transfer in ClickHouse Credits (CHCs). Applies to service entities."
                        },
                        "interRegionTier3DataTransferCHC": {
                          "type": "number",
                          "description": "Cost of tier3 inter-region data transfer in ClickHouse Credits (CHCs). Applies to service entities."
                        },
                        "interRegionTier4DataTransferCHC": {
                          "type": "number",
                          "description": "Cost of tier4 inter-region data transfer in ClickHouse Credits (CHCs). Applies to service entities."
                        }
                      },
                      "additionalProperties": false
                    },
                    "totalCHC": {
                      "type": "number",
                      "description": "Total cost of usage in ClickHouse Credits (CHCs) for this entity."
                    },
                    "locked": {
                      "type": "boolean",
                      "description": "When true, the record is immutable. Unlocked records are subject to change until locked."
                    }
                  },
                  "additionalProperties": false
                }
              }
            },
            "additionalProperties": false
          }
        },
        "additionalProperties": false
      },
      "meta": {
        "type": "object",
        "description": "Additional response metadata (status, paging).",
        "additionalProperties": true
      }
    },
    "required": [
      "data"
    ],
    "additionalProperties": false
  }
  ```
</details>

## Advanced: Direct CLI

<Info>
  Use direct execution for single payload debugging.
</Info>

```bash theme={null}
deepline tools execute clickhouse_usage_cost_get --payload '{
  "organizationId": "string",
  "from_date": "string",
  "to_date": "string"
}' --json
```

### CLI flags

| Flag                        | Description                                         |
| --------------------------- | --------------------------------------------------- |
| `--json`                    | Print machine-readable output.                      |
| `--wait`                    | Wait for terminal provider status when supported.   |
| `--debug`                   | Enable wait mode with additional status/log output. |
| `--wait-timeout SECONDS`    | Max seconds to wait in wait mode.                   |
| `--poll-interval SECONDS`   | Polling interval in seconds during wait mode.       |
| `--timeout SECONDS`         | Request timeout in seconds.                         |
| `--connect-timeout SECONDS` | Connection timeout in seconds.                      |

## Cost

* Pricing model: `fixed` (per call).
* Estimated Deepline credits: `0` per pricing unit.
* Provider-native pricing may still exist outside Deepline credit billing.
* Billing mode: `no_bill`.
