Skip to main content
POST
/
api
/
v2
/
projects
/
{projectKey}
/
release-policies
Create a release policy
curl --request POST \
  --url https://app.launchdarkly.com/api/v2/projects/{projectKey}/release-policies \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --header 'LD-API-Version: <ld-api-version>' \
  --data '
{
  "releaseMethod": "guarded-release",
  "scope": {
    "environmentKeys": [
      "production",
      "staging"
    ],
    "flagTagKeys": [
      "frontend",
      "backend"
    ],
    "viewKeys": [
      "feature-a",
      "team-a"
    ]
  },
  "progressiveReleaseConfig": {
    "rolloutContextKindKey": "user",
    "stages": [
      {
        "allocation": 25000,
        "durationMillis": 60000
      },
      {
        "allocation": 25000,
        "durationMillis": 60000
      }
    ]
  },
  "name": "Production Release",
  "guardedReleaseConfig": {
    "metricKeys": [
      "http-errors",
      "latency"
    ],
    "rolloutContextKindKey": "user",
    "metricGroupKeys": [
      "frontend-metrics",
      "backend-metrics"
    ],
    "minSampleSize": 100,
    "stages": [
      {
        "allocation": 25000,
        "durationMillis": 60000
      },
      {
        "allocation": 25000,
        "durationMillis": 60000
      }
    ],
    "rollbackOnRegression": true
  },
  "key": "production-release"
}
'
{
  "releaseMethod": "guarded-release",
  "_access": {
    "allowed": [
      {
        "reason": {
          "role_name": "role_name",
          "notActions": [
            null,
            null
          ],
          "notResources": [
            "notResources",
            "notResources"
          ],
          "effect": "allow",
          "resources": [
            "proj/*:env/*;qa_*:/flag/*"
          ],
          "actions": [
            "*"
          ]
        },
        "action": "action"
      },
      {
        "reason": {
          "role_name": "role_name",
          "notActions": [
            null,
            null
          ],
          "notResources": [
            "notResources",
            "notResources"
          ],
          "effect": "allow",
          "resources": [
            "proj/*:env/*;qa_*:/flag/*"
          ],
          "actions": [
            "*"
          ]
        },
        "action": "action"
      }
    ],
    "denied": [
      {
        "reason": {
          "role_name": "role_name",
          "notActions": [
            null,
            null
          ],
          "notResources": [
            "notResources",
            "notResources"
          ],
          "effect": "allow",
          "resources": [
            "proj/*:env/*;qa_*:/flag/*"
          ],
          "actions": [
            "*"
          ]
        },
        "action": "action"
      },
      {
        "reason": {
          "role_name": "role_name",
          "notActions": [
            null,
            null
          ],
          "notResources": [
            "notResources",
            "notResources"
          ],
          "effect": "allow",
          "resources": [
            "proj/*:env/*;qa_*:/flag/*"
          ],
          "actions": [
            "*"
          ]
        },
        "action": "action"
      }
    ]
  },
  "scope": {
    "environmentKeys": [
      "production",
      "staging"
    ],
    "flagTagKeys": [
      "frontend",
      "backend"
    ],
    "viewKeys": [
      "feature-a",
      "team-a"
    ]
  },
  "progressiveReleaseConfig": {
    "rolloutContextKindKey": "user",
    "stages": [
      {
        "allocation": 25000,
        "durationMillis": 60000
      },
      {
        "allocation": 25000,
        "durationMillis": 60000
      }
    ]
  },
  "name": "Production Release",
  "rank": 1,
  "_id": "550e8400-e29b-41d4-a716-446655440000",
  "guardedReleaseConfig": {
    "metricKeys": [
      "http-errors",
      "latency"
    ],
    "rolloutContextKindKey": "user",
    "metricGroupKeys": [
      "frontend-metrics",
      "backend-metrics"
    ],
    "minSampleSize": 100,
    "stages": [
      {
        "allocation": 25000,
        "durationMillis": 60000
      },
      {
        "allocation": 25000,
        "durationMillis": 60000
      }
    ],
    "rollbackOnRegression": true
  },
  "key": "production-release"
}

Documentation Index

Fetch the complete documentation index at: https://launchdarkly-preview.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Authorizations

Authorization
string
header
required

Headers

LD-API-Version
enum<string>
required

Version of the endpoint.

Available options:
beta

Path Parameters

projectKey
string
required

The project key

Body

application/json

Release policy to create

releaseMethod
enum<string>
required

The release method for this policy

Available options:
guarded-release,
progressive-release
name
string
required

The name of the release policy

Maximum string length: 256
Example:

"Production Release"

key
string
required

The human-readable key of the release policy

Example:

"production-release"

scope
object
Example:
{
"environmentKeys": ["production", "staging"],
"flagTagKeys": ["frontend", "backend"],
"viewKeys": ["feature-a", "team-a"]
}
guardedReleaseConfig
object

Configuration for guarded releases

Example:
{
"metricKeys": ["http-errors", "latency"],
"rolloutContextKindKey": "user",
"metricGroupKeys": ["frontend-metrics", "backend-metrics"],
"minSampleSize": 100,
"stages": [
{
"allocation": 25000,
"durationMillis": 60000
},
{
"allocation": 25000,
"durationMillis": 60000
}
],
"rollbackOnRegression": true
}
progressiveReleaseConfig
object

Configuration for progressive releases

Example:
{
"rolloutContextKindKey": "user",
"stages": [
{
"allocation": 25000,
"durationMillis": 60000
},
{
"allocation": 25000,
"durationMillis": 60000
}
]
}

Response

Release policy created successfully

_id
string
required

The unique identifier of the release policy

Example:

"550e8400-e29b-41d4-a716-446655440000"

rank
integer
required

The rank/priority of the release policy

Example:

1

releaseMethod
enum<string>
required

The release method for this policy

Available options:
guarded-release,
progressive-release
name
string
required

The name of the release policy

Maximum string length: 256
Example:

"Production Release"

key
string
required

The human-readable key of the release policy

Example:

"production-release"

_access
object
Example:
{
"allowed": [
{
"reason": {
"role_name": "role_name",
"notActions": [null, null],
"notResources": ["notResources", "notResources"],
"effect": "allow",
"resources": ["proj/*:env/*;qa_*:/flag/*"],
"actions": ["*"]
},
"action": "action"
},
{
"reason": {
"role_name": "role_name",
"notActions": [null, null],
"notResources": ["notResources", "notResources"],
"effect": "allow",
"resources": ["proj/*:env/*;qa_*:/flag/*"],
"actions": ["*"]
},
"action": "action"
}
],
"denied": [
{
"reason": {
"role_name": "role_name",
"notActions": [null, null],
"notResources": ["notResources", "notResources"],
"effect": "allow",
"resources": ["proj/*:env/*;qa_*:/flag/*"],
"actions": ["*"]
},
"action": "action"
},
{
"reason": {
"role_name": "role_name",
"notActions": [null, null],
"notResources": ["notResources", "notResources"],
"effect": "allow",
"resources": ["proj/*:env/*;qa_*:/flag/*"],
"actions": ["*"]
},
"action": "action"
}
]
}
scope
object
Example:
{
"environmentKeys": ["production", "staging"],
"flagTagKeys": ["frontend", "backend"],
"viewKeys": ["feature-a", "team-a"]
}
guardedReleaseConfig
object

Configuration for guarded releases

Example:
{
"metricKeys": ["http-errors", "latency"],
"rolloutContextKindKey": "user",
"metricGroupKeys": ["frontend-metrics", "backend-metrics"],
"minSampleSize": 100,
"stages": [
{
"allocation": 25000,
"durationMillis": 60000
},
{
"allocation": 25000,
"durationMillis": 60000
}
],
"rollbackOnRegression": true
}
progressiveReleaseConfig
object

Configuration for progressive releases

Example:
{
"rolloutContextKindKey": "user",
"stages": [
{
"allocation": 25000,
"durationMillis": 60000
},
{
"allocation": 25000,
"durationMillis": 60000
}
]
}