---
title: "Create a New Segment"
method: POST
path: "/v1/segments"
tags: ["Segments"]
---

# Create a New Segment

`POST /v1/segments`

## Request

- Base URL: `https://api.leadboxer.com`
- URL: `https://api.leadboxer.com/v1/segments`
- Auth: API key in header `x-api-key`

Creates a new segmentRequest for the specified account and dataset using the provided configuration. This includes applying filters and setting up any email notification preferences.

## Query parameters

- `email` string, required

## Request body

- CreateSegmentRequest
  - `name` string, required: Segment name.
  - `accountId` string, required: Leadboxer accountId.
  - `datasetId` string, required: The dataset for which to create segment.
  - `type` 'USER' | 'ACCOUNT', required: Defines the visibility of the segment.<br/><br/><b>Possible values:</b><br/><b>USER</b> – Visible only to the current user.<br/><b>ACCOUNT</b> – Shared with all users of the account.
  - `textFilter` string: Text-based filter expression used to filter result fields.Format: field|operator|value. Multiple filters are comma-separated.
  - `numberFilter` string: Numeric filter expression used to filter results based on numeric fields. Format: field|operator|value. Multiple filters are comma-separated. Supported numeric operators include greaterthan, lessthan, is, isnot, between, and notbetween. The between and notbetween operators use the format min-max.
  - `timeFilter` string: Time-based filter expression used to filter results by time field. Format: field|operator|value. Allowed fields (same as `timeField` parameter): - eventEsTimestamp : Last Seen - first_session_unix_timestamp : First Seen Supported operators: - exactly → integer value (0 = Today, 1 = Yesterday) - lessthan → integer value (e.g. 6 = last 7 days) - between → date range in format dd/MM/yyyy-dd/MM/yyyy Locale settings are taken into account while interpreting dates and returning results.
  - `fieldFilter` string: Field-based filter used to include leads based on field presence. Format: operator|field1;field2 Allowed operator: - hasanyvalue Allowed fields: - firstName - lastName - email Multiple fields can be provided using semicolons.
  - `exitLinkFilter` string: Exit link filter used to include or exclude leads based on exit link values. Format: field|operator|value Supported operators: - contains - is - isnot - doesnotcontain Multiple values can be provided using semicolons.
  - `leadscoreFilter` integer: Filters leads based on given minimum leadscore.
  - `displayFilter` string: Display filter used to control which types of leads are returned. Supported values: - company - person - unidentified Selecting 'unidentified' returns leads that could not be identified as a company or a person. Multiple values can be provided using semicolons.
  - `fromFilter` string: Filters leads based on specified from user
  - `owner` string: Filters leads based specified owner(userId)
  - `hidden` string: Filters leads based on presetInclusionList
  - `search` string: Keyword search.
  - `emailView` 'NONE' | 'LEAD' | 'ACCOUNT': Email view type.<br/>Possible values : NONE, LEAD, ACCOUNT<br/>
  - `notificationType` 'NONE' | 'DAILY' | 'WEEKLY': Set notification frequency.<br/><br/><b>Possible values:</b><br/><b>NONE</b> : Do not send any notification.<br/><b>DAILY</b> : Send notification daily.<br/><b>WEEKLY</b> : Send notification weekly.
  - `notificationMailIds` string: List of comma separated email addresses for notification.
  - `mailTemplate` string: Set headlines for the notification email.
  - `format` string: Format for the segment notification.<br/>Possible values : html, csv
  - `dayOfWeek` integer: Day of week on which weekly notification will be sent. Possible values include numbers from 1 to 7 (where 1 refers to Monday).
  - `additionalCsvFields` string: List of comma separated fields to be included in CSV.
  - `sortBy` string: Field to sort result.<br/>Possible values :<br/><b>_score</b> : records sorted by leadscore.<br/><b>lastEvent</b> : records sorted by activity time.<br/>Default : _score
  - `sortOrder` string: Sort order.<br/>Possible values : asc, desc<br/>Default : desc
  - `viewType` string: View type.<br/>Possible values : B2B, B2C<br/>Default : B2B
  - `list` string: Filters list file saved using List Settings Page.
  - `timeField` string
  - `csvSetName` string

## Response `200`

OK

## Other responses

- `400`: Bad Request: The request is invalid or malformed (missing/incorrect parameters).
- `402`: Payment Required: The client has exceeded credit limits.
- `403`: Forbidden: The authenticated user does not have permission to access this resource.
- `404`: Not Found: The requested resource does not exist.
- `409`: Conflict: The request could not be completed due to a resource state conflict.
- `429`: Too Many Requests: Rate limit exceeded. The client has sent too many requests in a given time period
- `500`: Interval Server Error: An unexpected error occurred on the server.

---

[API](https://skmtc.dev/leadboxer/apis/leadboxer-api.md) · [All operations](https://skmtc.dev/leadboxer/apis/leadboxer-api/llms.txt) · [OpenAPI document](https://skmtc.dev/leadboxer/apis/leadboxer-api/revisions/34249b480395?raw)
