# Review approval request

POST https://app.launchdarkly.com/api/v2/approval-requests/{id}/reviews
Content-Type: application/json

Review an approval request by approving or denying changes.

Reference: https://launchdarkly.com/docs/api/approvals/post-approval-request-review

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: LaunchDarkly REST API
  version: 1.0.0
paths:
  /api/v2/approval-requests/{id}/reviews:
    post:
      operationId: post-approval-request-review
      summary: Review approval request
      description: Review an approval request by approving or denying changes.
      tags:
        - subpackage_approvals
      parameters:
        - name: id
          in: path
          description: The approval request ID
          required: true
          schema:
            type: string
            format: string
        - name: Authorization
          in: header
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Approval request review response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApprovalRequestResponse'
        '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'
        '404':
          description: Invalid resource identifier
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundErrorRep'
        '405':
          description: Method not allowed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MethodNotAllowedErrorRep'
        '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/postApprovalRequestReviewRequest'
servers:
  - url: https://app.launchdarkly.com
  - url: https://app.launchdarkly.us
components:
  schemas:
    PostApprovalRequestReviewRequestKind:
      type: string
      enum:
        - approve
        - comment
        - decline
      description: The type of review for this approval request
      title: PostApprovalRequestReviewRequestKind
    postApprovalRequestReviewRequest:
      type: object
      properties:
        kind:
          $ref: '#/components/schemas/PostApprovalRequestReviewRequestKind'
          description: The type of review for this approval request
        comment:
          type: string
          description: Optional comment about the approval request
      title: postApprovalRequestReviewRequest
    UnixMillis:
      type: integer
      format: int64
      title: UnixMillis
    ApprovalRequestServiceKind:
      type: string
      title: ApprovalRequestServiceKind
    ApprovalRequestResponseReviewStatus:
      type: string
      enum:
        - approved
        - declined
        - pending
      description: Current status of the review of this approval request
      title: ApprovalRequestResponseReviewStatus
    ReviewResponseKind:
      type: string
      enum:
        - approve
        - decline
        - comment
      description: The type of review action to take
      title: ReviewResponseKind
    ReviewResponse:
      type: object
      properties:
        _id:
          type: string
          description: The approval request ID
        kind:
          $ref: '#/components/schemas/ReviewResponseKind'
          description: The type of review action to take
        creationDate:
          $ref: '#/components/schemas/UnixMillis'
          description: Timestamp of when the request was created
        comment:
          type: string
          description: A comment describing the approval response
        memberId:
          type: string
          description: ID of account member that reviewed request
        serviceTokenId:
          type: string
          description: ID of account service token that reviewed request
      required:
        - _id
        - kind
      title: ReviewResponse
    ApprovalRequestResponseStatus:
      type: string
      enum:
        - pending
        - completed
        - failed
        - scheduled
      description: Current status of the approval request
      title: ApprovalRequestResponseStatus
    Instruction:
      type: object
      additionalProperties:
        description: Any type
      title: Instruction
    Instructions:
      type: array
      items:
        $ref: '#/components/schemas/Instruction'
      title: Instructions
    Conflict:
      type: object
      properties:
        instruction:
          $ref: '#/components/schemas/Instruction'
          description: >-
            Instruction in semantic patch format to be applied to the feature
            flag
        reason:
          type: string
          description: Reason why the conflict exists
      title: Conflict
    IntegrationStatus:
      type: object
      properties:
        display:
          type: string
        value:
          type: string
      required:
        - display
        - value
      title: IntegrationStatus
    IntegrationMetadata:
      type: object
      properties:
        externalId:
          type: string
        externalStatus:
          $ref: '#/components/schemas/IntegrationStatus'
        externalUrl:
          type: string
        lastChecked:
          $ref: '#/components/schemas/UnixMillis'
      required:
        - externalId
        - externalStatus
        - externalUrl
        - lastChecked
      title: IntegrationMetadata
    CopiedFromEnv:
      type: object
      properties:
        key:
          type: string
          description: Key of feature flag copied
        version:
          type: integer
          description: Version of feature flag copied
      required:
        - key
      title: CopiedFromEnv
    CustomWorkflowStageMeta:
      type: object
      properties:
        index:
          type: integer
          description: The zero-based index of the workflow stage
        name:
          type: string
          description: The name of the workflow stage
      title: CustomWorkflowStageMeta
    CustomWorkflowMeta:
      type: object
      properties:
        name:
          type: string
          description: The name of the workflow stage that required this approval request
        stage:
          $ref: '#/components/schemas/CustomWorkflowStageMeta'
          description: >-
            Details on the stage of the workflow where this approval request is
            required
      title: CustomWorkflowMeta
    ApprovalSettings:
      type: object
      properties:
        required:
          type: boolean
          description: If approvals are required for this environment
        bypassApprovalsForPendingChanges:
          type: boolean
          description: Whether to skip approvals for pending changes
        minNumApprovals:
          type: integer
          description: >-
            Sets the amount of approvals required before a member can apply a
            change. The minimum is one and the maximum is five.
        canReviewOwnRequest:
          type: boolean
          description: >-
            Allow someone who makes an approval request to apply their own
            change
        canApplyDeclinedChanges:
          type: boolean
          description: >-
            Allow applying the change as long as at least one person has
            approved
        autoApplyApprovedChanges:
          type: boolean
          description: >-
            Automatically apply changes that have been approved by all
            reviewers. This field is only applicable for approval services other
            than LaunchDarkly.
        serviceKind:
          type: string
          description: Which service to use for managing approvals
        serviceConfig:
          type: object
          additionalProperties:
            description: Any type
        requiredApprovalTags:
          type: array
          items:
            type: string
          description: >-
            Require approval only on flags with the provided tags. Otherwise all
            flags will require approval.
        serviceKindConfigurationId:
          type: string
          description: >-
            Optional field for integration configuration ID of a custom approval
            integration. This is an Enterprise-only feature.
      required:
        - required
        - bypassApprovalsForPendingChanges
        - minNumApprovals
        - canReviewOwnRequest
        - canApplyDeclinedChanges
        - serviceKind
        - serviceConfig
        - requiredApprovalTags
      title: ApprovalSettings
    ApprovalRequestResponse:
      type: object
      properties:
        _id:
          type: string
          description: The ID of this approval request
        _version:
          type: integer
          description: Version of the approval request
        creationDate:
          $ref: '#/components/schemas/UnixMillis'
          description: Timestamp of when the approval request was created
        serviceKind:
          $ref: '#/components/schemas/ApprovalRequestServiceKind'
          description: >-
            The approval service for this request. May be LaunchDarkly or an
            external approval service, such as ServiceNow or JIRA.
        requestorId:
          type: string
          description: The ID of the member who requested the approval
        description:
          type: string
          description: A human-friendly name for the approval request
        reviewStatus:
          $ref: '#/components/schemas/ApprovalRequestResponseReviewStatus'
          description: Current status of the review of this approval request
        allReviews:
          type: array
          items:
            $ref: '#/components/schemas/ReviewResponse'
          description: An array of individual reviews of this approval request
        notifyMemberIds:
          type: array
          items:
            type: string
          description: >-
            An array of member IDs. These members are notified to review the
            approval request.
        appliedDate:
          $ref: '#/components/schemas/UnixMillis'
          description: Timestamp of when the approval request was applied
        appliedByMemberId:
          type: string
          description: The member ID of the member who applied the approval request
        appliedByServiceTokenId:
          type: string
          description: >-
            The service token ID of the service token which applied the approval
            request
        status:
          $ref: '#/components/schemas/ApprovalRequestResponseStatus'
          description: Current status of the approval request
        instructions:
          $ref: '#/components/schemas/Instructions'
          description: >-
            List of instructions in semantic patch format to be applied to the
            feature flag
        conflicts:
          type: array
          items:
            $ref: '#/components/schemas/Conflict'
          description: Details on any conflicting approval requests
        _links:
          type: object
          additionalProperties:
            description: Any type
          description: The location and content type of related resources
        executionDate:
          $ref: '#/components/schemas/UnixMillis'
          description: Timestamp for when instructions will be executed
        operatingOnId:
          type: string
          description: ID of scheduled change to edit or delete
        integrationMetadata:
          $ref: '#/components/schemas/IntegrationMetadata'
          description: >-
            Details about the object in an external service corresponding to
            this approval request, such as a ServiceNow change request or a JIRA
            ticket, if an external approval service is being used
        source:
          $ref: '#/components/schemas/CopiedFromEnv'
          description: Details about the source feature flag, if copied
        customWorkflowMetadata:
          $ref: '#/components/schemas/CustomWorkflowMeta'
          description: >-
            Details about the custom workflow, if this approval request is part
            of a custom workflow
        resourceId:
          type: string
          description: String representation of a resource
        approvalSettings:
          $ref: '#/components/schemas/ApprovalSettings'
          description: The settings for this approval
      required:
        - _id
        - _version
        - creationDate
        - serviceKind
        - reviewStatus
        - allReviews
        - notifyMemberIds
        - status
        - instructions
        - conflicts
        - _links
      title: ApprovalRequestResponse
    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
    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
    MethodNotAllowedErrorRep:
      type: object
      properties:
        code:
          type: string
          description: Specific error code encountered
        message:
          type: string
          description: Description of the error
      required:
        - code
        - message
      title: MethodNotAllowedErrorRep
    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/approval-requests/id/reviews"

payload = {}
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/approval-requests/id/reviews';
const options = {
  method: 'POST',
  headers: {Authorization: '<apiKey>', 'Content-Type': 'application/json'},
  body: '{}'
};

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/approval-requests/id/reviews"

	payload := strings.NewReader("{}")

	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/approval-requests/id/reviews")

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 = "{}"

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/approval-requests/id/reviews")
  .header("Authorization", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://app.launchdarkly.com/api/v2/approval-requests/id/reviews', [
  'body' => '{}',
  'headers' => [
    'Authorization' => '<apiKey>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://app.launchdarkly.com/api/v2/approval-requests/id/reviews");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://app.launchdarkly.com/api/v2/approval-requests/id/reviews")! 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()
```