Segments (beta)

Big Segments is an add-on feature

This section documents endpoints for both standard segements and Big Segments. Big Segments is available to customers on an Enterprise plan. To learn more, read about our pricing. To upgrade your plan, contact Sales.

Segments allow you to create targeting rules and lists of users that can be shared by one or more feature flags in an environment. Creating a segment is a lot like creating a flag. You can include individual users from a segment. You can also create targeting rules, same as those for flags, that include or exclude users based on attributes your application has provided about those users. Finally, you can explicitly exclude users that would otherwise be included by those rules. To learn more, read Building user segments.

The segments API allows you to list, create, modify, and delete segments programmatically.

Create Big Segment export

Starts a new export process for a Big Segment

SecurityApiKey
Request
path Parameters
projectKey
required
string <string>

The project key

environmentKey
required
string <string>

The environment key

segmentKey
required
string <string>

The segment key

Responses
200

Action succeeded

400

Invalid request

401

Invalid access token

404

Invalid resource identifier

429

Rate limited

post/api/v2/segments/{projectKey}/{environmentKey}/{segmentKey}/exports
Request samples
curl -i -X POST \
  'https://app.launchdarkly.com/api/v2/segments/{projectKey}/{environmentKey}/{segmentKey}/exports' \
  -H 'Authorization: YOUR_API_KEY_HERE'
Response samples
application/json
{
  • "code": "invalid_request",
  • "message": "invalid request body"
}

Get Big Segment export

Returns info about a Big Segment export process.

SecurityApiKey
Request
path Parameters
projectKey
required
string <string>

The project key

environmentKey
required
string <string>

The environment key

segmentKey
required
string <string>

The segment key

exportID
required
string <string>

The export ID

Responses
200

Segment export response

400

Invalid request

404

Invalid resource identifier

429

Rate limited

get/api/v2/segments/{projectKey}/{environmentKey}/{segmentKey}/exports/{exportID}
Request samples
curl -i -X GET \
  'https://app.launchdarkly.com/api/v2/segments/{projectKey}/{environmentKey}/{segmentKey}/exports/{exportID}' \
  -H 'Authorization: YOUR_API_KEY_HERE'
Response samples
application/json
{
  • "id": "string",
  • "segmentKey": "string",
  • "creationTime": 0,
  • "status": "string",
  • "sizeBytes": 0,
  • "size": "string",
  • "initiator": {
    },
  • "_links": {
    }
}

Create Big Segment import

Start a new import process for a Big Segment.

SecurityApiKey
Request
path Parameters
projectKey
required
string <string>

The project key

environmentKey
required
string <string>

The environment key

segmentKey
required
string <string>

The segment key

Request Body schema: multipart/form-data
file
string <binary>

CSV file containing keys

mode
string <string>

Import mode. Use either merge or replace

Responses
204

Import request submitted successfully

400

Invalid request

401

Invalid access token

404

Invalid resource identifier

409

Conflicting process

429

Rate limited

post/api/v2/segments/{projectKey}/{environmentKey}/{segmentKey}/imports
Request samples
curl -i -X POST \
  'https://app.launchdarkly.com/api/v2/segments/{projectKey}/{environmentKey}/{segmentKey}/imports' \
  -H 'Authorization: YOUR_API_KEY_HERE' \
  -H 'Content-Type: multipart/form-data'
Response samples
application/json
{
  • "code": "invalid_request",
  • "message": "invalid request body"
}

Get Big Segment import

Returns info about a Big Segment import process.

SecurityApiKey
Request
path Parameters
projectKey
required
string <string>

The project key

environmentKey
required
string <string>

The environment key

segmentKey
required
string <string>

The segment key

importID
required
string <string>

The import ID

Responses
200

Segment import response

400

Invalid request

404

Invalid resource identifier

429

Rate limited

get/api/v2/segments/{projectKey}/{environmentKey}/{segmentKey}/imports/{importID}
Request samples
curl -i -X GET \
  'https://app.launchdarkly.com/api/v2/segments/{projectKey}/{environmentKey}/{segmentKey}/imports/{importID}' \
  -H 'Authorization: YOUR_API_KEY_HERE'
Response samples
application/json
{
  • "id": "string",
  • "segmentKey": "string",
  • "creationTime": 0,
  • "mode": "string",
  • "status": "string",
  • "files": [
    ],
  • "_links": {
    }
}