# Create big segment store integration

POST https://app.launchdarkly.com/api/v2/integration-capabilities/big-segment-store/{projectKey}/{environmentKey}/{integrationKey}
Content-Type: application/json


Create a persistent store integration.

If you are using server-side SDKs, segments synced from external tools and larger list-based segments require a persistent store within your infrastructure. LaunchDarkly keeps the persistent store up to date and consults it during flag evaluation.

You can use either Redis or DynamoDB as your persistent store. When you create a persistent store integration, the fields in the `config` object in the request vary depending on which persistent store you use.

If you are using Redis to create your persistent store integration, you will need to know:

* Your Redis host
* Your Redis port
* Your Redis username
* Your Redis password
* Whether or not LaunchDarkly should connect using TLS

If you are using DynamoDB to create your persistent store integration, you will need to know:

* Your DynamoDB table name. The table must have the following schema:
  * Partition key: `namespace` (string)
  * Sort key: `key` (string)
* Your DynamoDB Amazon Web Services (AWS) region.
* Your AWS role Amazon Resource Name (ARN). This is the role that LaunchDarkly will assume to manage your DynamoDB table.
* The External ID you specified when creating your Amazon Resource Name (ARN).

To learn more, read [Segment configuration](https://launchdarkly.com/docs/home/flags/segment-config).


Reference: https://launchdarkly.com/docs/api/persistent-store-integrations-beta/create-big-segment-store-integration

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: LaunchDarkly REST API
  version: 1.0.0
paths:
  /api/v2/integration-capabilities/big-segment-store/{projectKey}/{environmentKey}/{integrationKey}:
    post:
      operationId: create-big-segment-store-integration
      summary: Create big segment store integration
      description: >

        Create a persistent store integration.


        If you are using server-side SDKs, segments synced from external tools
        and larger list-based segments require a persistent store within your
        infrastructure. LaunchDarkly keeps the persistent store up to date and
        consults it during flag evaluation.


        You can use either Redis or DynamoDB as your persistent store. When you
        create a persistent store integration, the fields in the `config` object
        in the request vary depending on which persistent store you use.


        If you are using Redis to create your persistent store integration, you
        will need to know:


        * Your Redis host

        * Your Redis port

        * Your Redis username

        * Your Redis password

        * Whether or not LaunchDarkly should connect using TLS


        If you are using DynamoDB to create your persistent store integration,
        you will need to know:


        * Your DynamoDB table name. The table must have the following schema:
          * Partition key: `namespace` (string)
          * Sort key: `key` (string)
        * Your DynamoDB Amazon Web Services (AWS) region.

        * Your AWS role Amazon Resource Name (ARN). This is the role that
        LaunchDarkly will assume to manage your DynamoDB table.

        * The External ID you specified when creating your Amazon Resource Name
        (ARN).


        To learn more, read [Segment
        configuration](https://launchdarkly.com/docs/home/flags/segment-config).
      tags:
        - subpackage_persistentStoreIntegrationsBeta
      parameters:
        - name: projectKey
          in: path
          description: The project key
          required: true
          schema:
            type: string
            format: string
        - name: environmentKey
          in: path
          description: The environment key
          required: true
          schema:
            type: string
            format: string
        - name: integrationKey
          in: path
          description: The integration key, either `redis` or `dynamodb`
          required: true
          schema:
            type: string
            format: string
        - name: Authorization
          in: header
          required: true
          schema:
            type: string
      responses:
        '201':
          description: Big segment store response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BigSegmentStoreIntegration'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvalidRequestErrorRep'
        '401':
          description: Invalid access token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedErrorRep'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenErrorRep'
        '404':
          description: Environment or project not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundErrorRep'
        '409':
          description: Status conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StatusConflictErrorRep'
        '429':
          description: Rate limited
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RateLimitedErrorRep'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/IntegrationDeliveryConfigurationPost'
servers:
  - url: https://app.launchdarkly.com
  - url: https://app.launchdarkly.us
components:
  schemas:
    FormVariableConfig:
      type: object
      additionalProperties:
        description: Any type
      title: FormVariableConfig
    IntegrationDeliveryConfigurationPost:
      type: object
      properties:
        'on':
          type: boolean
          description: >-
            Whether the integration configuration is active. Default value is
            false.
        config:
          $ref: '#/components/schemas/FormVariableConfig'
          description: >-
            The global integration settings, as specified by the
            <code>formVariables</code> in the <code>manifest.json</code> for
            this integration.
        tags:
          type: array
          items:
            type: string
          description: Tags to associate with the integration
        name:
          type: string
          description: Name to identify the integration
      required:
        - config
      title: IntegrationDeliveryConfigurationPost
    Link:
      type: object
      properties:
        href:
          type: string
          description: The URL of the link
        type:
          type: string
          description: The type of the link
      title: Link
    BigSegmentStoreIntegrationLinks:
      type: object
      properties:
        self:
          $ref: '#/components/schemas/Link'
        parent:
          $ref: '#/components/schemas/Link'
        project:
          $ref: '#/components/schemas/Link'
        environment:
          $ref: '#/components/schemas/Link'
      required:
        - self
        - parent
        - project
        - environment
      title: BigSegmentStoreIntegrationLinks
    BigSegmentStoreIntegrationIntegrationKey:
      type: string
      enum:
        - redis
        - dynamodb
      description: The integration key
      title: BigSegmentStoreIntegrationIntegrationKey
    ActionIdentifier:
      type: string
      title: ActionIdentifier
    ActionSpecifier:
      type: string
      title: ActionSpecifier
    AccessDeniedReasonEffect:
      type: string
      enum:
        - allow
        - deny
      description: Whether this statement should allow or deny actions on the resources.
      title: AccessDeniedReasonEffect
    AccessDeniedReason:
      type: object
      properties:
        resources:
          type: array
          items:
            type: string
          description: Resource specifier strings
        notResources:
          type: array
          items:
            type: string
          description: >-
            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:
          type: array
          items:
            $ref: '#/components/schemas/ActionSpecifier'
          description: Actions to perform on a resource
        notActions:
          type: array
          items:
            $ref: '#/components/schemas/ActionSpecifier'
          description: >-
            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:
          $ref: '#/components/schemas/AccessDeniedReasonEffect'
          description: >-
            Whether this statement should allow or deny actions on the
            resources.
        role_name:
          type: string
      required:
        - effect
      title: AccessDeniedReason
    AccessDenied:
      type: object
      properties:
        action:
          $ref: '#/components/schemas/ActionIdentifier'
        reason:
          $ref: '#/components/schemas/AccessDeniedReason'
      required:
        - action
        - reason
      title: AccessDenied
    AccessAllowedReasonEffect:
      type: string
      enum:
        - allow
        - deny
      description: Whether this statement should allow or deny actions on the resources.
      title: AccessAllowedReasonEffect
    AccessAllowedReason:
      type: object
      properties:
        resources:
          type: array
          items:
            type: string
          description: Resource specifier strings
        notResources:
          type: array
          items:
            type: string
          description: >-
            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:
          type: array
          items:
            $ref: '#/components/schemas/ActionSpecifier'
          description: Actions to perform on a resource
        notActions:
          type: array
          items:
            $ref: '#/components/schemas/ActionSpecifier'
          description: >-
            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:
          $ref: '#/components/schemas/AccessAllowedReasonEffect'
          description: >-
            Whether this statement should allow or deny actions on the
            resources.
        role_name:
          type: string
      required:
        - effect
      title: AccessAllowedReason
    AccessAllowedRep:
      type: object
      properties:
        action:
          $ref: '#/components/schemas/ActionIdentifier'
        reason:
          $ref: '#/components/schemas/AccessAllowedReason'
      required:
        - action
        - reason
      title: AccessAllowedRep
    Access:
      type: object
      properties:
        denied:
          type: array
          items:
            $ref: '#/components/schemas/AccessDenied'
        allowed:
          type: array
          items:
            $ref: '#/components/schemas/AccessAllowedRep'
      required:
        - denied
        - allowed
      title: Access
    UnixMillis:
      type: integer
      format: int64
      title: UnixMillis
    StoreIntegrationError:
      type: object
      properties:
        statusCode:
          type: integer
        message:
          type: string
        timestamp:
          $ref: '#/components/schemas/UnixMillis'
      title: StoreIntegrationError
    BigSegmentStoreStatus:
      type: object
      properties:
        available:
          type: boolean
          description: >-
            Whether the persistent store integration is fully synchronized with
            the LaunchDarkly environment, and the <code>lastSync</code> occurred
            within a few minutes
        potentiallyStale:
          type: boolean
          description: >-
            Whether the persistent store integration may not be fully
            synchronized with the LaunchDarkly environment. <code>true</code> if
            the integration could be stale.
        lastSync:
          $ref: '#/components/schemas/UnixMillis'
          description: >-
            Timestamp of when the most recent successful sync occurred between
            the persistent store integration and the LaunchDarkly environment.
        lastError:
          $ref: '#/components/schemas/UnixMillis'
          description: >-
            Timestamp of when the most recent synchronization error occurred, if
            any
        errors:
          type: array
          items:
            $ref: '#/components/schemas/StoreIntegrationError'
      title: BigSegmentStoreStatus
    BigSegmentStoreIntegration:
      type: object
      properties:
        _links:
          $ref: '#/components/schemas/BigSegmentStoreIntegrationLinks'
          description: The location and content type of related resources
        _id:
          type: string
          description: The integration ID
        integrationKey:
          $ref: '#/components/schemas/BigSegmentStoreIntegrationIntegrationKey'
          description: The integration key
        projectKey:
          type: string
          description: The project key
        environmentKey:
          type: string
          description: The environment key
        config:
          $ref: '#/components/schemas/FormVariableConfig'
          description: >-
            The delivery configuration for the given integration provider. Only
            included when requesting a single integration by ID. Refer to the
            <code>formVariables</code> field in the corresponding
            <code>manifest.json</code> for a full list of fields for each
            integration.
        'on':
          type: boolean
          description: Whether the configuration is turned on
        tags:
          type: array
          items:
            type: string
          description: List of tags for this configuration
        name:
          type: string
          description: Name of the configuration
        version:
          type: integer
          description: Version of the current configuration
        _access:
          $ref: '#/components/schemas/Access'
          description: Details on the allowed and denied actions for this configuration
        _status:
          $ref: '#/components/schemas/BigSegmentStoreStatus'
          description: Details on the connection status of the persistent store integration
      required:
        - _links
        - _id
        - integrationKey
        - projectKey
        - environmentKey
        - config
        - 'on'
        - tags
        - name
        - version
        - _status
      title: BigSegmentStoreIntegration
    InvalidRequestErrorRep:
      type: object
      properties:
        code:
          type: string
          description: Specific error code encountered
        message:
          type: string
          description: Description of the error
      required:
        - code
        - message
      title: InvalidRequestErrorRep
    UnauthorizedErrorRep:
      type: object
      properties:
        code:
          type: string
          description: Specific error code encountered
        message:
          type: string
          description: Description of the error
      required:
        - code
        - message
      title: UnauthorizedErrorRep
    ForbiddenErrorRep:
      type: object
      properties:
        code:
          type: string
          description: Specific error code encountered
        message:
          type: string
          description: Description of the error
      required:
        - code
        - message
      title: ForbiddenErrorRep
    NotFoundErrorRep:
      type: object
      properties:
        code:
          type: string
          description: Specific error code encountered
        message:
          type: string
          description: Description of the error
      required:
        - code
        - message
      title: NotFoundErrorRep
    StatusConflictErrorRep:
      type: object
      properties:
        code:
          type: string
          description: Specific error code encountered
        message:
          type: string
          description: Description of the error
      required:
        - code
        - message
      title: StatusConflictErrorRep
    RateLimitedErrorRep:
      type: object
      properties:
        code:
          type: string
          description: Specific error code encountered
        message:
          type: string
          description: Description of the error
      required:
        - code
        - message
      title: RateLimitedErrorRep
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: Authorization

```

## SDK Code Examples

```python
import requests

url = "https://app.launchdarkly.com/api/v2/integration-capabilities/big-segment-store/projectKey/environmentKey/integrationKey"

payload = {
    "config": {
        "optional": "example value for optional formVariables property for sample-integration",
        "required": "example value for required formVariables property for sample-integration"
    },
    "on": False,
    "tags": ["example-tag"],
    "name": "Example persistent store integration"
}
headers = {
    "Authorization": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://app.launchdarkly.com/api/v2/integration-capabilities/big-segment-store/projectKey/environmentKey/integrationKey';
const options = {
  method: 'POST',
  headers: {Authorization: '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"config":{"optional":"example value for optional formVariables property for sample-integration","required":"example value for required formVariables property for sample-integration"},"on":false,"tags":["example-tag"],"name":"Example persistent store integration"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://app.launchdarkly.com/api/v2/integration-capabilities/big-segment-store/projectKey/environmentKey/integrationKey"

	payload := strings.NewReader("{\n  \"config\": {\n    \"optional\": \"example value for optional formVariables property for sample-integration\",\n    \"required\": \"example value for required formVariables property for sample-integration\"\n  },\n  \"on\": false,\n  \"tags\": [\n    \"example-tag\"\n  ],\n  \"name\": \"Example persistent store integration\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://app.launchdarkly.com/api/v2/integration-capabilities/big-segment-store/projectKey/environmentKey/integrationKey")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"config\": {\n    \"optional\": \"example value for optional formVariables property for sample-integration\",\n    \"required\": \"example value for required formVariables property for sample-integration\"\n  },\n  \"on\": false,\n  \"tags\": [\n    \"example-tag\"\n  ],\n  \"name\": \"Example persistent store integration\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://app.launchdarkly.com/api/v2/integration-capabilities/big-segment-store/projectKey/environmentKey/integrationKey")
  .header("Authorization", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"config\": {\n    \"optional\": \"example value for optional formVariables property for sample-integration\",\n    \"required\": \"example value for required formVariables property for sample-integration\"\n  },\n  \"on\": false,\n  \"tags\": [\n    \"example-tag\"\n  ],\n  \"name\": \"Example persistent store integration\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://app.launchdarkly.com/api/v2/integration-capabilities/big-segment-store/projectKey/environmentKey/integrationKey', [
  'body' => '{
  "config": {
    "optional": "example value for optional formVariables property for sample-integration",
    "required": "example value for required formVariables property for sample-integration"
  },
  "on": false,
  "tags": [
    "example-tag"
  ],
  "name": "Example persistent store integration"
}',
  'headers' => [
    'Authorization' => '<apiKey>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://app.launchdarkly.com/api/v2/integration-capabilities/big-segment-store/projectKey/environmentKey/integrationKey");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"config\": {\n    \"optional\": \"example value for optional formVariables property for sample-integration\",\n    \"required\": \"example value for required formVariables property for sample-integration\"\n  },\n  \"on\": false,\n  \"tags\": [\n    \"example-tag\"\n  ],\n  \"name\": \"Example persistent store integration\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "config": [
    "optional": "example value for optional formVariables property for sample-integration",
    "required": "example value for required formVariables property for sample-integration"
  ],
  "on": false,
  "tags": ["example-tag"],
  "name": "Example persistent store integration"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://app.launchdarkly.com/api/v2/integration-capabilities/big-segment-store/projectKey/environmentKey/integrationKey")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```