# Cost types

### Cost types

## Gets all the configured cost types for a given period.

<mark style="color:blue;">`GET`</mark> `https://www.moderan.net/api/domains/DOMAIN_ID/propertysets/0/sets/0/periods/PERIOD_ID/periodcosttypesshort`

If you have subcosts defined, it will return subcosts. If cost type does not have subcosts, then the main cost type will be returned

#### Path Parameters

| Name                                         | Type   | Description    |
| -------------------------------------------- | ------ | -------------- |
| DOMAIN\_ID<mark style="color:red;">\*</mark> | String | ID of customer |
| PERIOD\_ID<mark style="color:red;">\*</mark> | String | ID of period   |

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

```json
[
    {
        "id": 93438,
        "costType": {
            "name": "Electricity - Day",
            "id": 2618,
            "metaString": "Day"
        },
        "replicateCostType": null,
        "parentCostType": {
            "name": "Electricity",
            "id": 2369,
            "metaString": "Electricity"
        },
        "distributionBasis": {
            "key": "166",
            "value": "Split all between selected tenants",
            "originalValue": "Split all between selected tenants",
            "custom": false,
            "order": 2,
            "subElements": []
        },
        "subCosts": [],
        "period": {
            "id": 34678,
            "parentId": null,
            "building": null,
            "description": null,
            "startDate": "2024-02-11",
            "endDate": "2024-05-10",
            "hasLaterPeriods": false,
            "mainLocked": false,
            "locked": false,
            "automaticMeterLinking": false,
            "tenants": []
        },
        "spaceSet": {
            "name": "All",
            "id": -1
        },
        "manualTariff": 0.0500000,
        "distributionTotal": null,
        "rentalSpace": null,
        "rentalSpaceForExclusions": null,
        "calculatedTariff": 0,
        "groupEnabled": true,
        "individualEnabled": true,
        "individualSwitch": true,
        "showReadingsOnInvoice": false,
        "units": "kWh",
        "description": null,
        "description2": null,
        "groupUnits": {
            "key": "189",
            "value": "Same as individual",
            "originalValue": "Same as individual",
            "custom": false,
            "order": 4,
            "subElements": []
        },
        "groupSameAsIndividual": true,
        "conversionEnabled": false,
        "hasSharedMeters": true,
        "hasCirculationMeters": false,
        "hasSharedIndividualMeters": true,
        "hasTransmissionFactors": false,
        "hasBillContracts": false,
        "hasMeters": false,
        "hasMetersName": null,
        "hasIndividualReadings": false,
        "hasEmissions": false,
        "createdBy": null,
        "modifiedBy": null,
        "createdDate": null,
        "modifiedDate": null
    },
    {
        "id": 93436,
        "costType": {
            "name": "Gas",
            "id": 2808,
            "metaString": "Gas"
        },
        "replicateCostType": null,
        "parentCostType": {
            "name": "Gas",
            "id": 2808,
            "metaString": "Gas"
        },
        "distributionBasis": {
            "key": "153",
            "value": "Leased space",
            "originalValue": "Leased space",
            "custom": false,
            "order": 2,
            "subElements": []
        },
        "subCosts": [],
        "period": {
            "id": 34678,
            "parentId": null,
            "building": null,
            "description": null,
            "startDate": "2024-02-11",
            "endDate": "2024-05-10",
            "hasLaterPeriods": false,
            "mainLocked": false,
            "locked": false,
            "automaticMeterLinking": false,
            "tenants": []
        },
        "spaceSet": {
            "name": "All",
            "id": -1
        },
        "manualTariff": null,
        "distributionTotal": null,
        "rentalSpace": null,
        "rentalSpaceForExclusions": null,
        "calculatedTariff": 0,
        "groupEnabled": false,
        "individualEnabled": true,
        "individualSwitch": true,
        "showReadingsOnInvoice": false,
        "units": "m3",
        "description": null,
        "description2": null,
        "groupUnits": {
            "key": "182",
            "value": "Month",
            "originalValue": "Month",
            "custom": false,
            "order": 1,
            "subElements": []
        },
        "groupSameAsIndividual": false,
        "conversionEnabled": false,
        "hasSharedMeters": false,
        "hasCirculationMeters": false,
        "hasSharedIndividualMeters": false,
        "hasTransmissionFactors": false,
        "hasBillContracts": false,
        "hasMeters": false,
        "hasMetersName": null,
        "hasIndividualReadings": false,
        "hasEmissions": false,
        "createdBy": null,
        "modifiedBy": null,
        "createdDate": null,
        "modifiedDate": null
    },
    {
        "id": 93437,
        "costType": {
            "name": "Electricity - Night",
            "id": 2619,
            "metaString": "Night"
        },
        "replicateCostType": null,
        "parentCostType": {
            "name": "Electricity",
            "id": 2369,
            "metaString": "Electricity"
        },
        "distributionBasis": {
            "key": "166",
            "value": "Split all between selected tenants",
            "originalValue": "Split all between selected tenants",
            "custom": false,
            "order": 2,
            "subElements": []
        },
        "subCosts": [],
        "period": {
            "id": 34678,
            "parentId": null,
            "building": null,
            "description": null,
            "startDate": "2024-02-11",
            "endDate": "2024-05-10",
            "hasLaterPeriods": false,
            "mainLocked": false,
            "locked": false,
            "automaticMeterLinking": false,
            "tenants": []
        },
        "spaceSet": {
            "name": "All",
            "id": -1
        },
        "manualTariff": 0.0500000,
        "distributionTotal": null,
        "rentalSpace": null,
        "rentalSpaceForExclusions": null,
        "calculatedTariff": 0,
        "groupEnabled": true,
        "individualEnabled": true,
        "individualSwitch": true,
        "showReadingsOnInvoice": false,
        "units": "kWh",
        "description": null,
        "description2": null,
        "groupUnits": {
            "key": "189",
            "value": "Same as individual",
            "originalValue": "Same as individual",
            "custom": false,
            "order": 4,
            "subElements": []
        },
        "groupSameAsIndividual": true,
        "conversionEnabled": false,
        "hasSharedMeters": false,
        "hasCirculationMeters": false,
        "hasSharedIndividualMeters": false,
        "hasTransmissionFactors": false,
        "hasBillContracts": false,
        "hasMeters": false,
        "hasMetersName": null,
        "hasIndividualReadings": false,
        "hasEmissions": false,
        "createdBy": null,
        "modifiedBy": null,
        "createdDate": null,
        "modifiedDate": null
    }
]
```

{% endtab %}
{% endtabs %}

To get **PERIOD\_ID** see:

{% content-ref url="get-periods-for-a-cost-set" %}
[get-periods-for-a-cost-set](https://apimoderan.gitbook.io/moderan-api/costs-api/get-periods-for-a-cost-set)
{% endcontent-ref %}

### Cost types for Bills

For some cases, it is needed to get main cost types. For example if you are creating **bills.** Then following request needs to be used.

## Gets all the main cost types for a given period.

<mark style="color:blue;">`GET`</mark> `https://www.moderan.net/api/domains/DOMAIN_ID/propertysets/0/sets/0/periods/PERIOD_ID/periodmaincosttypes`

#### Path Parameters

| Name                                         | Type   | Description    |
| -------------------------------------------- | ------ | -------------- |
| DOMAIN\_ID<mark style="color:red;">\*</mark> | String | ID of customer |
| PERIOD\_ID                                   | String | ID of period   |

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

```json
[
    {
        "id": 93434,
        "costType": {
            "name": "Electricity",
            "id": 2369,
            "metaString": "Electricity"
        },
        "replicateCostType": null,
        "parentCostType": {
            "name": "Electricity",
            "id": 2369,
            "metaString": "Electricity"
        },
        "distributionBasis": {
            "key": "166",
            "value": "Split all between selected tenants",
            "originalValue": "Split all between selected tenants",
            "custom": false,
            "order": 2,
            "subElements": []
        },
        "subCosts": [
            {
                "name": "Electricity - Night",
                "id": 2619
            },
            {
                "name": "Electricity - Day",
                "id": 2618
            }
        ],
        "period": {
            "id": 34678,
            "parentId": null,
            "building": null,
            "description": null,
            "startDate": "2024-02-11",
            "endDate": "2024-05-10",
            "hasLaterPeriods": false,
            "mainLocked": false,
            "locked": false,
            "automaticMeterLinking": false,
            "tenants": []
        },
        "spaceSet": {
            "name": "All",
            "id": -1
        },
        "manualTariff": 0.0500000,
        "distributionTotal": null,
        "rentalSpace": null,
        "rentalSpaceForExclusions": null,
        "calculatedTariff": 0,
        "groupEnabled": true,
        "individualEnabled": true,
        "individualSwitch": true,
        "showReadingsOnInvoice": false,
        "units": "kWh",
        "description": null,
        "description2": null,
        "groupUnits": {
            "key": "189",
            "value": "Same as individual",
            "originalValue": "Same as individual",
            "custom": false,
            "order": 4,
            "subElements": []
        },
        "groupSameAsIndividual": true,
        "conversionEnabled": false,
        "hasSharedMeters": false,
        "hasCirculationMeters": false,
        "hasSharedIndividualMeters": false,
        "hasTransmissionFactors": false,
        "hasBillContracts": false,
        "hasMeters": false,
        "hasMetersName": null,
        "hasIndividualReadings": false,
        "hasEmissions": false,
        "createdBy": null,
        "modifiedBy": null,
        "createdDate": null,
        "modifiedDate": null
    },
    {
        "id": 93436,
        "costType": {
            "name": "Gas",
            "id": 2808,
            "metaString": "Gas"
        },
        "replicateCostType": null,
        "parentCostType": {
            "name": "Gas",
            "id": 2808,
            "metaString": "Gas"
        },
        "distributionBasis": {
            "key": "153",
            "value": "Leased space",
            "originalValue": "Leased space",
            "custom": false,
            "order": 2,
            "subElements": []
        },
        "subCosts": [],
        "period": {
            "id": 34678,
            "parentId": null,
            "building": null,
            "description": null,
            "startDate": "2024-02-11",
            "endDate": "2024-05-10",
            "hasLaterPeriods": false,
            "mainLocked": false,
            "locked": false,
            "automaticMeterLinking": false,
            "tenants": []
        },
        "spaceSet": {
            "name": "All",
            "id": -1
        },
        "manualTariff": null,
        "distributionTotal": null,
        "rentalSpace": null,
        "rentalSpaceForExclusions": null,
        "calculatedTariff": 0,
        "groupEnabled": false,
        "individualEnabled": true,
        "individualSwitch": true,
        "showReadingsOnInvoice": false,
        "units": "m3",
        "description": null,
        "description2": null,
        "groupUnits": {
            "key": "182",
            "value": "Month",
            "originalValue": "Month",
            "custom": false,
            "order": 1,
            "subElements": []
        },
        "groupSameAsIndividual": false,
        "conversionEnabled": false,
        "hasSharedMeters": false,
        "hasCirculationMeters": false,
        "hasSharedIndividualMeters": false,
        "hasTransmissionFactors": false,
        "hasBillContracts": false,
        "hasMeters": false,
        "hasMetersName": null,
        "hasIndividualReadings": false,
        "hasEmissions": false,
        "createdBy": null,
        "modifiedBy": null,
        "createdDate": null,
        "modifiedDate": null
    }
]
```

{% endtab %}
{% endtabs %}


---

# 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://apimoderan.gitbook.io/moderan-api/costs-api/cost-types.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.
