Create approval request
Create an approval request.
This endpoint requires a list of instructions, in semantic patch format, that will be applied when the approval request is approved and applied.
Flags
If you are creating an approval request for a flag, you can use the following instructions:
addVariationremoveVariationupdateVariationupdateDefaultVariation
For details on using these instructions, read Update feature flag.
To create an approval for a flag specific to an environment, use Create approval request for a flag.
AgentControl
If you are creating an approval request for an AgentControl config, you can use the semantic patch instructions listed under Update config targeting.
Segments
If you are creating an approval request for a segment, you can use the semantic patch instructions listed under Patch segment.
Authorization
ApiKey read, writeIn: header
Scope: read, write
Request Body
application/json
String representation of the resource specifier
Optional comment describing the approval request
A brief description of the changes you're requesting
List of instructions in semantic patch format to be applied to the feature flag. Review the Update feature flag documentation for details on available instructions.
An array of member IDs. These members are notified to review the approval request.
An array of team keys. The members of these teams are notified to review the approval request.
Additional approval request fields for third-party integration approval systems. If you are using a third-party integration to manage approval requests, these additional fields will be described in the manifest.json for that integration, at https://github.com/launchdarkly/integration-framework.
Response Body
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/api/v2/approval-requests" \ -H "Content-Type: application/json" \ -d '{ "resourceId": "proj/projKey:env/envKey:flag/flagKey", "description": "Requesting to update targeting", "instructions": "[{\\"kind\\": \\"addUserTargets\\", \\"values\\": [ \\"user-key-123abc\\"], \\"variationId\\": \\"ce67d625-a8b9-4fb5-a344-ab909d9d4f4d\\" }]" }'{ "_id": "12ab3c45de678910abc12345", "_version": 1, "creationDate": "1654104600000", "serviceKind": "launchdarkly", "requestorId": "12ab3c45de678910abc12345", "description": "example: request approval from someone", "reviewStatus": "pending", "allReviews": [ { "_id": "12ab3c45de678910abc12345", "kind": "approve", "creationDate": "1653606981113", "comment": "Approved!", "memberId": "12ab3c45de678910abc12345", "serviceTokenId": "12ab3c45de678910abc12345" } ], "notifyMemberIds": [ "1234a56b7c89d012345e678f" ], "notifyTeamKeys": [ "example-reviewer-team" ], "appliedDate": "1654104600000", "appliedByMemberId": "1234a56b7c89d012345e678f", "appliedByServiceTokenId": "1234a56b7c89d012345e678f", "status": "pending", "instructions": "[{\"kind\": \"turnFlagOn\"}]", "conflicts": [ { "instruction": { "property1": null, "property2": null }, "reason": "string" } ], "_links": { "property1": null, "property2": null }, "executionDate": "1654104600000", "operatingOnId": "12ab3c45de678910abc12345", "integrationMetadata": { "externalId": "string", "externalStatus": { "display": "string", "value": "string" }, "externalUrl": "string", "lastChecked": 0 }, "source": { "key": "source-flag-key-123abc", "version": 1 }, "customWorkflowMetadata": { "name": "Example workflow name", "stage": { "index": 0, "name": "Stage 1" } }, "resourceId": "string", "approvalSettings": { "required": true, "bypassApprovalsForPendingChanges": false, "minNumApprovals": 1, "canReviewOwnRequest": false, "canApplyDeclinedChanges": true, "autoApplyApprovedChanges": true, "serviceKind": "launchdarkly", "serviceConfig": {}, "requiredApprovalTags": [ "require-approval" ], "serviceKindConfigurationId": "1ef45a85-218f-4428-a8b2-a97e5f56c258" }}List approval requests GET
Get all approval requests. ### Filtering approvals LaunchDarkly supports the `filter` query param for filtering, with the following fields: - `notifyMemberIds` filters for only approvals that are assigned to a member in the specified list. For example: `filter=notifyMemberIds anyOf ["memberId1", "memberId2"]`. - `requestorId` filters for only approvals that correspond to the ID of the member who requested the approval. For example: `filter=requestorId equals 457034721476302714390214`. - `resourceId` filters for only approvals that correspond to the the specified resource identifier. For example: `filter=resourceId equals proj/my-project:env/my-environment:flag/my-flag`. - `resourceKind` filters for only approvals that correspond to the specified resource kind. For example: `filter=resourceKind equals flag`. Currently, `flag`, `segment`, and `aiConfig` resource kinds are supported. - `reviewStatus` filters for only approvals which correspond to the review status in the specified list. The possible values are `approved`, `declined`, and `pending`. For example: `filter=reviewStatus anyOf ["pending", "approved"]`. - `status` filters for only approvals which correspond to the status in the specified list. The possible values are `pending`, `scheduled`, `failed`, and `completed`. For example: `filter=status anyOf ["pending", "scheduled"]`. You can also apply multiple filters at once. For example, setting `filter=projectKey equals my-project, reviewStatus anyOf ["pending","approved"]` matches approval requests which correspond to the `my-project` project key, and a review status of either `pending` or `approved`. ### Expanding approval response LaunchDarkly supports the `expand` query param to include additional fields in the response, with the following fields: - `flag` includes the flag the approval request belongs to - `project` includes the project the approval request belongs to - `environments` includes the environments the approval request relates to For example, `expand=project,flag` includes the `project` and `flag` fields in the response.
Get approval request GET
Get an approval request by approval request ID. ### Expanding approval response LaunchDarkly supports the `expand` query param to include additional fields in the response, with the following fields: - `environments` includes the environments the approval request relates to - `flag` includes the flag the approval request belongs to - `project` includes the project the approval request belongs to - `resource` includes details on the resource (flag or segment) the approval request relates to For example, `expand=project,flag` includes the `project` and `flag` fields in the response.