---
title: "Segment user based on provided events and state only"
method: POST
path: "/ccs/v1/segmentation/stateless"
tags: ["API version 1"]
---

# Segment user based on provided events and state only

`POST /ccs/v1/segmentation/stateless`

This endpoint accepts a list of events for a given user and optionally some pre-existing state for the user. It uses these to determine the full list of cohorts of which they are a member, and returns these along with the updated state for the user. State is not persisted, so will not be used in the next request unless it is passed back in as part of that request.

It is likely that this endpoint is more performant than the stateful segmentation endpoint, since it does not need to read state for the user from a database. It is also useful for testing purposes.

Events provided to this endpoint are published to the Permutive Events API, meaning that they will be reflected in other areas of Permutive, for example Insights.

## Query parameters

- `synchronous-validation` boolean

## Request body

- SegmentationRequestWithState
  - `user_id` string, uuid
  - `alias` Alias
    - `tag` string, required
    - `id` string, required
  - `aliases` PrioritisedAlias[]
    - `priority` integer, required
    - `tag` string, required
    - `id` string, required
  - `events` Event[]
    - `name` string, required
    - `time` string, date-time, required
    - `view_id` string, uuid
    - `session_id` string, uuid
    - `properties` JsonObject, required
  - `state` UserState
    - `internal_state` DeviceState, required
    - `external_state` DeviceState, required
    - `cohorts` CohortId[]

## Response `200`

The Permutive User ID and the user's state (including the list of cohorts of which they are a member).

- SegmentationResponseWithState
  - `user_id` string, uuid, required
  - `state` UserState, required
    - `internal_state` DeviceState, required
    - `external_state` DeviceState, required
    - `cohorts` CohortId[]

## Other responses

- `400`
- `401`
- `403`
- `500`

---

[API](https://skmtc.net/permutive/apis/custom-cohort-segmentation-api.md) · [All operations](https://skmtc.net/permutive/apis/custom-cohort-segmentation-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/permutive/custom-cohort-segmentation-api/versions/9fb06b4e8a44/schema)
