---
title: Costs endpoints
slug: costs-endpoints
description: Learn about two API endpoints that aid in the creation and modification of costs. The first endpoint lets you establish a costs schema by defining parameters like name, description, attributes, columns, and historization preferences. The second endpoint a
icon: 💲
createdAt: 2023-03-13T15:33:55.000Z
---

# Quick reference

| Verb | Path                                   | Method                    |
| ---- | -------------------------------------- | ------------------------- |
| POST | /api/v1/costs/schema/create\_schema/   | Define cost schema        |
| POST | /api/v1/costs/bulk\_create\_or\_update | Bulk update costs entries |

# Define Costs Schema

## Description

With our API, you can easily create or update costs. This table keeps track of all your costs for different suppliers. Pricemoov supports dated costs which means Pricemoov will keep track of the updated costs in the past. This is useful when analyzing past performance. Before that you need to define costs schema.

```shell
curl --location --request POST 'https://api.pricemoov.com/api/v1/costs/schema/create_schema/' \
--header 'Authorization: jwt <your_token>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "name": "costs_per_website",
    "description": "My description",
    "attributes_config": ["code", “category”, "website"],
    "columns_config": [
          {"column_name": "value_1"}, {"column_name": "value_2", "default_value": 100}],
"is_dated": true
}'
```

## Parameters

::::VerticalSplit{layout="left"}
:::VerticalSplitItem
name



description



attributes



columns



is\_dated


:::

:::VerticalSplitItem
`type: string`, `Required`

The name of the cost table

`type: string`, `default: None`, `Optional`

The description of the cost

`type: list`, `Required`

The granularity of the costs

`type: list`, `Required`

A list of mapping of cost columns

`type: boolean`, `default: false`, `Optional`

If need costs to be historized by default
:::
::::

## Example

Upon success, the response is 200 OK and returns

```json
{"id": id_of_table_created}
```

##

# Bulk update costs entries

## Description

By utilizing our API, you have the convenience of effortlessly updating costs. This table effectively maintains a record of all your costs related to various suppliers. Pricemoov facilitates the inclusion of dated costs, allowing for accurate tracking of historical cost updates. This feature proves particularly valuable when analyzing previous performance. However, prior to that, it is necessary to establish a defined cost schema. This is how you achieve that.

```shell
curl --location --request POST 'https://api.pricemoov.com/api/v1/costs/bulk_create_or_update/' \
--header 'Authorization: jwt <your_token>' \
--header 'Content-Type: application/json' \
--data-raw '{
   "name":"costs_per_website",
   "payload":[
        {
            "attributes": {"code": "SHIRT123", "category": "SPORT", "website": 456, "date": },
            "columns": {"value_1": 1, "value_2": 2, "effective_start_date": "2023-02-22" },
        } , ...
   ]
}
'
```

## Parameters

::::VerticalSplit{layout="left"}
:::VerticalSplitItem
name



payload






:::

:::VerticalSplitItem
`type: string`, `Required`

Name of the cost table to update

`type: string`, `Required`

A list of dicts, that should have the following field:

- attributes
- columns
- effective\_start\_date (if table is dated)
:::
::::

## Example

Upon success, the response is 200 OK and returns

```json
[ids_of_rows_created_or_updated]
```

##



