> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/feature-management-experimentation/split-api-reference/segments.md).

# Segments

## Create Segment

> Create a segment in your account (for a given traffic type). This API does not configure the segment in any environment. Include the segment details in the JSON body.

```json
{"openapi":"3.1.0","info":{"title":"Harness FME Admin API","version":"2"},"tags":[{"name":"Segments"}],"servers":[{"url":"https://api.split.io/internal/api/v2"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Admin API Key, sent as `Authorization: Bearer <ADMIN_API_KEY>`"}}},"paths":{"/segments/ws/{workspace-id}/trafficTypes/{traffic-type-id-or-name}":{"post":{"summary":"Create Segment","description":"Create a segment in your account (for a given traffic type). This API does not configure the segment in any environment. Include the segment details in the JSON body.","operationId":"create-segment","parameters":[{"in":"path","name":"workspace-id","schema":{"type":"string"},"required":true,"description":"The ID of the project (workspace) where you want to create the segment. After migration to Harness, get this value using the [Get Projects (Workspaces)](https://docs.split.io/reference/get-workspaces#/) endpoint and the Harness project name."},{"in":"path","name":"traffic-type-id-or-name","schema":{"type":"string"},"required":true,"description":"The ID or name of the traffic type, for example: `user` or `account`."}],"requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"type":"object","properties":{"segment":{"type":"string","description":"JSON object that contains the name and (optionally) the description and owners of the segment.","format":"json"}}}}}},"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"trafficType":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}}},"creationTime":{"type":"integer","default":0},"tags":{}}}}}},"401":{"description":"401","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","default":0},"message":{"type":"string"},"details":{"type":"string"},"transactionId":{"type":"string"}}}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","default":0},"message":{"type":"string"},"details":{"type":"string"},"transactionId":{"type":"string"}}}}}}},"deprecated":false,"tags":["Segments"]}}}}
```

## List Segments

> Lists segments in your account for a given project (formerly known as workspace).

```json
{"openapi":"3.1.0","info":{"title":"Harness FME Admin API","version":"2"},"tags":[{"name":"Segments"}],"servers":[{"url":"https://api.split.io/internal/api/v2"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Admin API Key, sent as `Authorization: Bearer <ADMIN_API_KEY>`"}}},"paths":{"/segments/ws/{workspace-id}":{"get":{"summary":"List Segments","description":"Lists segments in your account for a given project (formerly known as workspace).","operationId":"list-segments","parameters":[{"name":"offset","in":"query","description":"The offset to retrieve. Useful for pagination","schema":{"type":"integer","format":"int32","default":0}},{"name":"limit","in":"query","description":"The maximum segments to return per call. Default=20. Max=50.","schema":{"type":"integer","format":"int32","default":20}},{"name":"tag","in":"query","schema":{"type":"array","items":{"type":"string"},"default":["List of tag to retrieve segments by"]}},{"in":"path","name":"workspace-id","schema":{"type":"string"},"required":true,"description":"The ID of the project (workspace) to get a list of segments from. After migration to Harness, get this value using the [Get Projects (Workspaces)](https://docs.split.io/reference/get-workspaces#/) endpoint and the Harness project name."}],"responses":{"200":{"description":"200","content":{"application/json":{}}},"401":{"description":"401","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","default":0},"message":{"type":"string"},"details":{"type":"string"},"transactionId":{"type":"string"}}}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","default":0},"message":{"type":"string"},"details":{"type":"string"},"transactionId":{"type":"string"}}}}}}},"deprecated":false,"tags":["Segments"]}}}}
```

## Delete Segment

> Delete a segment from your account. This automatically unconfigures the segment definition from all environments.

```json
{"openapi":"3.1.0","info":{"title":"Harness FME Admin API","version":"2"},"tags":[{"name":"Segments"}],"servers":[{"url":"https://api.split.io/internal/api/v2"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Admin API Key, sent as `Authorization: Bearer <ADMIN_API_KEY>`"}}},"paths":{"/segments/ws/{workspace-id}/{segment-name}":{"delete":{"summary":"Delete Segment","description":"Delete a segment from your account. This automatically unconfigures the segment definition from all environments.","operationId":"delete-segment","parameters":[{"in":"path","name":"workspace-id","schema":{"type":"string"},"required":true,"description":"The ID of the project (workspace) where you want to delete the segment. After migration to Harness, get this value using the [Get Projects (Workspaces)](https://docs.split.io/reference/get-workspaces#/) endpoint and the Harness project name."},{"in":"path","name":"segment-name","schema":{"type":"string"},"required":true,"description":"The name of the segment to delete"}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"boolean","default":true}}}},"401":{"description":"401","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","default":0},"message":{"type":"string"},"details":{"type":"string"},"transactionId":{"type":"string"}}}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","default":0},"message":{"type":"string"},"details":{"type":"string"},"transactionId":{"type":"string"}}}}}}},"deprecated":false,"tags":["Segments"]}}}}
```

## Enable Segment in Environment

> Activate a segment in an environment to be able to set its definitions. This endpoint requires an empty JSON body; path parameters are required to activate the segment.

```json
{"openapi":"3.1.0","info":{"title":"Harness FME Admin API","version":"2"},"tags":[{"name":"Segments"}],"servers":[{"url":"https://api.split.io/internal/api/v2"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Admin API Key, sent as `Authorization: Bearer <ADMIN_API_KEY>`"}}},"paths":{"/segments/{environment-id}/{segment-name}":{"post":{"summary":"Enable Segment in Environment","description":"Activate a segment in an environment to be able to set its definitions. This endpoint requires an empty JSON body; path parameters are required to activate the segment.","operationId":"enable-segment-in-environment","parameters":[{"in":"path","name":"environment-id","schema":{"type":"string"},"required":true,"description":"The ID of the FME environment where you want to enable the segment"},{"in":"path","name":"segment-name","schema":{"type":"string"},"required":true,"description":"The name of the segment to enable"}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"environment":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}}},"trafficType":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}}},"creationTime":{"type":"integer","default":0}}}}}},"401":{"description":"401","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","default":0},"message":{"type":"string"},"details":{"type":"string"},"transactionId":{"type":"string"}}}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","default":0},"message":{"type":"string"},"details":{"type":"string"},"transactionId":{"type":"string"}}}}}}},"deprecated":false,"tags":["Segments"]}}}}
```

## Deactivate Segment in Environment

> Deactivate a segment in an environment.

```json
{"openapi":"3.1.0","info":{"title":"Harness FME Admin API","version":"2"},"tags":[{"name":"Segments"}],"servers":[{"url":"https://api.split.io/internal/api/v2"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Admin API Key, sent as `Authorization: Bearer <ADMIN_API_KEY>`"}}},"paths":{"/segments/{environment-id}/{segment-name}":{"delete":{"summary":"Deactivate Segment in Environment","description":"Deactivate a segment in an environment.","operationId":"deactivate-segment-in-environment","parameters":[{"in":"path","name":"environment-id","schema":{"type":"string"},"required":true,"description":"The ID of the FME environment where you want to deactivate the segment"},{"in":"path","name":"segment-name","schema":{"type":"string"},"required":true,"description":"The name of the segment to deactivate"}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"boolean","default":true}}}},"401":{"description":"401","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","default":0},"message":{"type":"string"},"details":{"type":"string"},"transactionId":{"type":"string"}}}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","default":0},"message":{"type":"string"},"details":{},"transactionId":{}}}}}}},"deprecated":false,"tags":["Segments"]}}}}
```

## Get Segment Keys in Environment

> Retrieve segments keys for a given existing segment.

```json
{"openapi":"3.1.0","info":{"title":"Harness FME Admin API","version":"2"},"tags":[{"name":"Segments"}],"servers":[{"url":"https://api.split.io/internal/api/v2"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Admin API Key, sent as `Authorization: Bearer <ADMIN_API_KEY>`"}}},"paths":{"/segments/{environment-id}/{segment-name}/keys":{"get":{"summary":"Get Segment Keys in Environment","description":"Retrieve segments keys for a given existing segment.","operationId":"get-segment-keys-in-environment","parameters":[{"name":"offset","in":"query","description":"The offset to retrieve. Useful for pagination","schema":{"type":"integer","format":"int32","default":0}},{"name":"limit","in":"query","description":"The maximum keys to return per call. Default=100. Max=100.","schema":{"type":"integer","format":"int32","default":100}},{"in":"path","name":"environment-id","schema":{"type":"string"},"required":true,"description":"The ID of the FME environment to read segment keys from"},{"in":"path","name":"segment-name","schema":{"type":"string"},"required":true,"description":"The name of the segment to fetch keys from"}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"keys":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"}}}},"count":{"type":"integer","default":0},"offset":{"type":"integer","default":0},"limit":{"type":"integer","default":0}}}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","default":0},"message":{"type":"string"}}}}}}},"deprecated":false,"tags":["Segments"]}}}}
```

## List Segments in Environment

> Retrieve the segments in an environment.

```json
{"openapi":"3.1.0","info":{"title":"Harness FME Admin API","version":"2"},"tags":[{"name":"Segments"}],"servers":[{"url":"https://api.split.io/internal/api/v2"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Admin API Key, sent as `Authorization: Bearer <ADMIN_API_KEY>`"}}},"paths":{"/segments/ws/{workspace-id}/environments/{environment-id-or-name}":{"get":{"summary":"List Segments in Environment","description":"Retrieve the segments in an environment.","operationId":"list-segments-in-environment","parameters":[{"name":"offset","in":"query","description":"The offset to retrieve. Useful for pagination","schema":{"type":"integer","format":"int32","default":0}},{"name":"limit","in":"query","description":"The maximum segments to return per call. Default=20. Max=50.","schema":{"type":"integer","format":"int32","default":20}},{"in":"path","name":"workspace-id","schema":{"type":"string"},"required":true,"description":"The ID of the project (workspace) for the FME environment. After migration to Harness, get this value using the [Get Projects (Workspaces)](https://docs.split.io/reference/get-workspaces#/) endpoint and the Harness project name."},{"in":"path","name":"environment-id-or-name","schema":{"type":"string"},"required":true,"description":"The ID or case-sensitive name of the FME environment to get a list of segments from"}],"responses":{"200":{"description":"200","content":{"application/json":{}}},"401":{"description":"401","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","default":0},"message":{"type":"string"},"transactionId":{"type":"string"}}}}}},"403":{"description":"403","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","default":0},"message":{"type":"string"},"transactionId":{"type":"string"}}}}}},"404":{"description":"404","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","default":0},"message":{"type":"string"},"transactionId":{"type":"string"}}}}}}},"deprecated":false,"tags":["Segments"]}}}}
```

## Update Segment Keys in Environment via CSV

> Bulk upload a CSV file containing a list of identifiers. The segment must exist before calling this endpoint. Segments are limited to 100,000 members and each call can only include 10,000 new members at a time. This endpoint requires a CSV file in the file form field; path parameters and optional query parameters control which segment and environment are affected. \<blockquote class="callout callout\_info" theme="📘">\<h4>\<span class="callout-icon">📘\</span>\<p style="color:#46b8da;"> Tip\</p>\</h4>\<p style="font-size:15px;">On the \<a href="[https://www.split.io/pricing/">Enterprise\\](https://www.split.io/pricing/">Enterprise\\)</a> plan, you can create \<a href="[https://docs.split.io/reference/createlargesegment">large](https://docs.split.io/reference/createlargesegment">large) segments\</a> (that can contain over 100,000 members).\</blockquote>

```json
{"openapi":"3.1.0","info":{"title":"Harness FME Admin API","version":"2"},"tags":[{"name":"Segments"}],"servers":[{"url":"https://api.split.io/internal/api/v2"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Admin API Key, sent as `Authorization: Bearer <ADMIN_API_KEY>`"}}},"paths":{"/segments/{environment-id}/{segment-name}/upload":{"put":{"summary":"Update Segment Keys in Environment via CSV","description":"Bulk upload a CSV file containing a list of identifiers. The segment must exist before calling this endpoint. Segments are limited to 100,000 members and each call can only include 10,000 new members at a time. This endpoint requires a CSV file in the file form field; path parameters and optional query parameters control which segment and environment are affected. <blockquote class=\"callout callout_info\" theme=\"📘\"><h4><span class=\"callout-icon\">📘</span><p style=\"color:#46b8da;\"> Tip</p></h4><p style=\"font-size:15px;\">On the <a href=\"https://www.split.io/pricing/\">Enterprise</a> plan, you can create <a href=\"https://docs.split.io/reference/createlargesegment\">large segments</a> (that can contain over 100,000 members).</blockquote>","operationId":"update-segment-keys-in-environment-via-csv","parameters":[{"name":"replace","in":"query","description":"Replace the content of the segment (if it previously exists) with the new content.","schema":{"type":"boolean","default":false}},{"in":"path","name":"environment-id","schema":{"type":"string"},"required":true,"description":"The ID of the FME environment to upload the segment to"},{"in":"path","name":"segment-name","schema":{"type":"string"},"required":true,"description":"The name of the segment to update"}],"requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"type":"object","properties":{"file":{"type":"string","description":"The location of the file to upload.","default":"file"}}}}}},"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"orgId":{"type":"string"},"environment":{"type":"string"},"name":{"type":"string"},"trafficTypeId":{"type":"string"},"trafficTypeURN":{"type":"object","properties":{"type":{"type":"string"},"id":{"type":"string"},"name":{"type":"string"}}},"description":{"type":"string"},"creator":{"type":"object","properties":{"type":{"type":"string"},"id":{"type":"string"},"name":{"type":"string"}}},"status":{"type":"string"},"creationTime":{"type":"integer","default":0},"lastUpdateTime":{"type":"integer","default":0},"iAmInThisSegment":{}}}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","default":0},"message":{"type":"string"}}}}}}},"deprecated":false,"tags":["Segments"]}}}}
```

## Update Segment Keys in Environment via JSON

> \<p>Bulk upload a list of identifiers via JSON to a segment. The segment must exist before calling this endpoint. Segments are limited to 100,000 members and each call can only include 10,000 new members at a time. This endpoint requires a JSON body with the keys array and optional comment field; path and query parameters define which segment and environment to update. \</p> \<blockquote class="callout callout\_info" theme="📘">\<h4>\<span class="callout-icon">📘\</span>\<p style="color:#46b8da;">Tip\</p>\</h4>\<p style="font-size:15px;">On the \<a href="[https://www.split.io/pricing/">Enterprise\\](https://www.split.io/pricing/">Enterprise\\)</a> plan, you can create \<a href="[https://docs.split.io/reference/createlargesegment">large](https://docs.split.io/reference/createlargesegment">large) segments\</a> (that can contain over 100,000 members).\</blockquote>

```json
{"openapi":"3.1.0","info":{"title":"Harness FME Admin API","version":"2"},"tags":[{"name":"Segments"}],"servers":[{"url":"https://api.split.io/internal/api/v2"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Admin API Key, sent as `Authorization: Bearer <ADMIN_API_KEY>`"}}},"paths":{"/segments/{environment-id}/{segment-name}/uploadKeys":{"put":{"summary":"Update Segment Keys in Environment via JSON","description":"<p>Bulk upload a list of identifiers via JSON to a segment. The segment must exist before calling this endpoint. Segments are limited to 100,000 members and each call can only include 10,000 new members at a time. This endpoint requires a JSON body with the keys array and optional comment field; path and query parameters define which segment and environment to update. </p> <blockquote class=\"callout callout_info\" theme=\"📘\"><h4><span class=\"callout-icon\">📘</span><p style=\"color:#46b8da;\">Tip</p></h4><p style=\"font-size:15px;\">On the <a href=\"https://www.split.io/pricing/\">Enterprise</a> plan, you can create <a href=\"https://docs.split.io/reference/createlargesegment\">large segments</a> (that can contain over 100,000 members).</blockquote>","operationId":"update-segment-keys-in-environment-via-json","parameters":[{"name":"replace","in":"query","description":"Replace the content of the segment (if it previously exists) with the new content.","schema":{"type":"boolean","default":false}},{"in":"path","name":"environment-id","schema":{"type":"string"},"required":true,"description":"The ID of the FME environment where you want to upload the segment keys"},{"in":"path","name":"segment-name","schema":{"type":"string"},"required":true,"description":"The name of the segment to upload the keys to"}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"orgId":{"type":"string"},"environment":{"type":"string"},"name":{"type":"string"},"trafficTypeId":{"type":"string"},"trafficTypeURN":{"type":"object","properties":{"type":{"type":"string"},"id":{"type":"string"},"name":{"type":"string"}}},"description":{"type":"string"},"creator":{"type":"object","properties":{"type":{"type":"string"},"id":{"type":"string"},"name":{"type":"string"}}},"status":{"type":"string"},"creationTime":{"type":"integer","default":0},"lastUpdateTime":{"type":"integer","default":0},"iAmInThisSegment":{}}}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","default":0},"message":{"type":"string"}}}}}}},"deprecated":false,"tags":["Segments"]}}}}
```

## Remove Segment Keys from Environment

> Delete a list of segment keys via JSON from an existing segment. This endpoint requires a JSON body with a keys array to delete from the specified segment and environment.

```json
{"openapi":"3.1.0","info":{"title":"Harness FME Admin API","version":"2"},"tags":[{"name":"Segments"}],"servers":[{"url":"https://api.split.io/internal/api/v2"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Admin API Key, sent as `Authorization: Bearer <ADMIN_API_KEY>`"}}},"paths":{"/segments/{environment-id}/{segment-name}/removeKeys":{"put":{"summary":"Remove Segment Keys from Environment","description":"Delete a list of segment keys via JSON from an existing segment. This endpoint requires a JSON body with a keys array to delete from the specified segment and environment.","operationId":"remove-segment-keys-from-environment","parameters":[{"in":"path","name":"environment-id","schema":{"type":"string"},"required":true,"description":"The ID of the FME environment where you want to delete the segment keys"},{"in":"path","name":"segment-name","schema":{"type":"string"},"required":true,"description":"The name of the segment to delete the keys from"}],"responses":{"200":{"description":"200","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","default":0},"message":{"type":"string"}}}}}},"400":{"description":"400","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","default":0},"message":{"type":"string"}}}}}}},"deprecated":false,"tags":["Segments"]}}}}
```
