---
title: "Get segment"
method: GET
path: "/api/v2/segments/{projectKey}/{environmentKey}/{segmentKey}"
tags: ["Segments"]
---

# Get segment

`GET /api/v2/segments/{projectKey}/{environmentKey}/{segmentKey}`

Get a single segment by key.<br/><br/>Segments can be rule-based, list-based, or synced. Big segments include larger list-based segments and synced segments. Some fields in the response only apply to big segments.

## Path parameters

- `projectKey` string, string, required — The project key
- `environmentKey` string, string, required — The environment key
- `segmentKey` string, string, required — The segment key

## Response `200`

Segment response

- UserSegment
  - `name` string, required — A human-friendly name for the segment.
  - `description` string — A description of the segment's purpose. Defaults to <code>null</code> and is omitted in the response if not provided.
  - `tags` string[], required — Tags for the segment. Defaults to an empty array.
  - `creationDate` integer, required
  - `lastModifiedDate` integer, required
  - `key` string, required — A unique key used to reference the segment
  - `included` string[] — An array of keys for included targets. Included individual targets are always segment members, regardless of segment rules. For list-based segments over 15,000 entries, also called big segments, this array is either empty or omitted.
  - `excluded` string[] — An array of keys for excluded targets. Segment rules bypass individual excluded targets, so they will never be included based on rules. Excluded targets may still be included explicitly. This value is omitted for list-based segments over 15,000 entries, also called big segments.
  - `includedContexts` SegmentTarget[]
    - `values` string[]
    - `contextKind` string
  - `excludedContexts` SegmentTarget[]
    - `values` string[]
    - `contextKind` string
  - `_links` object, required — The location and content type of related resources
  - `rules` UserSegmentRule[], required — An array of the targeting rules for this segment.
    - `_id` string
    - `clauses` Clause[], required
      - `_id` string
      - `attribute` string, required
      - `op` string, required
      - `values` unknown[], required
        - unknown
      - `contextKind` string
      - `negate` boolean, required
    - `weight` integer
    - `rolloutContextKind` string
    - `bucketBy` string
    - `description` string
  - `version` integer, required — Version of the segment
  - `deleted` boolean, required — Whether the segment has been deleted
  - `_access` Access
    - `denied` AccessDenied[], required
      - `action` string, required
      - `reason` AccessDeniedReason, required
        - `resources` string[] — Resource specifier strings
        - `notResources` string[] — Targeted resources are the resources NOT in this list. The <code>resources</code> and <code>notActions</code> fields must be empty to use this field.
        - `actions` ActionSpecifier[] — Actions to perform on a resource
        - `notActions` ActionSpecifier[] — Targeted actions are the actions NOT in this list. The <code>actions</code> and <code>notResources</code> fields must be empty to use this field.
        - `effect` 'allow' | 'deny', required — Whether this statement should allow or deny actions on the resources.
        - `role_name` string
    - `allowed` AccessAllowedRep[], required
      - `action` string, required
      - `reason` AccessAllowedReason, required
        - `resources` string[] — Resource specifier strings
        - `notResources` string[] — Targeted resources are the resources NOT in this list. The <code>resources</code> and <code>notActions</code> fields must be empty to use this field.
        - `actions` ActionSpecifier[] — Actions to perform on a resource
        - `notActions` ActionSpecifier[] — Targeted actions are the actions NOT in this list. The <code>actions</code> and <code>notResources</code> fields must be empty to use this field.
        - `effect` 'allow' | 'deny', required — Whether this statement should allow or deny actions on the resources.
        - `role_name` string
  - `_flags` FlagListingRep[] — A list of flags targeting this segment. Only included when getting a single segment, using the <code>getSegment</code> endpoint.
    - `name` string, required — The flag name
    - `key` string, required — The flag key
    - `_links` object
    - `_site` Link
      - `href` string
      - `type` string
  - `unbounded` boolean — Whether this is a standard segment (<code>false</code>) or a big segment (<code>true</code>). Standard segments include rule-based segments and smaller list-based segments. Big segments include larger list-based segments and synced segments. If omitted, the segment is a standard segment.
  - `unboundedContextKind` string — For big segments, the targeted context kind.
  - `generation` integer, required — For big segments, how many times this segment has been created.
  - `_unboundedMetadata` SegmentMetadata
    - `envId` string
    - `segmentId` string
    - `version` integer
    - `includedCount` integer
    - `excludedCount` integer
    - `lastModified` integer
    - `deleted` boolean
  - `_external` string — The external data store backing this segment. Only applies to synced segments.
  - `_externalLink` string — The URL for the external data store backing this segment. Only applies to synced segments.
  - `_importInProgress` boolean — Whether an import is currently in progress for the specified segment. Only applies to big segments.

## Other responses

- `401` — Invalid access token
- `404` — Invalid resource identifier
- `429` — Rate limited

---

[API](https://skmtc.dev/launchdarkly/apis/launchdarkly-rest-api.md) · [All operations](https://skmtc.dev/launchdarkly/apis/launchdarkly-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/launchdarkly/launchdarkly-rest-api/revisions/69c5c9aafe78/schema)
