Segments
Create a website segment or cohort
POST
/api/websites/{websiteId}/segmentsSaves a named segment or cohort with its type and filter parameters for the website.
Headers
| Name | Type | Description |
|---|---|---|
| Authorizationrequired | string | Authentication credentials, e.g. Bearer <token>. |
Path parameters
| Name | Type | Description |
|---|---|---|
| websiteIdrequired | string | ID of the website. |
Request body
| Name | Type | Description |
|---|---|---|
| namerequired | string | Display name of the resource. |
| parametersrequired | object | Configuration parameters for the resource. |
| typerequired | enum<string> | Options: segment, cohort |
Example request
Responses
200The operation completed successfully.
| Name | Type | Description |
|---|---|---|
| createdAtrequired | string | Date and time the record was created. |
| idrequired | string | Unique identifier of the resource. |
| namerequired | string | Display name of the resource. |
| parametersrequired | anyOf | Configuration parameters for the resource. |
| typerequired | string | |
| updatedAtrequired | string | Date and time the record was last updated. |
| websiteIdrequired | string | ID of the website. |
200 example
400Bad request.
| Name | Type | Description |
|---|---|---|
| errorrequired | object | Error details returned when the operation fails. |
400 example
401Unauthorized.
| Name | Type | Description |
|---|---|---|
| errorrequired | object | Error details returned when the operation fails. |
401 example
Code samples
cURL