---
id: policy-update
title: "Update a policy"
description: "Updates the conditions or selector of an existing policy."
sidebar_label: "Update a policy"
hide_title: true
hide_table_of_contents: true
api: eJztWGtvHLcV/SsXRD/Yxmi1tqW2GMAFZCVtlIcryBIcwBKEu+TdHcYccsyHpM1i/ntxydndWUm1nSZpgKJfRisOhzz33HMuHyuhKEivu6idFbW46BRGChAbAums0twewHkIZEhG58HNAS3QnQ5R2wV0zmi5nIhKuI48cv8TJWpR2uuUBxSViLgIon4vTnO7uKpEhx5biuS5fSU0z99hbEQlLLYkaqGVqESQDbUo6pWIyy632kgL8qKvhKePSXtSoo4+UXUvmPOG4OQrBszhbIHSHbadIVEf/vkvf+2vKhFIJq/jMuOYEXryRyk2on5/xa95FgrxtVNLhiGdjWQj/8SuM1rmoPd/Cjzp6iFeN/uJZBSV6DxTFDWFYZiB3sf67kZyBN++/ecbKG9B0Vxb5v5elpJV5OG20bKB2OgwhAwZJYWd0Bmn62gyxEbqOnQkJy21zi+vtb1ezLjTn0wkUR/0fc8sFQX8UrixwQgoYwAMgNB52ptrE8lP4KSkZqMt5SiAdRFajDkIggEgZNbvYjXKJegA4YPuOlJANmpPZgloFegYxrygpzwo3aBJGElNLu3f4NmzNy5S/ewZvONZpGtbsgpSYGbXiALMs/b9jZYUKo4gNrQENMbdwtIliA4i+gVFYAL1XMt1901D1keYXNp7CSjdJpl4rTLd9FHUL/pMd9SR+w1Geud1JFHeeAqds6HI6MV0yn8eKn9jR7jFACFJSSHMk2EZ/McS3hrufXGn9Xbt12os6av7ci8B3rPwQ+Ekqz8mAq04oXNNPifgU/4tGLZjh+i1XTwytKfgkpc7gz95c/bm6ZCoJSf+tiFPY409Zh7h/AKt/jmz9up5jVK6ZOOrFzUTETqU9OplPWL21QFXq1LVPgeUc8c9P1G3xLFfdtHBd84uIBdUJpktatLiS6i4OPt+b+41WWWWYzoUeX1DCubetWMSGM8E/kGWJUUKMEXXYtQSjVmCsyA95UB3YcoMc++Ds4u9bgwzYkzhy6iQyXuyEco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5raVMGgXKRcHUQZlbeGuOe6ZIYf1KA+rVelx7j6Q7fsNLZH/Z2b6/l+jndRp
sidebar_class_name: "patch api-method"
info_path: docs/api/approval
custom_edit_url: null
---

import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint";
import ParamsDetails from "@theme/ParamsDetails";
import RequestSchema from "@theme/RequestSchema";
import StatusCodes from "@theme/StatusCodes";
import OperationTabs from "@theme/OperationTabs";
import TabItem from "@theme/TabItem";
import Heading from "@theme/Heading";

<Heading
  as={"h1"}
  className={"openapi__heading"}
  children={"Update a policy"}
>
</Heading>

<MethodEndpoint
  method={"patch"}
  path={"/approval/policy/{id}"}
  context={"endpoint"}
>
  
</MethodEndpoint>



Updates the conditions or selector of an existing policy.

<Heading
  id={"request"}
  as={"h2"}
  className={"openapi-tabs__heading"}
  children={"Request"}
>
</Heading>

<ParamsDetails
  parameters={[{"in":"path","name":"id","schema":{"type":"integer"},"required":true,"description":"The ID of the policy.","example":5678}]}
>
  
</ParamsDetails>

<RequestSchema
  title={"Body"}
  body={{"content":{"application/json":{"schema":{"type":"object","properties":{"conditions":{"type":"object","description":"A JSON object defining the conditions under which this policy applies.","example":{"scope.requested_spec.memory_in_gb":{"$lte":4}}},"selector":{"type":"object","description":"A JSON object that acts as a pre-filter. If the selector does not match the request context, the policy is skipped entirely and its conditions are not evaluated.\n> **Note:** We recommend using selectors for services, as they allow you to target specific service specifications.\n","example":{"service.spec.id":{"$eq":2}}}},"title":"policyWrite"}}}}}
>
  
</RequestSchema>

<StatusCodes
  id={undefined}
  label={undefined}
  responses={{"200":{"description":"The operation was successful.","content":{"application/json":{"schema":{"type":"object","required":["id","nrn","name","conditions"],"properties":{"id":{"type":"integer","description":"A unique identifier for the policy.","example":5678},"nrn":{"type":"string","description":"A resource identifier (NRN) specifying where the policy applies.","example":"organization=1:account=2:namespace=3:application=4"},"name":{"type":"string","description":"The name of the policy.","example":"Crypto Kong Policies"},"slug":{"type":"string","description":"A URL-friendly identifier derived from the policy name. Generated automatically on creation.","example":"crypto-kong-policies"},"status":{"type":"string","description":"The current status of the policy.","enum":["active","deleted"],"example":"active"},"conditions":{"type":"object","description":"A JSON object defining the conditions under which this policy applies. Uses MongoDB query syntax.","example":{"scope.requested_spec.memory_in_gb":{"$lte":4}}},"selector":{"type":"object","description":"A JSON object that acts as a pre-filter. If the selector does not match the request context, the policy is skipped entirely and its conditions are not evaluated. Useful when multiple policies are attached to the same action and each should apply only to a specific subset of requests.\n","example":{"service.spec.id":{"$eq":2}}}},"title":"policy"}}}},"4XX":{"description":"Client error responses due to invalid input or missing parameters.","content":{"application/json":{"schema":{"type":"object","required":["statusCode","error","message"],"properties":{"statusCode":{"type":"integer","description":"HTTP status code representing the specific client error (e.g., 400, 401, 403, 404).","example":400},"code":{"type":"string","description":"A machine-readable error code that categorizes the server failure.","example":"bad_request"},"error":{"type":"string","description":"A brief, human-readable description of the error type (e.g., \"Bad Request\", \"Unauthorized\").","example":"Bad Request"},"message":{"type":"string","description":"Additional details about the error.","example":"The request was malformed or contained invalid parameters."}}}}}},"5XX":{"description":"Server error responses indicating an issue on the API side.","content":{"application/json":{"schema":{"type":"object","required":["statusCode","error","message"],"properties":{"statusCode":{"type":"integer","description":"HTTP status code representing the specific server error (e.g., 500, 502, 503).","example":500},"code":{"type":"string","description":"A machine-readable error code that categorizes the server failure.","example":"internal_server_error"},"error":{"type":"string","description":"A brief, human-readable description of the error type (e.g., \"Internal Server Error\", \"Service Unavailable\").","example":"Internal Server Error"},"message":{"type":"string","description":"Additional details about the error.","example":"An unexpected error occurred. Please try again later."}}}}}}}}
>
  
</StatusCodes>


      