> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.monite.com/v2023-09-01/api/approval-policies/patch-approval-policies-id/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.monite.com/_mcp/server. # Update an approval policy PATCH https://api.sandbox.monite.com/v1/approval_policies/{approval_policy_id} Content-Type: application/json Update an existing approval policy. Reference: https://docs.monite.com/api/approval-policies/patch-approval-policies-id ## Authentication - `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer `, where token is your auth token. ## Servers - `https://api.sandbox.monite.com/v1` (sandbox, default) - `https://api.monite.com/v1` (eu_production) - `https://us.api.monite.com/v1` (na_production) ## Request ### Path parameters - `approval_policy_id` (string, required) ### Headers - `x-monite-version` (string, required) - `x-monite-entity-id` (string, required) — The ID of the entity that owns the requested resource. ### Body (application/json) This endpoint expects an object. - `description` (string, optional) — A brief description of the approval policy. - `ends_at` (datetime, optional) — The date and time (in the ISO 8601 format) when the approval policy stops being active and stops triggering approval workflows.If `ends_at` is provided in the request, then `starts_at` must also be provided and `ends_at` must be later than `starts_at`. The value will be converted to UTC. - `name` (string, optional) — The name of the approval policy. - `priority` (integer, optional) — The priority controls which approval policy takes precedence when a payable matches multiple approval policies. A higher value mean higher priority. - `script` (list of ApprovalPolicyUpdateScriptItem, optional) — A list of JSON objects that represents the approval policy script. The script contains the logic that determines whether an action should be sent to approval. This field is required, and it should contain at least one script object. - `starts_at` (datetime, optional) — The date and time (in the ISO 8601 format) when the approval policy becomes active. Only payables submitted for approval during the policy's active period will trigger this policy. If omitted or `null`, the policy is effective immediately. The value will be converted to UTC. - `status` (enum, optional) — A string that represents the current status of the approval policy. - Allowed values: `active`, `deleted`, `pending` - `trigger` (ApprovalPolicyUpdateTrigger, optional) — A JSON object that represents the trigger for the approval policy. The trigger specifies the event that will trigger the policy to be evaluated. ## Response ### 200 Successful Response - `id` (string, required) - `created_at` (datetime, required) - `updated_at` (datetime, required) - `created_by` (string, required) - `name` (string, required) — The name of the approval policy. - `script` (list of ApprovalPolicyResourceScriptItem, required) — A list of JSON objects that represents the approval policy script. The script contains the logic that determines whether an action should be sent to approval. This field is required, and it should contain at least one script object. - `status` (enum, required) — The current status of the approval policy. - Allowed values: `active`, `pending` - `description` (string, optional) — A brief description of the approval policy. - `ends_at` (datetime, optional) — The date and time (in the ISO 8601 format) when the approval policy stops being active and stops triggering approval workflows.If `ends_at` is provided in the request, then `starts_at` must also be provided and `ends_at` must be later than `starts_at`. The value will be converted to UTC. - `priority` (integer, optional, default: 0) — The priority controls which approval policy takes precedence when a payable matches multiple approval policies. A higher value mean higher priority. - `starts_at` (datetime, optional) — The date and time (in the ISO 8601 format) when the approval policy becomes active. Only payables submitted for approval during the policy's active period will trigger this policy. If omitted or `null`, the policy is effective immediately. The value will be converted to UTC. - `trigger` (ApprovalPolicyResourceTrigger, optional) — A JSON object that represents the trigger for the approval policy. The trigger specifies the event that will trigger the policy to be evaluated. - `updated_by` (string, optional) ## Errors ### 400 Patch Approval Policies ID Request Bad Request Error Possible responses: `Script validation error: {errors}.` - `error` (ErrorSchema, required) ### 401 Patch Approval Policies ID Request Unauthorized Error Unauthorized - `error` (ErrorSchema, required) ### 404 Patch Approval Policies ID Request Not Found Error Not Found - `error` (ErrorSchema, required) ### 409 Patch Approval Policies ID Request Conflict Error Conflict - `error` (ErrorSchema, required) ### 422 Patch Approval Policies ID Request Unprocessable Entity Error Validation Error - `detail` (list of ValidationError, optional) ### 500 Patch Approval Policies ID Request Internal Server Error Internal Server Error - `error` (ErrorSchema, required) ## Types ### ApprovalPolicyUpdateScriptItem ### ApprovalPolicyUpdateTrigger A JSON object that represents the trigger for the approval policy. The trigger specifies the event that will trigger the policy to be evaluated. ### ApprovalPolicyResourceScriptItem ### ApprovalPolicyResourceTrigger A JSON object that represents the trigger for the approval policy. The trigger specifies the event that will trigger the policy to be evaluated. ### ErrorSchema - `message` (string, required) ### ValidationError - `loc` (list of ValidationErrorLocItem, required) - `msg` (string, required) - `type` (string, required) ### ValidationErrorLocItem ## Examples **Request** ```json {} ``` **Response** ```json { "id": "id", "created_at": "2024-01-15T09:30:00Z", "updated_at": "2024-01-15T09:30:00Z", "created_by": "created_by", "name": "name", "script": [ true ], "status": "active", "description": "description", "ends_at": "2024-01-15T09:30:00Z", "priority": 1, "starts_at": "2024-01-15T09:30:00Z", "trigger": true, "updated_by": "updated_by" } ``` **SDK Code** ```python import requests url = "https://api.sandbox.monite.com/v1/approval_policies/approval_policy_id" payload = {} headers = { "x-monite-version": "2023-09-01", "x-monite-entity-id": "9d2b4c8f-2087-4738-ba91-7359683c49a4", "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.patch(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.sandbox.monite.com/v1/approval_policies/approval_policy_id'; const options = { method: 'PATCH', headers: { 'x-monite-version': '2023-09-01', 'x-monite-entity-id': '9d2b4c8f-2087-4738-ba91-7359683c49a4', Authorization: 'Bearer ', '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://api.sandbox.monite.com/v1/approval_policies/approval_policy_id" payload := strings.NewReader("{}") req, _ := http.NewRequest("PATCH", url, payload) req.Header.Add("x-monite-version", "2023-09-01") req.Header.Add("x-monite-entity-id", "9d2b4c8f-2087-4738-ba91-7359683c49a4") req.Header.Add("Authorization", "Bearer ") 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://api.sandbox.monite.com/v1/approval_policies/approval_policy_id") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Patch.new(url) request["x-monite-version"] = '2023-09-01' request["x-monite-entity-id"] = '9d2b4c8f-2087-4738-ba91-7359683c49a4' request["Authorization"] = 'Bearer ' 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 response = Unirest.patch("https://api.sandbox.monite.com/v1/approval_policies/approval_policy_id") .header("x-monite-version", "2023-09-01") .header("x-monite-entity-id", "9d2b4c8f-2087-4738-ba91-7359683c49a4") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{}") .asString(); ``` ```php request('PATCH', 'https://api.sandbox.monite.com/v1/approval_policies/approval_policy_id', [ 'body' => '{}', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', 'x-monite-entity-id' => '9d2b4c8f-2087-4738-ba91-7359683c49a4', 'x-monite-version' => '2023-09-01', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.sandbox.monite.com/v1/approval_policies/approval_policy_id"); var request = new RestRequest(Method.PATCH); request.AddHeader("x-monite-version", "2023-09-01"); request.AddHeader("x-monite-entity-id", "9d2b4c8f-2087-4738-ba91-7359683c49a4"); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "x-monite-version": "2023-09-01", "x-monite-entity-id": "9d2b4c8f-2087-4738-ba91-7359683c49a4", "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = [] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.sandbox.monite.com/v1/approval_policies/approval_policy_id")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "PATCH" 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() ```