# Cost

> **Package : spaceone.api.cost\_analysis.v1**

## Cost

{% hint style="info" %}
**Cost Methods:**
{% endhint %}

| Method                  | Request                                 | Response                                                                                                           |
| ----------------------- | --------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| [**create**](#create)   | [CreateCostRequest](#createcostrequest) | [CostInfo](#costinfo)                                                                                              |
| [**delete**](#delete)   | [CostRequest](#costrequest)             | [google.protobuf.Empty](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/empty.proto)   |
| [**get**](#get)         | [GetCostRequest](#getcostrequest)       | [CostInfo](#costinfo)                                                                                              |
| [**list**](#list)       | [CostQuery](#costquery)                 | [CostsInfo](#costsinfo)                                                                                            |
| [**analyze**](#analyze) | [CostAnalyzeQuery](#costanalyzequery)   | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |
| [**stat**](#stat)       | [CostStatQuery](#coststatquery)         | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |

### create

> **POST** /cost-analysis/v1/costs

| Type     | Message                                 |
| -------- | --------------------------------------- |
| Request  | [CreateCostRequest](#createcostrequest) |
| Response | [CostInfo](#costinfo)                   |

### delete

> **DELETE** /cost-analysis/v1/cost/{cost\_id}

| Type     | Message                                                                                                          |
| -------- | ---------------------------------------------------------------------------------------------------------------- |
| Request  | [CostRequest](#costrequest)                                                                                      |
| Response | [google.protobuf.Empty](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/empty.proto) |

### get

> **GET** /cost-analysis/v1/cost/{cost\_id}

| Type     | Message                           |
| -------- | --------------------------------- |
| Request  | [GetCostRequest](#getcostrequest) |
| Response | [CostInfo](#costinfo)             |

### list

> **GET** /cost-analysis/v1/costs
>
> **POST** /cost-analysis/v1/costs/search

| Type     | Message                 |
| -------- | ----------------------- |
| Request  | [CostQuery](#costquery) |
| Response | [CostsInfo](#costsinfo) |

### analyze

> **POST** /cost-analysis/v1/costs/analyze

| Type     | Message                                                                                                            |
| -------- | ------------------------------------------------------------------------------------------------------------------ |
| Request  | [CostAnalyzeQuery](#costanalyzequery)                                                                              |
| Response | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |

### stat

> **POST** /cost-analysis/v1/costs/stat

| Type     | Message                                                                                                            |
| -------- | ------------------------------------------------------------------------------------------------------------------ |
| Request  | [CostStatQuery](#coststatquery)                                                                                    |
| Response | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |

##

## Message

### CostAnalyzeQuery

| Field                    | Type                                                                                                | Required | Description |
| ------------------------ | --------------------------------------------------------------------------------------------------- | -------- | ----------- |
| granularity              | <ul><li>UNIT\_NONE</li><li>ACCUMULATED</li><li>DAILY</li><li>MONTHLY</li><li>YEARLY</li></ul>       | ✔        |             |
| start                    | string                                                                                              | ✔        |             |
| end                      | string                                                                                              | ✔        |             |
| group\_by                | list of string                                                                                      | ✘        |             |
| filter                   | [google.protobuf.ListValue](https://developers.google.com/protocol-buffers/docs/reference/overview) | ✘        |             |
| limit                    | [int32](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/type.proto)     | ✘        |             |
| page                     | spaceone.api.core.v1.Page                                                                           | ✘        |             |
| sort                     | spaceone.api.core.v1.Sort                                                                           | ✘        |             |
| include\_usage\_quantity | bool                                                                                                | ✘        |             |
| include\_others          | bool                                                                                                | ✘        |             |
| domain\_id               | string                                                                                              | ✔        |             |

### CostInfo

| Field                | Type                                                                                                               | Description |
| -------------------- | ------------------------------------------------------------------------------------------------------------------ | ----------- |
| cost\_id             | string                                                                                                             |             |
| usd\_cost            | float                                                                                                              |             |
| original\_currency   | string                                                                                                             |             |
| original\_cost       | float                                                                                                              |             |
| usage\_quantity      | float                                                                                                              |             |
| provider             | string                                                                                                             |             |
| region\_code         | string                                                                                                             |             |
| region\_key          | string                                                                                                             |             |
| category             | string                                                                                                             |             |
| product              | string                                                                                                             |             |
| account              | string                                                                                                             |             |
| usage\_type          | string                                                                                                             |             |
| resource\_group      | string                                                                                                             |             |
| resource             | string                                                                                                             |             |
| tags                 | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |             |
| additional\_info     | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |             |
| service\_account\_id | string                                                                                                             |             |
| project\_id          | string                                                                                                             |             |
| data\_source\_id     | string                                                                                                             |             |
| domain\_id           | string                                                                                                             |             |
| billed\_at           | string                                                                                                             |             |
| created\_at          | string                                                                                                             |             |

### CostQuery

| Field                | Type                                                                                               | Required | Description |
| -------------------- | -------------------------------------------------------------------------------------------------- | :------: | ----------- |
| query                | [spaceone.api.core.v1.Query](https://spaceone-dev.gitbook.io/api-reference/common-v1/search-query) |     ✘    |             |
| cost\_id             | string                                                                                             |     ✘    |             |
| original\_currency   | string                                                                                             |     ✘    |             |
| provider             | string                                                                                             |     ✘    |             |
| region\_code         | string                                                                                             |     ✘    |             |
| region\_key          | string                                                                                             |     ✘    |             |
| category             | string                                                                                             |     ✘    |             |
| product              | string                                                                                             |     ✘    |             |
| account              | string                                                                                             |     ✘    |             |
| usage\_type          | string                                                                                             |     ✘    |             |
| resource\_group      | string                                                                                             |     ✘    |             |
| resource             | string                                                                                             |     ✘    |             |
| service\_account\_id | string                                                                                             |     ✘    |             |
| project\_id          | string                                                                                             |     ✘    |             |
| data\_source\_id     | string                                                                                             |     ✘    |             |
| domain\_id           | string                                                                                             |     ✔    |             |

### CostRequest

| Field      | Type   | Required | Description |
| ---------- | ------ | :------: | ----------- |
| cost\_id   | string |     ✔    |             |
| domain\_id | string |     ✔    |             |

### CostStatQuery

| Field      | Type                                                                                                             | Required | Description |
| ---------- | ---------------------------------------------------------------------------------------------------------------- | :------: | ----------- |
| query      | [spaceone.api.core.v1.StatisticsQuery](https://spaceone-dev.gitbook.io/api-reference/common-v1/statistics-query) |     ✔    |             |
| domain\_id | string                                                                                                           |     ✔    |             |

### CostsInfo

| Field        | Type                                                                                            | Description |
| ------------ | ----------------------------------------------------------------------------------------------- | ----------- |
| results      | [list of CostInfo](#costinfo)                                                                   |             |
| total\_count | [int32](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/type.proto) |             |

### CreateCostRequest

| Field                | Type                                                                                                               | Required | Description |
| -------------------- | ------------------------------------------------------------------------------------------------------------------ | :------: | ----------- |
| original\_cost       | float                                                                                                              |     ✔    |             |
| original\_currency   | string                                                                                                             |     ✔    |             |
| usd\_cost            | float                                                                                                              |     ✘    |             |
| usage\_quantity      | float                                                                                                              |     ✘    |             |
| provider             | string                                                                                                             |     ✘    |             |
| region\_code         | string                                                                                                             |     ✘    |             |
| category             | string                                                                                                             |     ✘    |             |
| product              | string                                                                                                             |     ✘    |             |
| account              | string                                                                                                             |     ✘    |             |
| usage\_type          | string                                                                                                             |     ✘    |             |
| resource\_group      | string                                                                                                             |     ✘    |             |
| resource             | string                                                                                                             |     ✘    |             |
| tags                 | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |     ✘    |             |
| additional\_info     | [google.protobuf.Struct](https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/struct.proto) |     ✘    |             |
| service\_account\_id | string                                                                                                             |     ✘    |             |
| project\_id          | string                                                                                                             |     ✘    |             |
| data\_source\_id     | string                                                                                                             |     ✔    |             |
| domain\_id           | string                                                                                                             |     ✔    |             |
| billed\_at           | string                                                                                                             |     ✘    |             |

### GetCostRequest

| Field      | Type           | Required | Description |
| ---------- | -------------- | :------: | ----------- |
| cost\_id   | string         |     ✔    |             |
| domain\_id | string         |     ✔    |             |
| only       | list of string |     ✘    |             |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://spaceone-dev.gitbook.io/spaceone-apis/cost_analysis/v1/cost.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
