Update a segment

Use this method to update a segment.

Please log in to see full path URL. Learn why.
put
/people/3/segments/{segmentId}
Request rate limit:
5 requests / second (per account)
path Parameters
segmentId
required
string
Example: 42

A unique segment identifier.

Request Body schema:
application/json
collapse all -
name
required
string

A unique segment name.

description
string

Segment description.

query
required
object

Allows to filter persons using simple queries.

Supported logical operators
Operator Description Example
#and All records that match the conditions of all clauses. {"#and":[{"firstName":"John"},{"lastName":"Smith"}]}
#or All records that match the conditions of any clause. {"#or":[{"firstName":"John"},{"firstName":"Jane"}]}
Supported comparison operators
Attributes Description Example
#notExist Matches records that do not have given attribute. {"#notExist":"firstName"}
#exist Matches records that have given attribute. {"#exists":"firstName"}
Strings Description Example
#eq Equals to a specified string. {"firstName":"John"}
#ne Not equal to a specified string. {"#ne":{"firstName":"John"}}
#startsWith Starts with a specified string. {"#startsWith":{"firstName":"John"}}
#endsWith Ends with a specified string. {"#endsWith":{"firstName":"John"}}
#contains Contains a specified string. {"#contains":{"firstName":"oh"}}
#notContain Does not contain a specified string. {"#notContain":{"firstName":"oh"}}
#in At least one of the strings in a list. {"#in":{"firstName":["John","Jane"]}}
#notIn Not any of the strings in a list. {"#notIn":{"firstName":["John","Jane"]}}
Dates Description Example
#eq Equals to a specified date. {"birthDate":"1987-07-10"}
#ne Not equal to a specified date. {"#ne":{"birthDate":"1987-07-10"}}
#eq (relative) Will be in specified interval. {"#eq":{"birthDate":{"#relNow":"P1D"}}}
#lt (relative) Will be within a specified interval. {"#lt":{"birthDate":{"#relNow":"P1D"}}}
#gt (relative) Will be in more than a specified interval. {"#gt":{"birthDate":{"#relNow":"P1D"}}}
#eq (relative) - Was a specified interval ago. {"#eq":{"birthDate":{"#relNow":"P-1D"}}}
#gt (relative) - Was within a specified interval ago. {"#gt":{"birthDate":{"#relNow":"P-1D"}}}
#gt (relative) - Was more than a specified interval ago. {"#gt":{"birthDate":{"#relNow":"P-1D"}}}
#lt Is before a specified date. {"#lt":{"birthDate":"1987-07-10"}}
#lte Is before or equal to a specified date. {"#lte":{"birthDate":"1987-07-10"}}
#gt Is after a specified date. {"#gt":{"birthDate":"1987-07-10"}}
#gte Is after or equal to a specified date. {"#gte":{"birthDate":"1987-07-10"}}
#in Is equal to one of dates in a given list. {"#in":{"birthDate":["1987-07-10","1987-07-11"]}}
#notIn Is not equal to any of dates in a given list. {"#notIn":{"birthDate":["1987-07-10","1987-07-11"]}}
Integers Description Example
#eq Equals to a specified integer. {"data\u0001counter":1}
#ne Not equal to a specified integer. {"#ne":{"data\u0001counter":1}}
#lt Is less than a specified integer. {"#lt":{"data\u0001counter":1}}
#lte Is less than or equal to a specified integer. {"#lte":{"data\u0001counter":1}}
#gt Is greater than a specified integer. {"#gt":{"data\u0001counter":1}}
#gte Is greater than or equal to a specified integer. {"#gte":{"data\u0001counter":1}}
#in Is equal to any of specified integers in a list. {"#in":{"data\u0001counter":[1,2,3]}}
#notIn Is not equal to any of specified integers in a list. {"#notIn":{"data\u0001counter":[1,2,3]}}
Decimals Description Example
#eq Equals to a specified decimal. {"data\u0001price":1.1}
#ne Is not equal to a specified decimal. {"#ne":{"data\u0001price":1.1}}
#lt Is less than a specified decimal. {"#lt":{"data\u0001price":1.1}}
#lte Is less than or equal to a specified decimal. {"#lte":{"data\u0001price":1.1}}
#gt Is greater than a specified decimal. {"#gt":{"data\u0001price":1.1}}
#gte Is greater than or equal to a specified decimal. {"#gte":{"data\u0001price":1.1}}
#in Is equal to any of specified decimals in a list. {"#in":{"data\u0001price":[1.1,2.1,3.0]}}
#notIn Is not equal to any of specified decimals in a list. {"#notIn":{"data\u0001price":[1.1,2.1,3.0]}}
Booleans Description Example
#eq Equals to a specified boolean. {"data\u0001happy":true}
#ne Not equal to a specified boolean. {"#ne":{"data\u0001happy":true}}
Tags Description Example
#contains Contains a specified tag. {"#contains":{"tags":"SOME_TAG"}}
#notContain Does not contain a specified tag. {"#notContain":{"tags":"SOME_TAG"}}
Gender Description Example
#eq Equals a specified gender. {"gender":"MALE"}
#ne Does not equal a specified gender. {"#ne":{"gender":"FEMALE"}}
Lists Description Example
#all All items in the list match. {"#all":{"data\u0001Cart":{"#and":[{"ProductName":"Laptop"},{"ProductPrice":2000}]}}}
#any Any item in the list match. {"#any":{"data\u0001Cart":{"#and":[{"ProductName":"Laptop"},{"ProductPrice":2000}]}}}
property name*
object

Allows to filter persons using simple queries.

Supported logical operators
Operator Description Example
#and All records that match the conditions of all clauses. {"#and":[{"firstName":"John"},{"lastName":"Smith"}]}
#or All records that match the conditions of any clause. {"#or":[{"firstName":"John"},{"firstName":"Jane"}]}
Supported comparison operators
Attributes Description Example
#notExist Matches records that do not have given attribute. {"#notExist":"firstName"}
#exist Matches records that have given attribute. {"#exists":"firstName"}
Strings Description Example
#eq Equals to a specified string. {"firstName":"John"}
#ne Not equal to a specified string. {"#ne":{"firstName":"John"}}
#startsWith Starts with a specified string. {"#startsWith":{"firstName":"John"}}
#endsWith Ends with a specified string. {"#endsWith":{"firstName":"John"}}
#contains Contains a specified string. {"#contains":{"firstName":"oh"}}
#notContain Does not contain a specified string. {"#notContain":{"firstName":"oh"}}
#in At least one of the strings in a list. {"#in":{"firstName":["John","Jane"]}}
#notIn Not any of the strings in a list. {"#notIn":{"firstName":["John","Jane"]}}
Dates Description Example
#eq Equals to a specified date. {"birthDate":"1987-07-10"}
#ne Not equal to a specified date. {"#ne":{"birthDate":"1987-07-10"}}
#eq (relative) Will be in specified interval. {"#eq":{"birthDate":{"#relNow":"P1D"}}}
#lt (relative) Will be within a specified interval. {"#lt":{"birthDate":{"#relNow":"P1D"}}}
#gt (relative) Will be in more than a specified interval. {"#gt":{"birthDate":{"#relNow":"P1D"}}}
#eq (relative) - Was a specified interval ago. {"#eq":{"birthDate":{"#relNow":"P-1D"}}}
#gt (relative) - Was within a specified interval ago. {"#gt":{"birthDate":{"#relNow":"P-1D"}}}
#gt (relative) - Was more than a specified interval ago. {"#gt":{"birthDate":{"#relNow":"P-1D"}}}
#lt Is before a specified date. {"#lt":{"birthDate":"1987-07-10"}}
#lte Is before or equal to a specified date. {"#lte":{"birthDate":"1987-07-10"}}
#gt Is after a specified date. {"#gt":{"birthDate":"1987-07-10"}}
#gte Is after or equal to a specified date. {"#gte":{"birthDate":"1987-07-10"}}
#in Is equal to one of dates in a given list. {"#in":{"birthDate":["1987-07-10","1987-07-11"]}}
#notIn Is not equal to any of dates in a given list. {"#notIn":{"birthDate":["1987-07-10","1987-07-11"]}}
Integers Description Example
#eq Equals to a specified integer. {"data\u0001counter":1}
#ne Not equal to a specified integer. {"#ne":{"data\u0001counter":1}}
#lt Is less than a specified integer. {"#lt":{"data\u0001counter":1}}
#lte Is less than or equal to a specified integer. {"#lte":{"data\u0001counter":1}}
#gt Is greater than a specified integer. {"#gt":{"data\u0001counter":1}}
#gte Is greater than or equal to a specified integer. {"#gte":{"data\u0001counter":1}}
#in Is equal to any of specified integers in a list. {"#in":{"data\u0001counter":[1,2,3]}}
#notIn Is not equal to any of specified integers in a list. {"#notIn":{"data\u0001counter":[1,2,3]}}
Decimals Description Example
#eq Equals to a specified decimal. {"data\u0001price":1.1}
#ne Is not equal to a specified decimal. {"#ne":{"data\u0001price":1.1}}
#lt Is less than a specified decimal. {"#lt":{"data\u0001price":1.1}}
#lte Is less than or equal to a specified decimal. {"#lte":{"data\u0001price":1.1}}
#gt Is greater than a specified decimal. {"#gt":{"data\u0001price":1.1}}
#gte Is greater than or equal to a specified decimal. {"#gte":{"data\u0001price":1.1}}
#in Is equal to any of specified decimals in a list. {"#in":{"data\u0001price":[1.1,2.1,3.0]}}
#notIn Is not equal to any of specified decimals in a list. {"#notIn":{"data\u0001price":[1.1,2.1,3.0]}}
Booleans Description Example
#eq Equals to a specified boolean. {"data\u0001happy":true}
#ne Not equal to a specified boolean. {"#ne":{"data\u0001happy":true}}
Tags Description Example
#contains Contains a specified tag. {"#contains":{"tags":"SOME_TAG"}}
#notContain Does not contain a specified tag. {"#notContain":{"tags":"SOME_TAG"}}
Gender Description Example
#eq Equals a specified gender. {"gender":"MALE"}
#ne Does not equal a specified gender. {"#ne":{"gender":"FEMALE"}}
Lists Description Example
#all All items in the list match. {"#all":{"data\u0001Cart":{"#and":[{"ProductName":"Laptop"},{"ProductPrice":2000}]}}}
#any Any item in the list match. {"#any":{"data\u0001Cart":{"#and":[{"ProductName":"Laptop"},{"ProductPrice":2000}]}}}
events
Array of objects

List of events that persons should match.

Array
definitionId
required
string

Event definition ID.

occurrenceCondition
object

Specify how many times did the event occur.

operation
required
string
Enum: "IS" "LESS_THAN" "LESS_OR_EQUAL" "GREATER_OR_EQUAL" "GREATER_THAN"

Operation to compare how many times the event has occurred.

times
required
integer <int32>

Number of times the event has occurred.

timelineCondition
required
object

Specify in which timespan did the event occur.

occurred
required
string
Enum: "ALL" "FIRST" "LAST" "NOT"

Specifies whether an event is occurring for the first or last time within a given period. Additionally, we can use an operator to specify if any event has occurred or never occurred within the specified timeframe.

operator
required
string
Enum: "EMPTY" "AFTER" "BEFORE" "BETWEEN" "AFTER_ABS" "BEFORE_ABS" "BETWEEN_ABS"

The operators AFTER, BEFORE, and BETWEEN can be used to specify relative time periods, while their counterparts with the suffix _ABS (e.g., AFTER_ABS, BEFORE_ABS, BETWEEN_ABS) are used for absolute time values. These operators can be applied with start and end attributes to define the beginning and ending points of the time. Units need to be used with relative operators to specify the duration of the time periods.

start
integer <int32>

Start of timespan: For relative operators, specify the number of units. For absolute operators, provide a Unix timestamp.

end
integer <int32>

End of timespan: For relative operators, specify the number of units. For absolute operators, provide a Unix timestamp.

units
string
Enum: "DAYS" "HOURS" "MINUTES"

Time units for relative operators.

payloadConditions
Array of objects

Specify the conditions of the event payload.

Array
attribute
required
string

Event payload attribute.

operator
required
string
Enum: "EQ" "LT" "LTE" "GT" "GTE" "NE" "SW" "EW" "CON"

Operator for comparing condition value with payload value.

value
required
string

Payload condition value.

Responses

200

OK

400

Bad Request

401

Unauthorized

403

Forbidden

404

Not Found

429

Too Many Requests

500

Internal Server Error

Request samples

Content type
application/json
Copy
Collapse all
{
  • "name": "VIP Alex Clients",
  • "description": "Persons named Alex with tag \"VIP Client\"",
  • "query":
    {
    • "#and":
      [
      • {
        • "firstName": "Alex"
        },
      • {
        • "#contains":
          {
          • "tags": "VIP Client"
          }
        }
      ]
    },
  • "events":
    [
    • {
      • "definitionId": "addedToCart",
      • "occurrenceCondition":
        {
        • "operation": "IS",
        • "times": 5
        },
      • "timelineCondition":
        {
        • "occurred": "ALL",
        • "operator": "BETWEEN",
        • "start": 60,
        • "end": 30,
        • "units": "DAYS"
        },
      • "payloadConditions":
        [
        • {
          • "attribute": "itemId",
          • "operator": "EQ",
          • "value": "10001"
          }
        ]
      }
    ]
}

Response samples

Content type
application/json
Copy
Collapse all
{
  • "id": 42,
  • "name": "VIP Alex Clients",
  • "description": "Persons named Alex with tag \"VIP Client\"",
  • "query":
    {
    • "#and":
      [
      • {
        • "firstName": "Alex"
        },
      • {
        • "#contains":
          {
          • "tags": "VIP Client"
          }
        }
      ]
    },
  • "events":
    [
    • {
      • "definitionId": "addedToCart",
      • "occurrenceCondition":
        {
        • "operation": "IS",
        • "times": 5
        },
      • "timelineCondition":
        {
        • "occurred": "ALL",
        • "operator": "BETWEEN",
        • "start": 60,
        • "end": 30,
        • "units": "DAYS"
        },
      • "payloadConditions":
        [
        • {
          • "attribute": "itemId",
          • "operator": "EQ",
          • "value": "10001"
          }
        ]
      }
    ],
  • "createdAt": "2025-03-30T00:35:33Z",
  • "modifiedAt": "2025-03-30T00:35:33Z"
}

Encountering issues

Contact our support

What's new? Check out

Release Notes

Unsure about a term? See

Glossary

Research panel

Help shape the future of our products
Learn more
Service status

Copyright @ 2006-2025 Infobip ltd.