Skip to content
This repository was archived by the owner on Feb 3, 2026. It is now read-only.

Latest commit

 

History

History
744 lines (519 loc) · 29.7 KB

File metadata and controls

744 lines (519 loc) · 29.7 KB

LaunchDarklyApi.ApprovalsApi

All URIs are relative to https://app.launchdarkly.com

Method HTTP request Description
deleteApprovalRequest DELETE /api/v2/approval-requests/{id} Delete approval request
deleteApprovalRequestForFlag DELETE /api/v2/projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/approval-requests/{id} Delete approval request for a flag
getApprovalForFlag GET /api/v2/projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/approval-requests/{id} Get approval request for a flag
getApprovalRequest GET /api/v2/approval-requests/{id} Get approval request
getApprovalRequests GET /api/v2/approval-requests List approval requests
getApprovalsForFlag GET /api/v2/projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/approval-requests List approval requests for a flag
postApprovalRequest POST /api/v2/approval-requests Create approval request
postApprovalRequestApply POST /api/v2/approval-requests/{id}/apply Apply approval request
postApprovalRequestApplyForFlag POST /api/v2/projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/approval-requests/{id}/apply Apply approval request for a flag
postApprovalRequestForFlag POST /api/v2/projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/approval-requests Create approval request for a flag
postApprovalRequestReview POST /api/v2/approval-requests/{id}/reviews Review approval request
postApprovalRequestReviewForFlag POST /api/v2/projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/approval-requests/{id}/reviews Review approval request for a flag
postFlagCopyConfigApprovalRequest POST /api/v2/projects/{projectKey}/flags/{featureFlagKey}/environments/{environmentKey}/approval-requests-flag-copy Create approval request to copy flag configurations across environments

deleteApprovalRequest

deleteApprovalRequest(id)

Delete approval request

Delete an approval request.

Example

import LaunchDarklyApi from 'launchdarkly-api';
let defaultClient = LaunchDarklyApi.ApiClient.instance;
// Configure API key authorization: ApiKey
let ApiKey = defaultClient.authentications['ApiKey'];
ApiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKey.apiKeyPrefix = 'Token';

let apiInstance = new LaunchDarklyApi.ApprovalsApi();
let id = "id_example"; // String | The approval request ID
apiInstance.deleteApprovalRequest(id, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
});

Parameters

Name Type Description Notes
id String The approval request ID

Return type

null (empty response body)

Authorization

ApiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

deleteApprovalRequestForFlag

deleteApprovalRequestForFlag(projectKey, featureFlagKey, environmentKey, id)

Delete approval request for a flag

Delete an approval request for a feature flag.

Example

import LaunchDarklyApi from 'launchdarkly-api';
let defaultClient = LaunchDarklyApi.ApiClient.instance;
// Configure API key authorization: ApiKey
let ApiKey = defaultClient.authentications['ApiKey'];
ApiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKey.apiKeyPrefix = 'Token';

let apiInstance = new LaunchDarklyApi.ApprovalsApi();
let projectKey = "projectKey_example"; // String | The project key
let featureFlagKey = "featureFlagKey_example"; // String | The feature flag key
let environmentKey = "environmentKey_example"; // String | The environment key
let id = "id_example"; // String | The feature flag approval request ID
apiInstance.deleteApprovalRequestForFlag(projectKey, featureFlagKey, environmentKey, id, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
});

Parameters

Name Type Description Notes
projectKey String The project key
featureFlagKey String The feature flag key
environmentKey String The environment key
id String The feature flag approval request ID

Return type

null (empty response body)

Authorization

ApiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

getApprovalForFlag

FlagConfigApprovalRequestResponse getApprovalForFlag(projectKey, featureFlagKey, environmentKey, id)

Get approval request for a flag

Get a single approval request for a feature flag.

Example

import LaunchDarklyApi from 'launchdarkly-api';
let defaultClient = LaunchDarklyApi.ApiClient.instance;
// Configure API key authorization: ApiKey
let ApiKey = defaultClient.authentications['ApiKey'];
ApiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKey.apiKeyPrefix = 'Token';

let apiInstance = new LaunchDarklyApi.ApprovalsApi();
let projectKey = "projectKey_example"; // String | The project key
let featureFlagKey = "featureFlagKey_example"; // String | The feature flag key
let environmentKey = "environmentKey_example"; // String | The environment key
let id = "id_example"; // String | The feature flag approval request ID
apiInstance.getApprovalForFlag(projectKey, featureFlagKey, environmentKey, id, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
projectKey String The project key
featureFlagKey String The feature flag key
environmentKey String The environment key
id String The feature flag approval request ID

Return type

FlagConfigApprovalRequestResponse

Authorization

ApiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

getApprovalRequest

ExpandableApprovalRequestResponse getApprovalRequest(id, opts)

Get approval request

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.

Example

import LaunchDarklyApi from 'launchdarkly-api';
let defaultClient = LaunchDarklyApi.ApiClient.instance;
// Configure API key authorization: ApiKey
let ApiKey = defaultClient.authentications['ApiKey'];
ApiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKey.apiKeyPrefix = 'Token';

let apiInstance = new LaunchDarklyApi.ApprovalsApi();
let id = "id_example"; // String | The approval request ID
let opts = {
  'expand': "expand_example" // String | A comma-separated list of fields to expand in the response. Supported fields are explained above.
};
apiInstance.getApprovalRequest(id, opts, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
id String The approval request ID
expand String A comma-separated list of fields to expand in the response. Supported fields are explained above. [optional]

Return type

ExpandableApprovalRequestResponse

Authorization

ApiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

getApprovalRequests

ExpandableApprovalRequestsResponse getApprovalRequests(opts)

List approval requests

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.

Example

import LaunchDarklyApi from 'launchdarkly-api';
let defaultClient = LaunchDarklyApi.ApiClient.instance;
// Configure API key authorization: ApiKey
let ApiKey = defaultClient.authentications['ApiKey'];
ApiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKey.apiKeyPrefix = 'Token';

let apiInstance = new LaunchDarklyApi.ApprovalsApi();
let opts = {
  'filter': "filter_example", // String | A comma-separated list of filters. Each filter is of the form `field operator value`. Supported fields are explained above.
  'expand': "expand_example", // String | A comma-separated list of fields to expand in the response. Supported fields are explained above.
  'limit': 789, // Number | The number of approvals to return. Defaults to 20. Maximum limit is 200.
  'offset': 789 // Number | Where to start in the list. Use this with pagination. For example, an offset of 10 skips the first ten items and then returns the next items in the list, up to the query `limit`.
};
apiInstance.getApprovalRequests(opts, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
filter String A comma-separated list of filters. Each filter is of the form `field operator value`. Supported fields are explained above. [optional]
expand String A comma-separated list of fields to expand in the response. Supported fields are explained above. [optional]
limit Number The number of approvals to return. Defaults to 20. Maximum limit is 200. [optional]
offset Number Where to start in the list. Use this with pagination. For example, an offset of 10 skips the first ten items and then returns the next items in the list, up to the query `limit`. [optional]

Return type

ExpandableApprovalRequestsResponse

Authorization

ApiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

getApprovalsForFlag

FlagConfigApprovalRequestsResponse getApprovalsForFlag(projectKey, featureFlagKey, environmentKey)

List approval requests for a flag

Get all approval requests for a feature flag.

Example

import LaunchDarklyApi from 'launchdarkly-api';
let defaultClient = LaunchDarklyApi.ApiClient.instance;
// Configure API key authorization: ApiKey
let ApiKey = defaultClient.authentications['ApiKey'];
ApiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKey.apiKeyPrefix = 'Token';

let apiInstance = new LaunchDarklyApi.ApprovalsApi();
let projectKey = "projectKey_example"; // String | The project key
let featureFlagKey = "featureFlagKey_example"; // String | The feature flag key
let environmentKey = "environmentKey_example"; // String | The environment key
apiInstance.getApprovalsForFlag(projectKey, featureFlagKey, environmentKey, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
projectKey String The project key
featureFlagKey String The feature flag key
environmentKey String The environment key

Return type

FlagConfigApprovalRequestsResponse

Authorization

ApiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

postApprovalRequest

ApprovalRequestResponse postApprovalRequest(createApprovalRequestRequest)

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`: - `addVariation` - `removeVariation` - `updateVariation` - `updateDefaultVariation` 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. ### AI Configs If you are creating an approval request for an AI Config, you can use the semantic patch instructions listed under Update AI Config targeting. ### Segments If you are creating an approval request for a segment, you can use the semantic patch instructions listed under Patch segment.

Example

import LaunchDarklyApi from 'launchdarkly-api';
let defaultClient = LaunchDarklyApi.ApiClient.instance;
// Configure API key authorization: ApiKey
let ApiKey = defaultClient.authentications['ApiKey'];
ApiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKey.apiKeyPrefix = 'Token';

let apiInstance = new LaunchDarklyApi.ApprovalsApi();
let createApprovalRequestRequest = new LaunchDarklyApi.CreateApprovalRequestRequest(); // CreateApprovalRequestRequest | 
apiInstance.postApprovalRequest(createApprovalRequestRequest, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
createApprovalRequestRequest CreateApprovalRequestRequest

Return type

ApprovalRequestResponse

Authorization

ApiKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

postApprovalRequestApply

ApprovalRequestResponse postApprovalRequestApply(id, postApprovalRequestApplyRequest)

Apply approval request

Apply an approval request that has been approved. This endpoint works with any approval requests.

Example

import LaunchDarklyApi from 'launchdarkly-api';
let defaultClient = LaunchDarklyApi.ApiClient.instance;
// Configure API key authorization: ApiKey
let ApiKey = defaultClient.authentications['ApiKey'];
ApiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKey.apiKeyPrefix = 'Token';

let apiInstance = new LaunchDarklyApi.ApprovalsApi();
let id = "id_example"; // String | The approval request ID
let postApprovalRequestApplyRequest = new LaunchDarklyApi.PostApprovalRequestApplyRequest(); // PostApprovalRequestApplyRequest | 
apiInstance.postApprovalRequestApply(id, postApprovalRequestApplyRequest, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
id String The approval request ID
postApprovalRequestApplyRequest PostApprovalRequestApplyRequest

Return type

ApprovalRequestResponse

Authorization

ApiKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

postApprovalRequestApplyForFlag

FlagConfigApprovalRequestResponse postApprovalRequestApplyForFlag(projectKey, featureFlagKey, environmentKey, id, postApprovalRequestApplyRequest)

Apply approval request for a flag

Apply an approval request that has been approved. This endpoint requires a feature flag key, and can only be used for applying approval requests on flags.

Example

import LaunchDarklyApi from 'launchdarkly-api';
let defaultClient = LaunchDarklyApi.ApiClient.instance;
// Configure API key authorization: ApiKey
let ApiKey = defaultClient.authentications['ApiKey'];
ApiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKey.apiKeyPrefix = 'Token';

let apiInstance = new LaunchDarklyApi.ApprovalsApi();
let projectKey = "projectKey_example"; // String | The project key
let featureFlagKey = "featureFlagKey_example"; // String | The feature flag key
let environmentKey = "environmentKey_example"; // String | The environment key
let id = "id_example"; // String | The feature flag approval request ID
let postApprovalRequestApplyRequest = new LaunchDarklyApi.PostApprovalRequestApplyRequest(); // PostApprovalRequestApplyRequest | 
apiInstance.postApprovalRequestApplyForFlag(projectKey, featureFlagKey, environmentKey, id, postApprovalRequestApplyRequest, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
projectKey String The project key
featureFlagKey String The feature flag key
environmentKey String The environment key
id String The feature flag approval request ID
postApprovalRequestApplyRequest PostApprovalRequestApplyRequest

Return type

FlagConfigApprovalRequestResponse

Authorization

ApiKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

postApprovalRequestForFlag

FlagConfigApprovalRequestResponse postApprovalRequestForFlag(projectKey, featureFlagKey, environmentKey, createFlagConfigApprovalRequestRequest)

Create approval request for a flag

Create an approval request for a feature flag.

Example

import LaunchDarklyApi from 'launchdarkly-api';
let defaultClient = LaunchDarklyApi.ApiClient.instance;
// Configure API key authorization: ApiKey
let ApiKey = defaultClient.authentications['ApiKey'];
ApiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKey.apiKeyPrefix = 'Token';

let apiInstance = new LaunchDarklyApi.ApprovalsApi();
let projectKey = "projectKey_example"; // String | The project key
let featureFlagKey = "featureFlagKey_example"; // String | The feature flag key
let environmentKey = "environmentKey_example"; // String | The environment key
let createFlagConfigApprovalRequestRequest = new LaunchDarklyApi.CreateFlagConfigApprovalRequestRequest(); // CreateFlagConfigApprovalRequestRequest | 
apiInstance.postApprovalRequestForFlag(projectKey, featureFlagKey, environmentKey, createFlagConfigApprovalRequestRequest, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
projectKey String The project key
featureFlagKey String The feature flag key
environmentKey String The environment key
createFlagConfigApprovalRequestRequest CreateFlagConfigApprovalRequestRequest

Return type

FlagConfigApprovalRequestResponse

Authorization

ApiKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

postApprovalRequestReview

ApprovalRequestResponse postApprovalRequestReview(id, postApprovalRequestReviewRequest)

Review approval request

Review an approval request by approving or denying changes.

Example

import LaunchDarklyApi from 'launchdarkly-api';
let defaultClient = LaunchDarklyApi.ApiClient.instance;
// Configure API key authorization: ApiKey
let ApiKey = defaultClient.authentications['ApiKey'];
ApiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKey.apiKeyPrefix = 'Token';

let apiInstance = new LaunchDarklyApi.ApprovalsApi();
let id = "id_example"; // String | The approval request ID
let postApprovalRequestReviewRequest = new LaunchDarklyApi.PostApprovalRequestReviewRequest(); // PostApprovalRequestReviewRequest | 
apiInstance.postApprovalRequestReview(id, postApprovalRequestReviewRequest, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
id String The approval request ID
postApprovalRequestReviewRequest PostApprovalRequestReviewRequest

Return type

ApprovalRequestResponse

Authorization

ApiKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

postApprovalRequestReviewForFlag

FlagConfigApprovalRequestResponse postApprovalRequestReviewForFlag(projectKey, featureFlagKey, environmentKey, id, postApprovalRequestReviewRequest)

Review approval request for a flag

Review an approval request by approving or denying changes.

Example

import LaunchDarklyApi from 'launchdarkly-api';
let defaultClient = LaunchDarklyApi.ApiClient.instance;
// Configure API key authorization: ApiKey
let ApiKey = defaultClient.authentications['ApiKey'];
ApiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKey.apiKeyPrefix = 'Token';

let apiInstance = new LaunchDarklyApi.ApprovalsApi();
let projectKey = "projectKey_example"; // String | The project key
let featureFlagKey = "featureFlagKey_example"; // String | The feature flag key
let environmentKey = "environmentKey_example"; // String | The environment key
let id = "id_example"; // String | The feature flag approval request ID
let postApprovalRequestReviewRequest = new LaunchDarklyApi.PostApprovalRequestReviewRequest(); // PostApprovalRequestReviewRequest | 
apiInstance.postApprovalRequestReviewForFlag(projectKey, featureFlagKey, environmentKey, id, postApprovalRequestReviewRequest, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
projectKey String The project key
featureFlagKey String The feature flag key
environmentKey String The environment key
id String The feature flag approval request ID
postApprovalRequestReviewRequest PostApprovalRequestReviewRequest

Return type

FlagConfigApprovalRequestResponse

Authorization

ApiKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

postFlagCopyConfigApprovalRequest

FlagConfigApprovalRequestResponse postFlagCopyConfigApprovalRequest(projectKey, featureFlagKey, environmentKey, createCopyFlagConfigApprovalRequestRequest)

Create approval request to copy flag configurations across environments

Create an approval request to copy a feature flag's configuration across environments.

Example

import LaunchDarklyApi from 'launchdarkly-api';
let defaultClient = LaunchDarklyApi.ApiClient.instance;
// Configure API key authorization: ApiKey
let ApiKey = defaultClient.authentications['ApiKey'];
ApiKey.apiKey = 'YOUR API KEY';
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//ApiKey.apiKeyPrefix = 'Token';

let apiInstance = new LaunchDarklyApi.ApprovalsApi();
let projectKey = "projectKey_example"; // String | The project key
let featureFlagKey = "featureFlagKey_example"; // String | The feature flag key
let environmentKey = "environmentKey_example"; // String | The environment key for the target environment
let createCopyFlagConfigApprovalRequestRequest = new LaunchDarklyApi.CreateCopyFlagConfigApprovalRequestRequest(); // CreateCopyFlagConfigApprovalRequestRequest | 
apiInstance.postFlagCopyConfigApprovalRequest(projectKey, featureFlagKey, environmentKey, createCopyFlagConfigApprovalRequestRequest, (error, data, response) => {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
});

Parameters

Name Type Description Notes
projectKey String The project key
featureFlagKey String The feature flag key
environmentKey String The environment key for the target environment
createCopyFlagConfigApprovalRequestRequest CreateCopyFlagConfigApprovalRequestRequest

Return type

FlagConfigApprovalRequestResponse

Authorization

ApiKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json