---
title: Customers endpoints
slug: customers-endpoints
description: Learn how to use POST requests to create or update customers using this comprehensive API quick reference guide. Discover how to define custom schemas for customers by specifying column names and types. Find an example request for defining the schema as w
icon: 🤴
docTags: 
createdAt: 2023-07-17T15:18:13.055Z
---

# Quick reference

| Verb | Path                                      | Method                           |
| ---- | ----------------------------------------- | -------------------------------- |
| POST | /api/v1/clients/bulk\_create\_or\_update/ | Upsert customers                 |
| POST | /api/v1/clients/schema/                   | Upsert customer's dynamic schema |

# Define Customer Schema

## Description

With our API, you can easily create or update customers. You may want to define specific characterstic of your customers by defining its schema. The schema is defined as list of columns

```shell
curl --location --request POST 'https://api.pricemoov.com/api/v1/clients/schema/' \
--header 'Authorization: jwt <your_token>' \
--header 'Content-Type: application/json' \
--data-raw '[
  {
    "column_name" = "Estimated Revenue",
    "column_type" = "FLOAT",
  },
  {
     "column_name" = "Activity",
     "column_type" = "STR",
  }
}'
```

## Column Parameters

::::VerticalSplit{layout="left"}
:::VerticalSplitItem
column\_name



column\_type




:::

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

The name of the column as it will appear in the platform

`type: string`, `Required`

The type of the column. This has to be one of the following: "ARRAY\_STR", "BIGINT", "BOOL", "FLOAT", "INT", "JSONB", "STR", "TIMESTAMP"
:::
::::

## Example

Upon success, the response is 201 OK and returns

```json
[schema_created]
```

##

# Upsert Customers

Once a schema is defined, you can upsert customers in Pricemoov using following this schema. Based on the fact that the code of the clients should be unique, this will create new clients and update those existing.

```shell
curl --location --request POST 'https://api.pricemoov.com/api/v1/clients/bulk_create_or_update/' \
--header 'Authorization: jwt <your_token>' \
--header 'Content-Type: application/json' \
--data-raw '[
  {
    "code" = "C0123",
    "Estimated Revenue" = 22311123,
    "Activity" = "Carwash",
    "parent_client" = "C01",
  },
  {
    "code" = "C22113",
    "Estimated Revenue" = 1000,
    "Activity" = "Bike Rental",
    "parent_client" = "C01",
  }
}'
```

## Parameters

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



parent\_client



spectific schema columns
:::

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

The code of the client, this code should be unique.

`type: string`, `Optional`

The code of the parent of the client.&#x20;

`Required`

All the columns as defined in the schema.
:::
::::

## Example

Upon success, the response is 201 OK and returns

```json
{
  "created_clients": [list of created clients' ids],
  "updated_clients": [list of updated clients' ids],
}
```

##

