> 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/api-reference/more-products-apis/feature-management-and-experimentation/segment-definitions.md).

# Segment Definitions

Manage environment-specific standard segment instances (description, keys, segment and environment references, soft-delete).

## List Segment Definitions

> Returns a paginated list of Segment Definitions in the Environment specified by\
> \`environment\_id\`. Defaults to active definitions (\`status\` defaults to \`\[ACTIVE]\`).\
> More than one \`status\` returns \`400\`. Returns \`404\` if \`environment\_id\` does not identify\
> an active Environment in the project.<br>

```json
{"openapi":"3.0.3","info":{"title":"Harness Feature Management & Experimentation API","version":"4.0.0"},"tags":[{"name":"Segment Definitions","description":"Manage environment-specific standard segment instances (description, keys, segment and\nenvironment references, soft-delete).\n"}],"servers":[{"url":"https://app.harness.io/fme/api","description":"Harness SaaS (production)"},{"url":"https://app3.harness.io/fme/api","description":"Harness SaaS (US-3)"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Harness Service Account Token (SAT) or Personal Access Token (PAT).\nGenerate tokens in Harness under Account Settings → Access Management.\n"}},"parameters":{"AccountId":{"name":"account_id","in":"query","required":true,"description":"Harness account identifier. Required on all endpoints.","schema":{"type":"string","pattern":"^[-_A-Za-z0-9]+$","maxLength":128}},"OrganizationIdentifier":{"name":"organization_identifier","in":"query","required":true,"description":"Harness organization identifier.","schema":{"type":"string","pattern":"^[-_A-Za-z0-9]+$","maxLength":128}},"ProjectIdentifier":{"name":"project_identifier","in":"query","required":true,"description":"Harness project identifier.","schema":{"type":"string","pattern":"^[-_A-Za-z0-9]+$","maxLength":128}},"EnvironmentId":{"name":"environment_id","in":"query","required":true,"description":"Environment identifier. Scopes the request to a specific environment; combined with the\nresource name in the path it identifies a specific environment-scoped definition (e.g.,\na Feature Flag Definition or a Segment Definition).\n","schema":{"type":"string","format":"uuid","pattern":"^[-_A-Za-z0-9]+$","maxLength":128}},"PaginationLimitParam":{"name":"limit","in":"query","required":false,"description":"Number of items to return per page. Defaults to 100, maximum 100.","schema":{"type":"integer","minimum":1,"maximum":100,"default":100}},"PaginationOffsetParam":{"name":"offset","in":"query","required":false,"description":"Number of items to skip before the first returned result. Defaults to 0.","schema":{"type":"integer","minimum":0,"default":0}}},"schemas":{"SegmentDefinitionListResponse":{"type":"object","description":"Paginated list of Segment Definitions matching the query.","required":["data","limit","offset","totalCount"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/SegmentDefinition"}},"limit":{"type":"integer","description":"The page size used for this response."},"offset":{"type":"integer","description":"The number of items skipped before the first result."},"totalCount":{"type":"integer","description":"Total number of segment definitions matching the query."}}},"SegmentDefinition":{"type":"object","description":"An environment-specific Segment Definition (standard segment instance).","required":["id","segment","environment","createdAt","status"],"properties":{"id":{"type":"string","format":"uuid","description":"System-assigned identifier for this segment definition."},"description":{"type":"string","nullable":true,"description":"Human-readable description of this segment in the given environment."},"segment":{"allOf":[{"$ref":"#/components/schemas/NamedReference"}],"description":"Reference to the parent segment metadata."},"environment":{"allOf":[{"$ref":"#/components/schemas/NamedReference"}],"description":"Reference to the environment this definition is scoped to."},"createdAt":{"type":"string","format":"date-time","description":"ISO-8601 timestamp when this definition was created."},"status":{"type":"string","enum":["ACTIVE","ARCHIVED"],"description":"Lifecycle status of the segment definition.\n- `ACTIVE` — definition is live.\n- `ARCHIVED` — definition is no longer active (soft-deleted).\n"}}},"NamedReference":{"type":"object","description":"Generic reference to another resource, returned in responses. `id` is the stable\npublic identifier and `name` is the human-readable label.\n","required":["id","name"],"properties":{"id":{"type":"string","description":"Identifier of the referenced resource."},"name":{"type":"string","description":"Human-readable name of the referenced resource."}}},"ErrorResponse":{"type":"object","description":"Standard error response following RFC 7807 Problem Details format (Harness ADR 57).\n","required":["type","status","title","errorType"],"properties":{"type":{"type":"string","format":"uri","description":"URI reference to documentation for this error type."},"status":{"type":"integer","description":"HTTP status code."},"title":{"type":"string","description":"Short human-readable summary of the problem."},"errorType":{"type":"string","description":"Machine-readable error type identifier."},"detail":{"type":"string","description":"Detailed human-readable explanation specific to this occurrence."},"instance":{"type":"string","description":"URI reference identifying the specific occurrence (usually the request path)."},"errors":{"type":"array","description":"List of specific sub-errors (useful for multi-field validation failures). Governance\npolicy failures are also surfaced here — each failing policy is reported as an entry\nwith `errorType: \"governancePolicy\"` — rather than in a separate top-level field.\n","items":{"$ref":"#/components/schemas/ErrorDetail"}}}},"ErrorDetail":{"type":"object","description":"Details about a single sub-error.","required":["errorType","title"],"properties":{"errorType":{"type":"string","description":"Machine-readable error type for this specific error."},"title":{"type":"string","description":"Short summary of this specific error."},"detail":{"type":"string","description":"Detailed explanation of this specific error."},"field":{"type":"string","description":"Name of the request field this error applies to, when the error is field-specific\n(for example a validation failure). Omitted for errors not tied to a single field.\n"}}}},"responses":{"BadRequest":{"description":"Bad Request — validation errors or invalid state transition.\n","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Unauthorized":{"description":"Unauthorized — the request is missing a valid API key, or the key has expired.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Forbidden":{"description":"Forbidden — the caller is authenticated but not permitted to perform this operation.\nReturned when the API can deny the operation without leaking whether a resource exists,\nsuch as create, or write operations where the caller can already read the resource. When\nreturning `403` would reveal resource existence, the API returns `404` instead.\n\nEnvironment-scoped mutations that require approval also return `403`.\n","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"NotFound":{"description":"Not Found — the requested resource does not exist. Also returned when the caller lacks\naccess to the resource (to avoid leaking resource existence).\n","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"TooManyRequests":{"description":"Too Many Requests — the caller has exceeded the rate limit for this endpoint.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"InternalServerError":{"description":"Internal Server Error — an unexpected error occurred while processing the request.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/v4/segment-definitions":{"get":{"tags":["Segment Definitions"],"operationId":"listSegmentDefinitions","summary":"List Segment Definitions","description":"Returns a paginated list of Segment Definitions in the Environment specified by\n`environment_id`. Defaults to active definitions (`status` defaults to `[ACTIVE]`).\nMore than one `status` returns `400`. Returns `404` if `environment_id` does not identify\nan active Environment in the project.\n","parameters":[{"$ref":"#/components/parameters/AccountId"},{"$ref":"#/components/parameters/OrganizationIdentifier"},{"$ref":"#/components/parameters/ProjectIdentifier"},{"$ref":"#/components/parameters/EnvironmentId"},{"$ref":"#/components/parameters/PaginationLimitParam"},{"$ref":"#/components/parameters/PaginationOffsetParam"},{"name":"status","in":"query","required":false,"description":"Filter by lifecycle status. Defaults to `[ACTIVE]`. A single value only; more than one\n`status` returns `400`.\n","schema":{"type":"array","maxItems":1,"items":{"type":"string","enum":["ACTIVE","ARCHIVED"]},"default":["ACTIVE"]},"style":"form","explode":true}],"responses":{"200":{"description":"OK — paginated list of segment definitions returned.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SegmentDefinitionListResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalServerError"}}}}}}
```

## Get a Segment Definition

> Requires \`environment\_id\` as a query parameter. Returns a single active Segment Definition\
> for the specified segment in the specified environment. Soft-deleted (\`ARCHIVED\`)\
> definitions are not returned by name lookup (\`404\`); use LIST with \`status=ARCHIVED\` to\
> discover them.<br>

```json
{"openapi":"3.0.3","info":{"title":"Harness Feature Management & Experimentation API","version":"4.0.0"},"tags":[{"name":"Segment Definitions","description":"Manage environment-specific standard segment instances (description, keys, segment and\nenvironment references, soft-delete).\n"}],"servers":[{"url":"https://app.harness.io/fme/api","description":"Harness SaaS (production)"},{"url":"https://app3.harness.io/fme/api","description":"Harness SaaS (US-3)"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Harness Service Account Token (SAT) or Personal Access Token (PAT).\nGenerate tokens in Harness under Account Settings → Access Management.\n"}},"parameters":{"SegmentName":{"name":"segment-name","in":"path","required":true,"description":"The unique name of the segment within the project. Names must begin with a letter and\nmay contain letters, numbers, underscores, and hyphens. Use the same value that was\nsupplied as `name` when the segment was created. System-assigned ids are not accepted.\n","schema":{"type":"string","pattern":"^[A-Za-z][-_A-Za-z0-9]*$","maxLength":100}},"AccountId":{"name":"account_id","in":"query","required":true,"description":"Harness account identifier. Required on all endpoints.","schema":{"type":"string","pattern":"^[-_A-Za-z0-9]+$","maxLength":128}},"EnvironmentId":{"name":"environment_id","in":"query","required":true,"description":"Environment identifier. Scopes the request to a specific environment; combined with the\nresource name in the path it identifies a specific environment-scoped definition (e.g.,\na Feature Flag Definition or a Segment Definition).\n","schema":{"type":"string","format":"uuid","pattern":"^[-_A-Za-z0-9]+$","maxLength":128}},"OrganizationIdentifier":{"name":"organization_identifier","in":"query","required":true,"description":"Harness organization identifier.","schema":{"type":"string","pattern":"^[-_A-Za-z0-9]+$","maxLength":128}},"ProjectIdentifier":{"name":"project_identifier","in":"query","required":true,"description":"Harness project identifier.","schema":{"type":"string","pattern":"^[-_A-Za-z0-9]+$","maxLength":128}}},"schemas":{"SegmentDefinition":{"type":"object","description":"An environment-specific Segment Definition (standard segment instance).","required":["id","segment","environment","createdAt","status"],"properties":{"id":{"type":"string","format":"uuid","description":"System-assigned identifier for this segment definition."},"description":{"type":"string","nullable":true,"description":"Human-readable description of this segment in the given environment."},"segment":{"allOf":[{"$ref":"#/components/schemas/NamedReference"}],"description":"Reference to the parent segment metadata."},"environment":{"allOf":[{"$ref":"#/components/schemas/NamedReference"}],"description":"Reference to the environment this definition is scoped to."},"createdAt":{"type":"string","format":"date-time","description":"ISO-8601 timestamp when this definition was created."},"status":{"type":"string","enum":["ACTIVE","ARCHIVED"],"description":"Lifecycle status of the segment definition.\n- `ACTIVE` — definition is live.\n- `ARCHIVED` — definition is no longer active (soft-deleted).\n"}}},"NamedReference":{"type":"object","description":"Generic reference to another resource, returned in responses. `id` is the stable\npublic identifier and `name` is the human-readable label.\n","required":["id","name"],"properties":{"id":{"type":"string","description":"Identifier of the referenced resource."},"name":{"type":"string","description":"Human-readable name of the referenced resource."}}},"ErrorResponse":{"type":"object","description":"Standard error response following RFC 7807 Problem Details format (Harness ADR 57).\n","required":["type","status","title","errorType"],"properties":{"type":{"type":"string","format":"uri","description":"URI reference to documentation for this error type."},"status":{"type":"integer","description":"HTTP status code."},"title":{"type":"string","description":"Short human-readable summary of the problem."},"errorType":{"type":"string","description":"Machine-readable error type identifier."},"detail":{"type":"string","description":"Detailed human-readable explanation specific to this occurrence."},"instance":{"type":"string","description":"URI reference identifying the specific occurrence (usually the request path)."},"errors":{"type":"array","description":"List of specific sub-errors (useful for multi-field validation failures). Governance\npolicy failures are also surfaced here — each failing policy is reported as an entry\nwith `errorType: \"governancePolicy\"` — rather than in a separate top-level field.\n","items":{"$ref":"#/components/schemas/ErrorDetail"}}}},"ErrorDetail":{"type":"object","description":"Details about a single sub-error.","required":["errorType","title"],"properties":{"errorType":{"type":"string","description":"Machine-readable error type for this specific error."},"title":{"type":"string","description":"Short summary of this specific error."},"detail":{"type":"string","description":"Detailed explanation of this specific error."},"field":{"type":"string","description":"Name of the request field this error applies to, when the error is field-specific\n(for example a validation failure). Omitted for errors not tied to a single field.\n"}}}},"responses":{"BadRequest":{"description":"Bad Request — validation errors or invalid state transition.\n","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Unauthorized":{"description":"Unauthorized — the request is missing a valid API key, or the key has expired.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"NotFound":{"description":"Not Found — the requested resource does not exist. Also returned when the caller lacks\naccess to the resource (to avoid leaking resource existence).\n","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"TooManyRequests":{"description":"Too Many Requests — the caller has exceeded the rate limit for this endpoint.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"InternalServerError":{"description":"Internal Server Error — an unexpected error occurred while processing the request.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/v4/segment-definitions/{segment-name}":{"get":{"tags":["Segment Definitions"],"operationId":"getSegmentDefinition","summary":"Get a Segment Definition","description":"Requires `environment_id` as a query parameter. Returns a single active Segment Definition\nfor the specified segment in the specified environment. Soft-deleted (`ARCHIVED`)\ndefinitions are not returned by name lookup (`404`); use LIST with `status=ARCHIVED` to\ndiscover them.\n","parameters":[{"$ref":"#/components/parameters/SegmentName"},{"$ref":"#/components/parameters/AccountId"},{"$ref":"#/components/parameters/EnvironmentId"},{"$ref":"#/components/parameters/OrganizationIdentifier"},{"$ref":"#/components/parameters/ProjectIdentifier"}],"responses":{"200":{"description":"OK — segment definition returned.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SegmentDefinition"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalServerError"}}}}}}
```

## Create a Segment Definition

> Requires \`environment\_id\` as a query parameter. Creates a new Segment Definition for the\
> specified segment in the specified environment. A definition must not already exist for\
> this segment + environment combination (\`409\` on conflict). When the environment requires\
> approval, returns \`403\`.<br>

```json
{"openapi":"3.0.3","info":{"title":"Harness Feature Management & Experimentation API","version":"4.0.0"},"tags":[{"name":"Segment Definitions","description":"Manage environment-specific standard segment instances (description, keys, segment and\nenvironment references, soft-delete).\n"}],"servers":[{"url":"https://app.harness.io/fme/api","description":"Harness SaaS (production)"},{"url":"https://app3.harness.io/fme/api","description":"Harness SaaS (US-3)"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Harness Service Account Token (SAT) or Personal Access Token (PAT).\nGenerate tokens in Harness under Account Settings → Access Management.\n"}},"parameters":{"SegmentName":{"name":"segment-name","in":"path","required":true,"description":"The unique name of the segment within the project. Names must begin with a letter and\nmay contain letters, numbers, underscores, and hyphens. Use the same value that was\nsupplied as `name` when the segment was created. System-assigned ids are not accepted.\n","schema":{"type":"string","pattern":"^[A-Za-z][-_A-Za-z0-9]*$","maxLength":100}},"AccountId":{"name":"account_id","in":"query","required":true,"description":"Harness account identifier. Required on all endpoints.","schema":{"type":"string","pattern":"^[-_A-Za-z0-9]+$","maxLength":128}},"EnvironmentId":{"name":"environment_id","in":"query","required":true,"description":"Environment identifier. Scopes the request to a specific environment; combined with the\nresource name in the path it identifies a specific environment-scoped definition (e.g.,\na Feature Flag Definition or a Segment Definition).\n","schema":{"type":"string","format":"uuid","pattern":"^[-_A-Za-z0-9]+$","maxLength":128}},"OrganizationIdentifier":{"name":"organization_identifier","in":"query","required":true,"description":"Harness organization identifier.","schema":{"type":"string","pattern":"^[-_A-Za-z0-9]+$","maxLength":128}},"ProjectIdentifier":{"name":"project_identifier","in":"query","required":true,"description":"Harness project identifier.","schema":{"type":"string","pattern":"^[-_A-Za-z0-9]+$","maxLength":128}}},"schemas":{"CreateSegmentDefinitionRequest":{"type":"object","description":"Optional body. Omit or send `{}` to create the default definition shell.","properties":{"description":{"type":"string","description":"Human-readable description of this segment in the given environment."}}},"SegmentDefinitionResponse":{"type":"object","description":"Mutation response (create, update): entity plus OPA governance.\n","required":["entity","governance"],"properties":{"entity":{"$ref":"#/components/schemas/SegmentDefinition"},"governance":{"allOf":[{"$ref":"#/components/schemas/GovernanceResult"}],"description":"OPA governance result for the mutation."}}},"SegmentDefinition":{"type":"object","description":"An environment-specific Segment Definition (standard segment instance).","required":["id","segment","environment","createdAt","status"],"properties":{"id":{"type":"string","format":"uuid","description":"System-assigned identifier for this segment definition."},"description":{"type":"string","nullable":true,"description":"Human-readable description of this segment in the given environment."},"segment":{"allOf":[{"$ref":"#/components/schemas/NamedReference"}],"description":"Reference to the parent segment metadata."},"environment":{"allOf":[{"$ref":"#/components/schemas/NamedReference"}],"description":"Reference to the environment this definition is scoped to."},"createdAt":{"type":"string","format":"date-time","description":"ISO-8601 timestamp when this definition was created."},"status":{"type":"string","enum":["ACTIVE","ARCHIVED"],"description":"Lifecycle status of the segment definition.\n- `ACTIVE` — definition is live.\n- `ARCHIVED` — definition is no longer active (soft-deleted).\n"}}},"NamedReference":{"type":"object","description":"Generic reference to another resource, returned in responses. `id` is the stable\npublic identifier and `name` is the human-readable label.\n","required":["id","name"],"properties":{"id":{"type":"string","description":"Identifier of the referenced resource."},"name":{"type":"string","description":"Human-readable name of the referenced resource."}}},"GovernanceResult":{"type":"object","description":"OPA policy evaluation result for the operation. `PASS`, `WARNING`, and `ERROR` mean\ngovernance ran; `NONE` means governance was not evaluated (for example off or not linked).\n","required":["status","details"],"properties":{"status":{"type":"string","enum":["PASS","WARNING","ERROR","NONE"],"description":"Overall governance result. `NONE` when governance did not run; otherwise the aggregate\nacross evaluated policies.\n"},"details":{"type":"array","description":"Per-policy results. Empty array when all policies pass cleanly or when status is `NONE`.","items":{"$ref":"#/components/schemas/GovernancePolicyDetail"}}}},"GovernancePolicyDetail":{"type":"object","description":"Per-policy OPA evaluation result.","required":["policyName","status","message"],"properties":{"policyName":{"type":"string","description":"Name of the OPA policy that was evaluated."},"status":{"type":"string","enum":["PASS","WARNING","ERROR"],"description":"Result of evaluating this specific policy."},"message":{"type":"string","description":"Human-readable explanation of the policy result."}}},"ErrorResponse":{"type":"object","description":"Standard error response following RFC 7807 Problem Details format (Harness ADR 57).\n","required":["type","status","title","errorType"],"properties":{"type":{"type":"string","format":"uri","description":"URI reference to documentation for this error type."},"status":{"type":"integer","description":"HTTP status code."},"title":{"type":"string","description":"Short human-readable summary of the problem."},"errorType":{"type":"string","description":"Machine-readable error type identifier."},"detail":{"type":"string","description":"Detailed human-readable explanation specific to this occurrence."},"instance":{"type":"string","description":"URI reference identifying the specific occurrence (usually the request path)."},"errors":{"type":"array","description":"List of specific sub-errors (useful for multi-field validation failures). Governance\npolicy failures are also surfaced here — each failing policy is reported as an entry\nwith `errorType: \"governancePolicy\"` — rather than in a separate top-level field.\n","items":{"$ref":"#/components/schemas/ErrorDetail"}}}},"ErrorDetail":{"type":"object","description":"Details about a single sub-error.","required":["errorType","title"],"properties":{"errorType":{"type":"string","description":"Machine-readable error type for this specific error."},"title":{"type":"string","description":"Short summary of this specific error."},"detail":{"type":"string","description":"Detailed explanation of this specific error."},"field":{"type":"string","description":"Name of the request field this error applies to, when the error is field-specific\n(for example a validation failure). Omitted for errors not tied to a single field.\n"}}}},"responses":{"BadRequest":{"description":"Bad Request — validation errors or invalid state transition.\n","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Unauthorized":{"description":"Unauthorized — the request is missing a valid API key, or the key has expired.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Forbidden":{"description":"Forbidden — the caller is authenticated but not permitted to perform this operation.\nReturned when the API can deny the operation without leaking whether a resource exists,\nsuch as create, or write operations where the caller can already read the resource. When\nreturning `403` would reveal resource existence, the API returns `404` instead.\n\nEnvironment-scoped mutations that require approval also return `403`.\n","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"NotFound":{"description":"Not Found — the requested resource does not exist. Also returned when the caller lacks\naccess to the resource (to avoid leaking resource existence).\n","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Conflict":{"description":"Conflict — a resource with this identifier already exists, the operation conflicts with an\nopen change request, or the resource cannot be deleted/archived while dependents still\nexist. Discriminate with `errorType`: `resourceAlreadyExists`, `pendingChangeConflict`, or\n`hasDependents`. For `hasDependents`, `detail` is the archiver message when one is\navailable; otherwise `Resource has active dependents`.\n","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"UnprocessableEntity":{"description":"Unprocessable Content — OPA governance policy evaluation returned ERROR (`governanceError`).\nEach failing policy is listed in the `errors` array.\n","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"TooManyRequests":{"description":"Too Many Requests — the caller has exceeded the rate limit for this endpoint.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"InternalServerError":{"description":"Internal Server Error — an unexpected error occurred while processing the request.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/v4/segment-definitions/{segment-name}":{"post":{"tags":["Segment Definitions"],"operationId":"createSegmentDefinition","summary":"Create a Segment Definition","description":"Requires `environment_id` as a query parameter. Creates a new Segment Definition for the\nspecified segment in the specified environment. A definition must not already exist for\nthis segment + environment combination (`409` on conflict). When the environment requires\napproval, returns `403`.\n","parameters":[{"$ref":"#/components/parameters/SegmentName"},{"$ref":"#/components/parameters/AccountId"},{"$ref":"#/components/parameters/EnvironmentId"},{"$ref":"#/components/parameters/OrganizationIdentifier"},{"$ref":"#/components/parameters/ProjectIdentifier"}],"requestBody":{"required":false,"description":"Optional. Omit or send `{}` to create the default definition shell.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateSegmentDefinitionRequest"}}}},"responses":{"201":{"description":"Created — the segment definition was successfully created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SegmentDefinitionResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"422":{"$ref":"#/components/responses/UnprocessableEntity"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalServerError"}}}}}}
```

## Delete a Segment Definition

> Requires \`environment\_id\` as a query parameter. Soft-deletes a Segment Definition by\
> transitioning it to \`ARCHIVED\`. After delete, GET by name returns \`404\`; the definition\
> remains discoverable via LIST when \`status\` includes \`ARCHIVED\`. Returns the OPA governance\
> result. Deleting a definition that is already \`ARCHIVED\` returns \`404\`. Returns \`409\` when a\
> pending change request already exists (\`pendingChangeConflict\`), or when keys / flag /\
> rule-based-segment dependents block delete (\`hasDependents\`). When the environment requires\
> approval, returns \`403\`. Accepts optional \`comment\`/\`title\` query parameters for the\
> archive's audit trail; some workspaces require one or both, and omitting a required one\
> returns \`400\`.<br>

```json
{"openapi":"3.0.3","info":{"title":"Harness Feature Management & Experimentation API","version":"4.0.0"},"tags":[{"name":"Segment Definitions","description":"Manage environment-specific standard segment instances (description, keys, segment and\nenvironment references, soft-delete).\n"}],"servers":[{"url":"https://app.harness.io/fme/api","description":"Harness SaaS (production)"},{"url":"https://app3.harness.io/fme/api","description":"Harness SaaS (US-3)"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Harness Service Account Token (SAT) or Personal Access Token (PAT).\nGenerate tokens in Harness under Account Settings → Access Management.\n"}},"parameters":{"SegmentName":{"name":"segment-name","in":"path","required":true,"description":"The unique name of the segment within the project. Names must begin with a letter and\nmay contain letters, numbers, underscores, and hyphens. Use the same value that was\nsupplied as `name` when the segment was created. System-assigned ids are not accepted.\n","schema":{"type":"string","pattern":"^[A-Za-z][-_A-Za-z0-9]*$","maxLength":100}},"AccountId":{"name":"account_id","in":"query","required":true,"description":"Harness account identifier. Required on all endpoints.","schema":{"type":"string","pattern":"^[-_A-Za-z0-9]+$","maxLength":128}},"EnvironmentId":{"name":"environment_id","in":"query","required":true,"description":"Environment identifier. Scopes the request to a specific environment; combined with the\nresource name in the path it identifies a specific environment-scoped definition (e.g.,\na Feature Flag Definition or a Segment Definition).\n","schema":{"type":"string","format":"uuid","pattern":"^[-_A-Za-z0-9]+$","maxLength":128}},"CommentQueryParam":{"name":"comment","in":"query","required":false,"description":"Optional audit comment recorded with the action. Delivered as a query parameter because\nthe endpoint has no request body. Some workspaces require a comment on this action; when\nrequired and omitted, returns `400`.\n","schema":{"type":"string"}},"TitleQueryParam":{"name":"title","in":"query","required":false,"description":"Optional audit title recorded with the action. Delivered as a query parameter because\nthe endpoint has no request body. Some workspaces require a title on this action; when\nrequired and omitted, returns `400`.\n","schema":{"type":"string"}},"OrganizationIdentifier":{"name":"organization_identifier","in":"query","required":true,"description":"Harness organization identifier.","schema":{"type":"string","pattern":"^[-_A-Za-z0-9]+$","maxLength":128}},"ProjectIdentifier":{"name":"project_identifier","in":"query","required":true,"description":"Harness project identifier.","schema":{"type":"string","pattern":"^[-_A-Za-z0-9]+$","maxLength":128}}},"schemas":{"DeleteResponse":{"type":"object","description":"Response envelope for delete operations. Contains only the OPA governance result — no\nentity is returned. Shared by all FME resources so delete responses are consistent.\n","required":["governance"],"properties":{"governance":{"allOf":[{"$ref":"#/components/schemas/GovernanceResult"}],"description":"OPA governance result for the delete operation."}}},"GovernanceResult":{"type":"object","description":"OPA policy evaluation result for the operation. `PASS`, `WARNING`, and `ERROR` mean\ngovernance ran; `NONE` means governance was not evaluated (for example off or not linked).\n","required":["status","details"],"properties":{"status":{"type":"string","enum":["PASS","WARNING","ERROR","NONE"],"description":"Overall governance result. `NONE` when governance did not run; otherwise the aggregate\nacross evaluated policies.\n"},"details":{"type":"array","description":"Per-policy results. Empty array when all policies pass cleanly or when status is `NONE`.","items":{"$ref":"#/components/schemas/GovernancePolicyDetail"}}}},"GovernancePolicyDetail":{"type":"object","description":"Per-policy OPA evaluation result.","required":["policyName","status","message"],"properties":{"policyName":{"type":"string","description":"Name of the OPA policy that was evaluated."},"status":{"type":"string","enum":["PASS","WARNING","ERROR"],"description":"Result of evaluating this specific policy."},"message":{"type":"string","description":"Human-readable explanation of the policy result."}}},"ErrorResponse":{"type":"object","description":"Standard error response following RFC 7807 Problem Details format (Harness ADR 57).\n","required":["type","status","title","errorType"],"properties":{"type":{"type":"string","format":"uri","description":"URI reference to documentation for this error type."},"status":{"type":"integer","description":"HTTP status code."},"title":{"type":"string","description":"Short human-readable summary of the problem."},"errorType":{"type":"string","description":"Machine-readable error type identifier."},"detail":{"type":"string","description":"Detailed human-readable explanation specific to this occurrence."},"instance":{"type":"string","description":"URI reference identifying the specific occurrence (usually the request path)."},"errors":{"type":"array","description":"List of specific sub-errors (useful for multi-field validation failures). Governance\npolicy failures are also surfaced here — each failing policy is reported as an entry\nwith `errorType: \"governancePolicy\"` — rather than in a separate top-level field.\n","items":{"$ref":"#/components/schemas/ErrorDetail"}}}},"ErrorDetail":{"type":"object","description":"Details about a single sub-error.","required":["errorType","title"],"properties":{"errorType":{"type":"string","description":"Machine-readable error type for this specific error."},"title":{"type":"string","description":"Short summary of this specific error."},"detail":{"type":"string","description":"Detailed explanation of this specific error."},"field":{"type":"string","description":"Name of the request field this error applies to, when the error is field-specific\n(for example a validation failure). Omitted for errors not tied to a single field.\n"}}}},"responses":{"BadRequest":{"description":"Bad Request — validation errors or invalid state transition.\n","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Unauthorized":{"description":"Unauthorized — the request is missing a valid API key, or the key has expired.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Forbidden":{"description":"Forbidden — the caller is authenticated but not permitted to perform this operation.\nReturned when the API can deny the operation without leaking whether a resource exists,\nsuch as create, or write operations where the caller can already read the resource. When\nreturning `403` would reveal resource existence, the API returns `404` instead.\n\nEnvironment-scoped mutations that require approval also return `403`.\n","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"NotFound":{"description":"Not Found — the requested resource does not exist. Also returned when the caller lacks\naccess to the resource (to avoid leaking resource existence).\n","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Conflict":{"description":"Conflict — a resource with this identifier already exists, the operation conflicts with an\nopen change request, or the resource cannot be deleted/archived while dependents still\nexist. Discriminate with `errorType`: `resourceAlreadyExists`, `pendingChangeConflict`, or\n`hasDependents`. For `hasDependents`, `detail` is the archiver message when one is\navailable; otherwise `Resource has active dependents`.\n","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"UnprocessableEntity":{"description":"Unprocessable Content — OPA governance policy evaluation returned ERROR (`governanceError`).\nEach failing policy is listed in the `errors` array.\n","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"TooManyRequests":{"description":"Too Many Requests — the caller has exceeded the rate limit for this endpoint.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"InternalServerError":{"description":"Internal Server Error — an unexpected error occurred while processing the request.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/v4/segment-definitions/{segment-name}":{"delete":{"tags":["Segment Definitions"],"operationId":"deleteSegmentDefinition","summary":"Delete a Segment Definition","description":"Requires `environment_id` as a query parameter. Soft-deletes a Segment Definition by\ntransitioning it to `ARCHIVED`. After delete, GET by name returns `404`; the definition\nremains discoverable via LIST when `status` includes `ARCHIVED`. Returns the OPA governance\nresult. Deleting a definition that is already `ARCHIVED` returns `404`. Returns `409` when a\npending change request already exists (`pendingChangeConflict`), or when keys / flag /\nrule-based-segment dependents block delete (`hasDependents`). When the environment requires\napproval, returns `403`. Accepts optional `comment`/`title` query parameters for the\narchive's audit trail; some workspaces require one or both, and omitting a required one\nreturns `400`.\n","parameters":[{"$ref":"#/components/parameters/SegmentName"},{"$ref":"#/components/parameters/AccountId"},{"$ref":"#/components/parameters/EnvironmentId"},{"$ref":"#/components/parameters/CommentQueryParam"},{"$ref":"#/components/parameters/TitleQueryParam"},{"$ref":"#/components/parameters/OrganizationIdentifier"},{"$ref":"#/components/parameters/ProjectIdentifier"}],"responses":{"200":{"description":"OK — segment definition deleted. Returns the governance result.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"422":{"$ref":"#/components/responses/UnprocessableEntity"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalServerError"}}}}}}
```

## Update a Segment Definition (partial)

> Requires \`environment\_id\` as a query parameter. Partially updates a Segment Definition\
> using JSON Merge Patch semantics (RFC 7396). Only fields present in the request body are\
> modified; omitted fields are left unchanged. JSON \`null\` clears \`description\`. See\
> \`UpdateSegmentDefinitionRequest\`.\
> \
> Only \`ACTIVE\` definitions can be updated. Name lookup for non-active definitions returns\
> \`404\`. Returns \`409\` when a pending change request already exists for this definition.\
> When the environment requires approval, returns \`403\`.\
> \
> \*\*Updatable fields:\*\* \`description\`.<br>

```json
{"openapi":"3.0.3","info":{"title":"Harness Feature Management & Experimentation API","version":"4.0.0"},"tags":[{"name":"Segment Definitions","description":"Manage environment-specific standard segment instances (description, keys, segment and\nenvironment references, soft-delete).\n"}],"servers":[{"url":"https://app.harness.io/fme/api","description":"Harness SaaS (production)"},{"url":"https://app3.harness.io/fme/api","description":"Harness SaaS (US-3)"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Harness Service Account Token (SAT) or Personal Access Token (PAT).\nGenerate tokens in Harness under Account Settings → Access Management.\n"}},"parameters":{"SegmentName":{"name":"segment-name","in":"path","required":true,"description":"The unique name of the segment within the project. Names must begin with a letter and\nmay contain letters, numbers, underscores, and hyphens. Use the same value that was\nsupplied as `name` when the segment was created. System-assigned ids are not accepted.\n","schema":{"type":"string","pattern":"^[A-Za-z][-_A-Za-z0-9]*$","maxLength":100}},"AccountId":{"name":"account_id","in":"query","required":true,"description":"Harness account identifier. Required on all endpoints.","schema":{"type":"string","pattern":"^[-_A-Za-z0-9]+$","maxLength":128}},"EnvironmentId":{"name":"environment_id","in":"query","required":true,"description":"Environment identifier. Scopes the request to a specific environment; combined with the\nresource name in the path it identifies a specific environment-scoped definition (e.g.,\na Feature Flag Definition or a Segment Definition).\n","schema":{"type":"string","format":"uuid","pattern":"^[-_A-Za-z0-9]+$","maxLength":128}},"OrganizationIdentifier":{"name":"organization_identifier","in":"query","required":true,"description":"Harness organization identifier.","schema":{"type":"string","pattern":"^[-_A-Za-z0-9]+$","maxLength":128}},"ProjectIdentifier":{"name":"project_identifier","in":"query","required":true,"description":"Harness project identifier.","schema":{"type":"string","pattern":"^[-_A-Za-z0-9]+$","maxLength":128}}},"schemas":{"UpdateSegmentDefinitionRequest":{"type":"object","description":"JSON Merge Patch body (RFC 7396) for updating a Segment Definition. Only `description` is\nupdatable. Omit the field to leave it unchanged; send JSON `null` to clear it.\n","properties":{"description":{"type":"string","nullable":true,"description":"Updated description, or `null` to clear."}}},"SegmentDefinitionResponse":{"type":"object","description":"Mutation response (create, update): entity plus OPA governance.\n","required":["entity","governance"],"properties":{"entity":{"$ref":"#/components/schemas/SegmentDefinition"},"governance":{"allOf":[{"$ref":"#/components/schemas/GovernanceResult"}],"description":"OPA governance result for the mutation."}}},"SegmentDefinition":{"type":"object","description":"An environment-specific Segment Definition (standard segment instance).","required":["id","segment","environment","createdAt","status"],"properties":{"id":{"type":"string","format":"uuid","description":"System-assigned identifier for this segment definition."},"description":{"type":"string","nullable":true,"description":"Human-readable description of this segment in the given environment."},"segment":{"allOf":[{"$ref":"#/components/schemas/NamedReference"}],"description":"Reference to the parent segment metadata."},"environment":{"allOf":[{"$ref":"#/components/schemas/NamedReference"}],"description":"Reference to the environment this definition is scoped to."},"createdAt":{"type":"string","format":"date-time","description":"ISO-8601 timestamp when this definition was created."},"status":{"type":"string","enum":["ACTIVE","ARCHIVED"],"description":"Lifecycle status of the segment definition.\n- `ACTIVE` — definition is live.\n- `ARCHIVED` — definition is no longer active (soft-deleted).\n"}}},"NamedReference":{"type":"object","description":"Generic reference to another resource, returned in responses. `id` is the stable\npublic identifier and `name` is the human-readable label.\n","required":["id","name"],"properties":{"id":{"type":"string","description":"Identifier of the referenced resource."},"name":{"type":"string","description":"Human-readable name of the referenced resource."}}},"GovernanceResult":{"type":"object","description":"OPA policy evaluation result for the operation. `PASS`, `WARNING`, and `ERROR` mean\ngovernance ran; `NONE` means governance was not evaluated (for example off or not linked).\n","required":["status","details"],"properties":{"status":{"type":"string","enum":["PASS","WARNING","ERROR","NONE"],"description":"Overall governance result. `NONE` when governance did not run; otherwise the aggregate\nacross evaluated policies.\n"},"details":{"type":"array","description":"Per-policy results. Empty array when all policies pass cleanly or when status is `NONE`.","items":{"$ref":"#/components/schemas/GovernancePolicyDetail"}}}},"GovernancePolicyDetail":{"type":"object","description":"Per-policy OPA evaluation result.","required":["policyName","status","message"],"properties":{"policyName":{"type":"string","description":"Name of the OPA policy that was evaluated."},"status":{"type":"string","enum":["PASS","WARNING","ERROR"],"description":"Result of evaluating this specific policy."},"message":{"type":"string","description":"Human-readable explanation of the policy result."}}},"ErrorResponse":{"type":"object","description":"Standard error response following RFC 7807 Problem Details format (Harness ADR 57).\n","required":["type","status","title","errorType"],"properties":{"type":{"type":"string","format":"uri","description":"URI reference to documentation for this error type."},"status":{"type":"integer","description":"HTTP status code."},"title":{"type":"string","description":"Short human-readable summary of the problem."},"errorType":{"type":"string","description":"Machine-readable error type identifier."},"detail":{"type":"string","description":"Detailed human-readable explanation specific to this occurrence."},"instance":{"type":"string","description":"URI reference identifying the specific occurrence (usually the request path)."},"errors":{"type":"array","description":"List of specific sub-errors (useful for multi-field validation failures). Governance\npolicy failures are also surfaced here — each failing policy is reported as an entry\nwith `errorType: \"governancePolicy\"` — rather than in a separate top-level field.\n","items":{"$ref":"#/components/schemas/ErrorDetail"}}}},"ErrorDetail":{"type":"object","description":"Details about a single sub-error.","required":["errorType","title"],"properties":{"errorType":{"type":"string","description":"Machine-readable error type for this specific error."},"title":{"type":"string","description":"Short summary of this specific error."},"detail":{"type":"string","description":"Detailed explanation of this specific error."},"field":{"type":"string","description":"Name of the request field this error applies to, when the error is field-specific\n(for example a validation failure). Omitted for errors not tied to a single field.\n"}}}},"responses":{"BadRequest":{"description":"Bad Request — validation errors or invalid state transition.\n","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Unauthorized":{"description":"Unauthorized — the request is missing a valid API key, or the key has expired.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Forbidden":{"description":"Forbidden — the caller is authenticated but not permitted to perform this operation.\nReturned when the API can deny the operation without leaking whether a resource exists,\nsuch as create, or write operations where the caller can already read the resource. When\nreturning `403` would reveal resource existence, the API returns `404` instead.\n\nEnvironment-scoped mutations that require approval also return `403`.\n","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"NotFound":{"description":"Not Found — the requested resource does not exist. Also returned when the caller lacks\naccess to the resource (to avoid leaking resource existence).\n","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Conflict":{"description":"Conflict — a resource with this identifier already exists, the operation conflicts with an\nopen change request, or the resource cannot be deleted/archived while dependents still\nexist. Discriminate with `errorType`: `resourceAlreadyExists`, `pendingChangeConflict`, or\n`hasDependents`. For `hasDependents`, `detail` is the archiver message when one is\navailable; otherwise `Resource has active dependents`.\n","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"UnprocessableEntity":{"description":"Unprocessable Content — OPA governance policy evaluation returned ERROR (`governanceError`).\nEach failing policy is listed in the `errors` array.\n","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"TooManyRequests":{"description":"Too Many Requests — the caller has exceeded the rate limit for this endpoint.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"InternalServerError":{"description":"Internal Server Error — an unexpected error occurred while processing the request.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/v4/segment-definitions/{segment-name}":{"patch":{"tags":["Segment Definitions"],"operationId":"updateSegmentDefinition","summary":"Update a Segment Definition (partial)","description":"Requires `environment_id` as a query parameter. Partially updates a Segment Definition\nusing JSON Merge Patch semantics (RFC 7396). Only fields present in the request body are\nmodified; omitted fields are left unchanged. JSON `null` clears `description`. See\n`UpdateSegmentDefinitionRequest`.\n\nOnly `ACTIVE` definitions can be updated. Name lookup for non-active definitions returns\n`404`. Returns `409` when a pending change request already exists for this definition.\nWhen the environment requires approval, returns `403`.\n\n**Updatable fields:** `description`.\n","parameters":[{"$ref":"#/components/parameters/SegmentName"},{"$ref":"#/components/parameters/AccountId"},{"$ref":"#/components/parameters/EnvironmentId"},{"$ref":"#/components/parameters/OrganizationIdentifier"},{"$ref":"#/components/parameters/ProjectIdentifier"}],"requestBody":{"required":true,"content":{"application/merge-patch+json":{"schema":{"$ref":"#/components/schemas/UpdateSegmentDefinitionRequest"}}}},"responses":{"200":{"description":"OK — segment definition partially updated.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SegmentDefinitionResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/Conflict"},"422":{"$ref":"#/components/responses/UnprocessableEntity"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalServerError"}}}}}}
```

## List Segment Definition Keys

> Requires \`environment\_id\` as a query parameter. Returns a paginated list of membership keys\
> for the specified active Segment Definition in the specified environment. Page size is\
> capped at 100.<br>

```json
{"openapi":"3.0.3","info":{"title":"Harness Feature Management & Experimentation API","version":"4.0.0"},"tags":[{"name":"Segment Definitions","description":"Manage environment-specific standard segment instances (description, keys, segment and\nenvironment references, soft-delete).\n"}],"servers":[{"url":"https://app.harness.io/fme/api","description":"Harness SaaS (production)"},{"url":"https://app3.harness.io/fme/api","description":"Harness SaaS (US-3)"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Harness Service Account Token (SAT) or Personal Access Token (PAT).\nGenerate tokens in Harness under Account Settings → Access Management.\n"}},"parameters":{"SegmentName":{"name":"segment-name","in":"path","required":true,"description":"The unique name of the segment within the project. Names must begin with a letter and\nmay contain letters, numbers, underscores, and hyphens. Use the same value that was\nsupplied as `name` when the segment was created. System-assigned ids are not accepted.\n","schema":{"type":"string","pattern":"^[A-Za-z][-_A-Za-z0-9]*$","maxLength":100}},"AccountId":{"name":"account_id","in":"query","required":true,"description":"Harness account identifier. Required on all endpoints.","schema":{"type":"string","pattern":"^[-_A-Za-z0-9]+$","maxLength":128}},"EnvironmentId":{"name":"environment_id","in":"query","required":true,"description":"Environment identifier. Scopes the request to a specific environment; combined with the\nresource name in the path it identifies a specific environment-scoped definition (e.g.,\na Feature Flag Definition or a Segment Definition).\n","schema":{"type":"string","format":"uuid","pattern":"^[-_A-Za-z0-9]+$","maxLength":128}},"OrganizationIdentifier":{"name":"organization_identifier","in":"query","required":true,"description":"Harness organization identifier.","schema":{"type":"string","pattern":"^[-_A-Za-z0-9]+$","maxLength":128}},"ProjectIdentifier":{"name":"project_identifier","in":"query","required":true,"description":"Harness project identifier.","schema":{"type":"string","pattern":"^[-_A-Za-z0-9]+$","maxLength":128}},"PaginationLimitParam":{"name":"limit","in":"query","required":false,"description":"Number of items to return per page. Defaults to 100, maximum 100.","schema":{"type":"integer","minimum":1,"maximum":100,"default":100}},"PaginationOffsetParam":{"name":"offset","in":"query","required":false,"description":"Number of items to skip before the first returned result. Defaults to 0.","schema":{"type":"integer","minimum":0,"default":0}}},"schemas":{"SegmentDefinitionKeyListResponse":{"type":"object","description":"Paginated list of membership keys for a Segment Definition.","required":["data","limit","offset","totalCount"],"properties":{"data":{"type":"array","description":"Membership keys on this page.","items":{"type":"string"}},"limit":{"type":"integer","description":"The page size used for this response."},"offset":{"type":"integer","description":"The number of items skipped before the first result."},"totalCount":{"type":"integer","description":"Total number of membership keys in the Segment Definition."}}},"ErrorResponse":{"type":"object","description":"Standard error response following RFC 7807 Problem Details format (Harness ADR 57).\n","required":["type","status","title","errorType"],"properties":{"type":{"type":"string","format":"uri","description":"URI reference to documentation for this error type."},"status":{"type":"integer","description":"HTTP status code."},"title":{"type":"string","description":"Short human-readable summary of the problem."},"errorType":{"type":"string","description":"Machine-readable error type identifier."},"detail":{"type":"string","description":"Detailed human-readable explanation specific to this occurrence."},"instance":{"type":"string","description":"URI reference identifying the specific occurrence (usually the request path)."},"errors":{"type":"array","description":"List of specific sub-errors (useful for multi-field validation failures). Governance\npolicy failures are also surfaced here — each failing policy is reported as an entry\nwith `errorType: \"governancePolicy\"` — rather than in a separate top-level field.\n","items":{"$ref":"#/components/schemas/ErrorDetail"}}}},"ErrorDetail":{"type":"object","description":"Details about a single sub-error.","required":["errorType","title"],"properties":{"errorType":{"type":"string","description":"Machine-readable error type for this specific error."},"title":{"type":"string","description":"Short summary of this specific error."},"detail":{"type":"string","description":"Detailed explanation of this specific error."},"field":{"type":"string","description":"Name of the request field this error applies to, when the error is field-specific\n(for example a validation failure). Omitted for errors not tied to a single field.\n"}}}},"responses":{"BadRequest":{"description":"Bad Request — validation errors or invalid state transition.\n","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Unauthorized":{"description":"Unauthorized — the request is missing a valid API key, or the key has expired.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Forbidden":{"description":"Forbidden — the caller is authenticated but not permitted to perform this operation.\nReturned when the API can deny the operation without leaking whether a resource exists,\nsuch as create, or write operations where the caller can already read the resource. When\nreturning `403` would reveal resource existence, the API returns `404` instead.\n\nEnvironment-scoped mutations that require approval also return `403`.\n","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"NotFound":{"description":"Not Found — the requested resource does not exist. Also returned when the caller lacks\naccess to the resource (to avoid leaking resource existence).\n","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"TooManyRequests":{"description":"Too Many Requests — the caller has exceeded the rate limit for this endpoint.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"InternalServerError":{"description":"Internal Server Error — an unexpected error occurred while processing the request.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/v4/segment-definitions/{segment-name}/keys":{"get":{"tags":["Segment Definitions"],"operationId":"listSegmentDefinitionKeys","summary":"List Segment Definition Keys","description":"Requires `environment_id` as a query parameter. Returns a paginated list of membership keys\nfor the specified active Segment Definition in the specified environment. Page size is\ncapped at 100.\n","parameters":[{"$ref":"#/components/parameters/SegmentName"},{"$ref":"#/components/parameters/AccountId"},{"$ref":"#/components/parameters/EnvironmentId"},{"$ref":"#/components/parameters/OrganizationIdentifier"},{"$ref":"#/components/parameters/ProjectIdentifier"},{"$ref":"#/components/parameters/PaginationLimitParam"},{"$ref":"#/components/parameters/PaginationOffsetParam"}],"responses":{"200":{"description":"OK — paginated list of membership keys returned.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SegmentDefinitionKeyListResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalServerError"}}}}}}
```

## Add Segment Definition Keys

> Requires \`environment\_id\` as a query parameter. Adds membership keys to the Segment\
> Definition. When \`replace=true\`, the submitted list replaces the existing membership (an\
> empty \`keys\` array clears membership); when \`false\` (default), keys are merged and an empty\
> list is rejected. At most 10000 keys per request. Only \`ACTIVE\` definitions accept key\
> mutations; name lookup for non-active definitions returns \`404\`. When the environment\
> requires approval, returns \`403\`.<br>

```json
{"openapi":"3.0.3","info":{"title":"Harness Feature Management & Experimentation API","version":"4.0.0"},"tags":[{"name":"Segment Definitions","description":"Manage environment-specific standard segment instances (description, keys, segment and\nenvironment references, soft-delete).\n"}],"servers":[{"url":"https://app.harness.io/fme/api","description":"Harness SaaS (production)"},{"url":"https://app3.harness.io/fme/api","description":"Harness SaaS (US-3)"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Harness Service Account Token (SAT) or Personal Access Token (PAT).\nGenerate tokens in Harness under Account Settings → Access Management.\n"}},"parameters":{"SegmentName":{"name":"segment-name","in":"path","required":true,"description":"The unique name of the segment within the project. Names must begin with a letter and\nmay contain letters, numbers, underscores, and hyphens. Use the same value that was\nsupplied as `name` when the segment was created. System-assigned ids are not accepted.\n","schema":{"type":"string","pattern":"^[A-Za-z][-_A-Za-z0-9]*$","maxLength":100}},"AccountId":{"name":"account_id","in":"query","required":true,"description":"Harness account identifier. Required on all endpoints.","schema":{"type":"string","pattern":"^[-_A-Za-z0-9]+$","maxLength":128}},"EnvironmentId":{"name":"environment_id","in":"query","required":true,"description":"Environment identifier. Scopes the request to a specific environment; combined with the\nresource name in the path it identifies a specific environment-scoped definition (e.g.,\na Feature Flag Definition or a Segment Definition).\n","schema":{"type":"string","format":"uuid","pattern":"^[-_A-Za-z0-9]+$","maxLength":128}},"OrganizationIdentifier":{"name":"organization_identifier","in":"query","required":true,"description":"Harness organization identifier.","schema":{"type":"string","pattern":"^[-_A-Za-z0-9]+$","maxLength":128}},"ProjectIdentifier":{"name":"project_identifier","in":"query","required":true,"description":"Harness project identifier.","schema":{"type":"string","pattern":"^[-_A-Za-z0-9]+$","maxLength":128}}},"schemas":{"SegmentDefinitionKeysAddRequest":{"type":"object","description":"Request body for adding membership keys (or replacing membership when `replace=true`).\nAn empty `keys` array is allowed and clears membership when `replace=true`; when\n`replace=false`, the server rejects an empty list.\n","required":["keys"],"properties":{"keys":{"type":"array","description":"Traffic keys (for example, user identifiers) to add or replace with.","maxItems":10000,"items":{"type":"string","minLength":1}},"comment":{"type":"string","description":"Optional comment recorded with the action."},"title":{"type":"string","description":"Optional title recorded with the action."}}},"SegmentDefinitionKeysMutationResponse":{"type":"object","description":"Submitted membership keys together with the OPA governance result.","required":["keys","governance"],"properties":{"keys":{"type":"array","description":"Submitted keys accepted for processing. May include keys that were already members\n(add) or keys that were not members (remove); those cases are treated as no-ops.\n","items":{"type":"string"}},"governance":{"allOf":[{"$ref":"#/components/schemas/GovernanceResult"}],"description":"OPA governance result for the mutation."}}},"GovernanceResult":{"type":"object","description":"OPA policy evaluation result for the operation. `PASS`, `WARNING`, and `ERROR` mean\ngovernance ran; `NONE` means governance was not evaluated (for example off or not linked).\n","required":["status","details"],"properties":{"status":{"type":"string","enum":["PASS","WARNING","ERROR","NONE"],"description":"Overall governance result. `NONE` when governance did not run; otherwise the aggregate\nacross evaluated policies.\n"},"details":{"type":"array","description":"Per-policy results. Empty array when all policies pass cleanly or when status is `NONE`.","items":{"$ref":"#/components/schemas/GovernancePolicyDetail"}}}},"GovernancePolicyDetail":{"type":"object","description":"Per-policy OPA evaluation result.","required":["policyName","status","message"],"properties":{"policyName":{"type":"string","description":"Name of the OPA policy that was evaluated."},"status":{"type":"string","enum":["PASS","WARNING","ERROR"],"description":"Result of evaluating this specific policy."},"message":{"type":"string","description":"Human-readable explanation of the policy result."}}},"ErrorResponse":{"type":"object","description":"Standard error response following RFC 7807 Problem Details format (Harness ADR 57).\n","required":["type","status","title","errorType"],"properties":{"type":{"type":"string","format":"uri","description":"URI reference to documentation for this error type."},"status":{"type":"integer","description":"HTTP status code."},"title":{"type":"string","description":"Short human-readable summary of the problem."},"errorType":{"type":"string","description":"Machine-readable error type identifier."},"detail":{"type":"string","description":"Detailed human-readable explanation specific to this occurrence."},"instance":{"type":"string","description":"URI reference identifying the specific occurrence (usually the request path)."},"errors":{"type":"array","description":"List of specific sub-errors (useful for multi-field validation failures). Governance\npolicy failures are also surfaced here — each failing policy is reported as an entry\nwith `errorType: \"governancePolicy\"` — rather than in a separate top-level field.\n","items":{"$ref":"#/components/schemas/ErrorDetail"}}}},"ErrorDetail":{"type":"object","description":"Details about a single sub-error.","required":["errorType","title"],"properties":{"errorType":{"type":"string","description":"Machine-readable error type for this specific error."},"title":{"type":"string","description":"Short summary of this specific error."},"detail":{"type":"string","description":"Detailed explanation of this specific error."},"field":{"type":"string","description":"Name of the request field this error applies to, when the error is field-specific\n(for example a validation failure). Omitted for errors not tied to a single field.\n"}}}},"responses":{"BadRequest":{"description":"Bad Request — validation errors or invalid state transition.\n","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Unauthorized":{"description":"Unauthorized — the request is missing a valid API key, or the key has expired.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Forbidden":{"description":"Forbidden — the caller is authenticated but not permitted to perform this operation.\nReturned when the API can deny the operation without leaking whether a resource exists,\nsuch as create, or write operations where the caller can already read the resource. When\nreturning `403` would reveal resource existence, the API returns `404` instead.\n\nEnvironment-scoped mutations that require approval also return `403`.\n","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"NotFound":{"description":"Not Found — the requested resource does not exist. Also returned when the caller lacks\naccess to the resource (to avoid leaking resource existence).\n","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"UnprocessableEntity":{"description":"Unprocessable Content — OPA governance policy evaluation returned ERROR (`governanceError`).\nEach failing policy is listed in the `errors` array.\n","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"TooManyRequests":{"description":"Too Many Requests — the caller has exceeded the rate limit for this endpoint.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"InternalServerError":{"description":"Internal Server Error — an unexpected error occurred while processing the request.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/v4/segment-definitions/{segment-name}/keys":{"post":{"tags":["Segment Definitions"],"operationId":"addSegmentDefinitionKeys","summary":"Add Segment Definition Keys","description":"Requires `environment_id` as a query parameter. Adds membership keys to the Segment\nDefinition. When `replace=true`, the submitted list replaces the existing membership (an\nempty `keys` array clears membership); when `false` (default), keys are merged and an empty\nlist is rejected. At most 10000 keys per request. Only `ACTIVE` definitions accept key\nmutations; name lookup for non-active definitions returns `404`. When the environment\nrequires approval, returns `403`.\n","parameters":[{"$ref":"#/components/parameters/SegmentName"},{"$ref":"#/components/parameters/AccountId"},{"$ref":"#/components/parameters/EnvironmentId"},{"$ref":"#/components/parameters/OrganizationIdentifier"},{"$ref":"#/components/parameters/ProjectIdentifier"},{"name":"replace","in":"query","required":false,"description":"When `true`, replace the entire key membership with the submitted list (including an\nempty list to clear). When `false` (default), add the submitted keys without removing\nexisting ones.\n","schema":{"type":"boolean","default":false}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SegmentDefinitionKeysAddRequest"}}}},"responses":{"200":{"description":"OK — keys added (or membership replaced when `replace=true`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SegmentDefinitionKeysMutationResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/UnprocessableEntity"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalServerError"}}}}}}
```

## Remove Segment Definition Keys

> Requires \`environment\_id\` as a query parameter. Removes the submitted membership keys from\
> the Segment Definition. Keys that are not currently members are ignored. At most 10000 keys\
> per request. Only \`ACTIVE\` definitions accept key mutations; name lookup for non-active\
> definitions returns \`404\`. When the environment requires approval, returns \`403\`.<br>

```json
{"openapi":"3.0.3","info":{"title":"Harness Feature Management & Experimentation API","version":"4.0.0"},"tags":[{"name":"Segment Definitions","description":"Manage environment-specific standard segment instances (description, keys, segment and\nenvironment references, soft-delete).\n"}],"servers":[{"url":"https://app.harness.io/fme/api","description":"Harness SaaS (production)"},{"url":"https://app3.harness.io/fme/api","description":"Harness SaaS (US-3)"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Harness Service Account Token (SAT) or Personal Access Token (PAT).\nGenerate tokens in Harness under Account Settings → Access Management.\n"}},"parameters":{"SegmentName":{"name":"segment-name","in":"path","required":true,"description":"The unique name of the segment within the project. Names must begin with a letter and\nmay contain letters, numbers, underscores, and hyphens. Use the same value that was\nsupplied as `name` when the segment was created. System-assigned ids are not accepted.\n","schema":{"type":"string","pattern":"^[A-Za-z][-_A-Za-z0-9]*$","maxLength":100}},"AccountId":{"name":"account_id","in":"query","required":true,"description":"Harness account identifier. Required on all endpoints.","schema":{"type":"string","pattern":"^[-_A-Za-z0-9]+$","maxLength":128}},"EnvironmentId":{"name":"environment_id","in":"query","required":true,"description":"Environment identifier. Scopes the request to a specific environment; combined with the\nresource name in the path it identifies a specific environment-scoped definition (e.g.,\na Feature Flag Definition or a Segment Definition).\n","schema":{"type":"string","format":"uuid","pattern":"^[-_A-Za-z0-9]+$","maxLength":128}},"OrganizationIdentifier":{"name":"organization_identifier","in":"query","required":true,"description":"Harness organization identifier.","schema":{"type":"string","pattern":"^[-_A-Za-z0-9]+$","maxLength":128}},"ProjectIdentifier":{"name":"project_identifier","in":"query","required":true,"description":"Harness project identifier.","schema":{"type":"string","pattern":"^[-_A-Za-z0-9]+$","maxLength":128}}},"schemas":{"SegmentDefinitionKeysRemoveRequest":{"type":"object","description":"Request body for removing membership keys from a Segment Definition.","required":["keys"],"properties":{"keys":{"type":"array","description":"Traffic keys (for example, user identifiers) to remove.","minItems":1,"maxItems":10000,"items":{"type":"string","minLength":1}},"comment":{"type":"string","description":"Optional comment recorded with the action."},"title":{"type":"string","description":"Optional title recorded with the action."}}},"SegmentDefinitionKeysMutationResponse":{"type":"object","description":"Submitted membership keys together with the OPA governance result.","required":["keys","governance"],"properties":{"keys":{"type":"array","description":"Submitted keys accepted for processing. May include keys that were already members\n(add) or keys that were not members (remove); those cases are treated as no-ops.\n","items":{"type":"string"}},"governance":{"allOf":[{"$ref":"#/components/schemas/GovernanceResult"}],"description":"OPA governance result for the mutation."}}},"GovernanceResult":{"type":"object","description":"OPA policy evaluation result for the operation. `PASS`, `WARNING`, and `ERROR` mean\ngovernance ran; `NONE` means governance was not evaluated (for example off or not linked).\n","required":["status","details"],"properties":{"status":{"type":"string","enum":["PASS","WARNING","ERROR","NONE"],"description":"Overall governance result. `NONE` when governance did not run; otherwise the aggregate\nacross evaluated policies.\n"},"details":{"type":"array","description":"Per-policy results. Empty array when all policies pass cleanly or when status is `NONE`.","items":{"$ref":"#/components/schemas/GovernancePolicyDetail"}}}},"GovernancePolicyDetail":{"type":"object","description":"Per-policy OPA evaluation result.","required":["policyName","status","message"],"properties":{"policyName":{"type":"string","description":"Name of the OPA policy that was evaluated."},"status":{"type":"string","enum":["PASS","WARNING","ERROR"],"description":"Result of evaluating this specific policy."},"message":{"type":"string","description":"Human-readable explanation of the policy result."}}},"ErrorResponse":{"type":"object","description":"Standard error response following RFC 7807 Problem Details format (Harness ADR 57).\n","required":["type","status","title","errorType"],"properties":{"type":{"type":"string","format":"uri","description":"URI reference to documentation for this error type."},"status":{"type":"integer","description":"HTTP status code."},"title":{"type":"string","description":"Short human-readable summary of the problem."},"errorType":{"type":"string","description":"Machine-readable error type identifier."},"detail":{"type":"string","description":"Detailed human-readable explanation specific to this occurrence."},"instance":{"type":"string","description":"URI reference identifying the specific occurrence (usually the request path)."},"errors":{"type":"array","description":"List of specific sub-errors (useful for multi-field validation failures). Governance\npolicy failures are also surfaced here — each failing policy is reported as an entry\nwith `errorType: \"governancePolicy\"` — rather than in a separate top-level field.\n","items":{"$ref":"#/components/schemas/ErrorDetail"}}}},"ErrorDetail":{"type":"object","description":"Details about a single sub-error.","required":["errorType","title"],"properties":{"errorType":{"type":"string","description":"Machine-readable error type for this specific error."},"title":{"type":"string","description":"Short summary of this specific error."},"detail":{"type":"string","description":"Detailed explanation of this specific error."},"field":{"type":"string","description":"Name of the request field this error applies to, when the error is field-specific\n(for example a validation failure). Omitted for errors not tied to a single field.\n"}}}},"responses":{"BadRequest":{"description":"Bad Request — validation errors or invalid state transition.\n","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Unauthorized":{"description":"Unauthorized — the request is missing a valid API key, or the key has expired.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"Forbidden":{"description":"Forbidden — the caller is authenticated but not permitted to perform this operation.\nReturned when the API can deny the operation without leaking whether a resource exists,\nsuch as create, or write operations where the caller can already read the resource. When\nreturning `403` would reveal resource existence, the API returns `404` instead.\n\nEnvironment-scoped mutations that require approval also return `403`.\n","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"NotFound":{"description":"Not Found — the requested resource does not exist. Also returned when the caller lacks\naccess to the resource (to avoid leaking resource existence).\n","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"UnprocessableEntity":{"description":"Unprocessable Content — OPA governance policy evaluation returned ERROR (`governanceError`).\nEach failing policy is listed in the `errors` array.\n","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"TooManyRequests":{"description":"Too Many Requests — the caller has exceeded the rate limit for this endpoint.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"InternalServerError":{"description":"Internal Server Error — an unexpected error occurred while processing the request.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}},"paths":{"/v4/segment-definitions/{segment-name}/keys/remove":{"post":{"tags":["Segment Definitions"],"operationId":"removeSegmentDefinitionKeys","summary":"Remove Segment Definition Keys","description":"Requires `environment_id` as a query parameter. Removes the submitted membership keys from\nthe Segment Definition. Keys that are not currently members are ignored. At most 10000 keys\nper request. Only `ACTIVE` definitions accept key mutations; name lookup for non-active\ndefinitions returns `404`. When the environment requires approval, returns `403`.\n","parameters":[{"$ref":"#/components/parameters/SegmentName"},{"$ref":"#/components/parameters/AccountId"},{"$ref":"#/components/parameters/EnvironmentId"},{"$ref":"#/components/parameters/OrganizationIdentifier"},{"$ref":"#/components/parameters/ProjectIdentifier"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SegmentDefinitionKeysRemoveRequest"}}}},"responses":{"200":{"description":"OK — keys removed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SegmentDefinitionKeysMutationResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"422":{"$ref":"#/components/responses/UnprocessableEntity"},"429":{"$ref":"#/components/responses/TooManyRequests"},"500":{"$ref":"#/components/responses/InternalServerError"}}}}}}
```
