Source: https://fyno.docs.pageloop.ai/api-reference/user-properties/post-wsid-version-profiles-properties-numerical-add

# Increment/Decrement Numeric Property

POST `https://api.fyno.io/v1/{WSID}/{version}/profiles/properties/numerical-add`

This API enables you to increment/decrement values of numeric properties of your users listed in your [User Profiles](../user-profiles-overview). If the user with distinct ID doesn't exist, it creates a new user with the provided distinct ID and updates values for all the provided properties. To decrement property values, you can pass a negative value.

**Note:** If a [property was not created earlier](../adding-new-user-property#how-to-add-a-new-user-property-from-user-profile-page), it will create a new property and the data type of the property will set to `Number`. For example, if you `$add` a new property called `ltv=1200`, it will create the `ltv` property with `Number` type and value `1200`. Do not enclose the value in double quotes as they must be of numeric type.

These user properties can be used to filter your users for creating [user cohorts](../creating-cohorts) and [campaigns](../campaign_creation#creating-a-campaign-using-cohort).

## Authorization

#### Authorization (header, string, required)

Enter your API Key. If you don't have it already, you can create one from the API Keys page within your Fyno account

## Path Parameters

#### WSID (path, string, required)

Enter your workspace ID. You can obtain this value from the API Keys page within your Fyno account.

#### version (path, enum (string), required) — allowed: live, test

Specify the version for which you would like to update the user property.

## Body

#### $add (body, object, required)

Enter the property name as JSON key and the numeric value to increment/decrement as JSON value

#### distinct\_id (body, string, required)

Enter the distinct ID that you use to identify the recipient.

## Response

#### 202

Request has been accepted and will be processed asynchronously.

#### request\_id (string, required)

#### 400

$add object is empty

#### \_message (string, required)

#### status (string, required)

#### 401

API Key or Workspace ID is invalid. User is unauthorised.

#### \_message (string, required)

#### status (string, required)

#### Request

```bash cURL
curl -X POST 'https://api.fyno.io/v1/{WSID}/{version}/profiles/properties/numerical-add' \
  -H 'Authorization: Bearer <token>' \
  -H 'Content-Type: application/json' \
  -d '{"$add": {"property_1": 23.4, "property_2": 20301, "property_n": -39.45}, "distinct_id": "XXXXXXXX"}'
```

```javascript JavaScript
const res = await fetch('https://api.fyno.io/v1/{WSID}/{version}/profiles/properties/numerical-add', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer <token>',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({"$add": {"property_1": 23.4, "property_2": 20301, "property_n": -39.45}, "distinct_id": "XXXXXXXX"}),
});
const data = await res.json();
```

```python Python
import requests

res = requests.post(
    'https://api.fyno.io/v1/{WSID}/{version}/profiles/properties/numerical-add',
    headers={'Authorization': 'Bearer <token>'},
    json={"$add": {"property_1": 23.4, "property_2": 20301, "property_n": -39.45}, "distinct_id": "XXXXXXXX"}
)
data = res.json()
```

#### Response

```json 202
{
  "request_id": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
}
```

```json 400
{
  "_message": "$add has object/keys that is not allowed",
  "status": "error"
}
```

```json 401
{
  "_message": "Invalid API details",
  "status": "error"
}
```
