Update Access Policy
Update an existing access policy. Fields left out of the request keep their current values. Set approval_procedure_id to attach a named approval procedure, or to an empty string to remove approval. The approval change and the other changes are saved together or not at all.
curl --request PUT \
--url https://public.api.serval.com/v2/access-policies/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>",
"maxAccessMinutes": 123,
"requireBusinessJustification": true,
"recommendedAccessMinutes": 123,
"requireOnBehalfOfConfirmation": true,
"scopedId": "<string>",
"approvalProcedureId": "<string>",
"requireFormConfirmation": true,
"approvalProcedure": {
"steps": [
{
"allowSelfApproval": true,
"approvers": [
{
"user": {
"id": "<string>"
},
"group": {
"id": "<string>"
},
"notify": true,
"channel": {
"slackChannelId": "<string>"
}
}
],
"customWorkflow": {
"id": "<string>",
"scopedId": "<string>"
},
"stageNumber": 123,
"groupRequirements": [
{
"group": {
"id": "<string>"
},
"minApprovals": 123
}
],
"approverJustificationMode": "<string>",
"channelRequirements": [
{
"channel": {
"slackChannelId": "<string>"
},
"minApprovals": 123
}
]
}
],
"timeoutSeconds": 3888150
}
}
'import requests
url = "https://public.api.serval.com/v2/access-policies/{id}"
payload = {
"name": "<string>",
"description": "<string>",
"maxAccessMinutes": 123,
"requireBusinessJustification": True,
"recommendedAccessMinutes": 123,
"requireOnBehalfOfConfirmation": True,
"scopedId": "<string>",
"approvalProcedureId": "<string>",
"requireFormConfirmation": True,
"approvalProcedure": {
"steps": [
{
"allowSelfApproval": True,
"approvers": [
{
"user": { "id": "<string>" },
"group": { "id": "<string>" },
"notify": True,
"channel": { "slackChannelId": "<string>" }
}
],
"customWorkflow": {
"id": "<string>",
"scopedId": "<string>"
},
"stageNumber": 123,
"groupRequirements": [
{
"group": { "id": "<string>" },
"minApprovals": 123
}
],
"approverJustificationMode": "<string>",
"channelRequirements": [
{
"channel": { "slackChannelId": "<string>" },
"minApprovals": 123
}
]
}
],
"timeoutSeconds": 3888150
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: '<string>',
maxAccessMinutes: 123,
requireBusinessJustification: true,
recommendedAccessMinutes: 123,
requireOnBehalfOfConfirmation: true,
scopedId: '<string>',
approvalProcedureId: '<string>',
requireFormConfirmation: true,
approvalProcedure: {
steps: [
{
allowSelfApproval: true,
approvers: [
{
user: {id: '<string>'},
group: {id: '<string>'},
notify: true,
channel: {slackChannelId: '<string>'}
}
],
customWorkflow: {id: '<string>', scopedId: '<string>'},
stageNumber: 123,
groupRequirements: [{group: {id: '<string>'}, minApprovals: 123}],
approverJustificationMode: '<string>',
channelRequirements: [{channel: {slackChannelId: '<string>'}, minApprovals: 123}]
}
],
timeoutSeconds: 3888150
}
})
};
fetch('https://public.api.serval.com/v2/access-policies/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://public.api.serval.com/v2/access-policies/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'description' => '<string>',
'maxAccessMinutes' => 123,
'requireBusinessJustification' => true,
'recommendedAccessMinutes' => 123,
'requireOnBehalfOfConfirmation' => true,
'scopedId' => '<string>',
'approvalProcedureId' => '<string>',
'requireFormConfirmation' => true,
'approvalProcedure' => [
'steps' => [
[
'allowSelfApproval' => true,
'approvers' => [
[
'user' => [
'id' => '<string>'
],
'group' => [
'id' => '<string>'
],
'notify' => true,
'channel' => [
'slackChannelId' => '<string>'
]
]
],
'customWorkflow' => [
'id' => '<string>',
'scopedId' => '<string>'
],
'stageNumber' => 123,
'groupRequirements' => [
[
'group' => [
'id' => '<string>'
],
'minApprovals' => 123
]
],
'approverJustificationMode' => '<string>',
'channelRequirements' => [
[
'channel' => [
'slackChannelId' => '<string>'
],
'minApprovals' => 123
]
]
]
],
'timeoutSeconds' => 3888150
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://public.api.serval.com/v2/access-policies/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"maxAccessMinutes\": 123,\n \"requireBusinessJustification\": true,\n \"recommendedAccessMinutes\": 123,\n \"requireOnBehalfOfConfirmation\": true,\n \"scopedId\": \"<string>\",\n \"approvalProcedureId\": \"<string>\",\n \"requireFormConfirmation\": true,\n \"approvalProcedure\": {\n \"steps\": [\n {\n \"allowSelfApproval\": true,\n \"approvers\": [\n {\n \"user\": {\n \"id\": \"<string>\"\n },\n \"group\": {\n \"id\": \"<string>\"\n },\n \"notify\": true,\n \"channel\": {\n \"slackChannelId\": \"<string>\"\n }\n }\n ],\n \"customWorkflow\": {\n \"id\": \"<string>\",\n \"scopedId\": \"<string>\"\n },\n \"stageNumber\": 123,\n \"groupRequirements\": [\n {\n \"group\": {\n \"id\": \"<string>\"\n },\n \"minApprovals\": 123\n }\n ],\n \"approverJustificationMode\": \"<string>\",\n \"channelRequirements\": [\n {\n \"channel\": {\n \"slackChannelId\": \"<string>\"\n },\n \"minApprovals\": 123\n }\n ]\n }\n ],\n \"timeoutSeconds\": 3888150\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://public.api.serval.com/v2/access-policies/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"maxAccessMinutes\": 123,\n \"requireBusinessJustification\": true,\n \"recommendedAccessMinutes\": 123,\n \"requireOnBehalfOfConfirmation\": true,\n \"scopedId\": \"<string>\",\n \"approvalProcedureId\": \"<string>\",\n \"requireFormConfirmation\": true,\n \"approvalProcedure\": {\n \"steps\": [\n {\n \"allowSelfApproval\": true,\n \"approvers\": [\n {\n \"user\": {\n \"id\": \"<string>\"\n },\n \"group\": {\n \"id\": \"<string>\"\n },\n \"notify\": true,\n \"channel\": {\n \"slackChannelId\": \"<string>\"\n }\n }\n ],\n \"customWorkflow\": {\n \"id\": \"<string>\",\n \"scopedId\": \"<string>\"\n },\n \"stageNumber\": 123,\n \"groupRequirements\": [\n {\n \"group\": {\n \"id\": \"<string>\"\n },\n \"minApprovals\": 123\n }\n ],\n \"approverJustificationMode\": \"<string>\",\n \"channelRequirements\": [\n {\n \"channel\": {\n \"slackChannelId\": \"<string>\"\n },\n \"minApprovals\": 123\n }\n ]\n }\n ],\n \"timeoutSeconds\": 3888150\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://public.api.serval.com/v2/access-policies/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"maxAccessMinutes\": 123,\n \"requireBusinessJustification\": true,\n \"recommendedAccessMinutes\": 123,\n \"requireOnBehalfOfConfirmation\": true,\n \"scopedId\": \"<string>\",\n \"approvalProcedureId\": \"<string>\",\n \"requireFormConfirmation\": true,\n \"approvalProcedure\": {\n \"steps\": [\n {\n \"allowSelfApproval\": true,\n \"approvers\": [\n {\n \"user\": {\n \"id\": \"<string>\"\n },\n \"group\": {\n \"id\": \"<string>\"\n },\n \"notify\": true,\n \"channel\": {\n \"slackChannelId\": \"<string>\"\n }\n }\n ],\n \"customWorkflow\": {\n \"id\": \"<string>\",\n \"scopedId\": \"<string>\"\n },\n \"stageNumber\": 123,\n \"groupRequirements\": [\n {\n \"group\": {\n \"id\": \"<string>\"\n },\n \"minApprovals\": 123\n }\n ],\n \"approverJustificationMode\": \"<string>\",\n \"channelRequirements\": [\n {\n \"channel\": {\n \"slackChannelId\": \"<string>\"\n },\n \"minApprovals\": 123\n }\n ]\n }\n ],\n \"timeoutSeconds\": 3888150\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"teamId": "<string>",
"name": "<string>",
"description": "<string>",
"maxAccessMinutes": 123,
"requireBusinessJustification": true,
"recommendedAccessMinutes": 123,
"requireOnBehalfOfConfirmation": true,
"scopedId": "<string>",
"approvalProcedureId": "<string>",
"requireFormConfirmation": true
}
}Authentication and permissions
Token requirements: User-based token (OAuth) or Organization-scoped API key or Workspace-scoped API key. Send a bearer access token for one of these identities. The permissions and resource restrictions below also apply.
| Credential | Access requirements |
|---|---|
| Organization-scoped API key | Default request, Remove the approval procedure, Add inline approval rules: settings:writeAttach an approval procedure: settings:read + settings:write |
| Workspace-scoped API key | Default request, Remove the approval procedure, Add inline approval rules: settings:writeAttach an approval procedure: settings:read + settings:write |
| User-based token (OAuth) | Supported, subject to permissions |
- Default request: Both approval fields are omitted, or non-empty approval_procedure replaces the policy’s existing approval. Custom workflows must belong to the policy’s workspace; user and group approvers must belong to its organization.
- Attach an approval procedure: With a non-empty approval_procedure_id, the procedure must be a named approval procedure in the policy’s workspace.
- Remove the approval procedure: An empty approval_procedure_id or an approval_procedure with no steps removes the policy’s approval. The two approval fields are mutually exclusive.
- Add inline approval rules: A non-empty approval_procedure adds approval to a policy that currently has no approval procedure.
Authorizations
Body
Replaces inline approval rules, mutually exclusive with approval_procedure_id. Omit both approval fields to leave approval unchanged; an empty step list without a timeout removes it. A timeout requires nonempty steps. Omitted timeout uses 30 days. Nonempty replacements of staged inline rules must supply stage_number on every step. Custom workflows must be live and deployed in the policy's workspace. Automatic self-approval is enabled; approval justification requirements still apply. Notifications are not suppressed. Use the Approval Procedure API for manual self-approval or muted notifications.
Show child attributes
Show child attributes
Was this page helpful?
curl --request PUT \
--url https://public.api.serval.com/v2/access-policies/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"description": "<string>",
"maxAccessMinutes": 123,
"requireBusinessJustification": true,
"recommendedAccessMinutes": 123,
"requireOnBehalfOfConfirmation": true,
"scopedId": "<string>",
"approvalProcedureId": "<string>",
"requireFormConfirmation": true,
"approvalProcedure": {
"steps": [
{
"allowSelfApproval": true,
"approvers": [
{
"user": {
"id": "<string>"
},
"group": {
"id": "<string>"
},
"notify": true,
"channel": {
"slackChannelId": "<string>"
}
}
],
"customWorkflow": {
"id": "<string>",
"scopedId": "<string>"
},
"stageNumber": 123,
"groupRequirements": [
{
"group": {
"id": "<string>"
},
"minApprovals": 123
}
],
"approverJustificationMode": "<string>",
"channelRequirements": [
{
"channel": {
"slackChannelId": "<string>"
},
"minApprovals": 123
}
]
}
],
"timeoutSeconds": 3888150
}
}
'import requests
url = "https://public.api.serval.com/v2/access-policies/{id}"
payload = {
"name": "<string>",
"description": "<string>",
"maxAccessMinutes": 123,
"requireBusinessJustification": True,
"recommendedAccessMinutes": 123,
"requireOnBehalfOfConfirmation": True,
"scopedId": "<string>",
"approvalProcedureId": "<string>",
"requireFormConfirmation": True,
"approvalProcedure": {
"steps": [
{
"allowSelfApproval": True,
"approvers": [
{
"user": { "id": "<string>" },
"group": { "id": "<string>" },
"notify": True,
"channel": { "slackChannelId": "<string>" }
}
],
"customWorkflow": {
"id": "<string>",
"scopedId": "<string>"
},
"stageNumber": 123,
"groupRequirements": [
{
"group": { "id": "<string>" },
"minApprovals": 123
}
],
"approverJustificationMode": "<string>",
"channelRequirements": [
{
"channel": { "slackChannelId": "<string>" },
"minApprovals": 123
}
]
}
],
"timeoutSeconds": 3888150
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
description: '<string>',
maxAccessMinutes: 123,
requireBusinessJustification: true,
recommendedAccessMinutes: 123,
requireOnBehalfOfConfirmation: true,
scopedId: '<string>',
approvalProcedureId: '<string>',
requireFormConfirmation: true,
approvalProcedure: {
steps: [
{
allowSelfApproval: true,
approvers: [
{
user: {id: '<string>'},
group: {id: '<string>'},
notify: true,
channel: {slackChannelId: '<string>'}
}
],
customWorkflow: {id: '<string>', scopedId: '<string>'},
stageNumber: 123,
groupRequirements: [{group: {id: '<string>'}, minApprovals: 123}],
approverJustificationMode: '<string>',
channelRequirements: [{channel: {slackChannelId: '<string>'}, minApprovals: 123}]
}
],
timeoutSeconds: 3888150
}
})
};
fetch('https://public.api.serval.com/v2/access-policies/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://public.api.serval.com/v2/access-policies/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'description' => '<string>',
'maxAccessMinutes' => 123,
'requireBusinessJustification' => true,
'recommendedAccessMinutes' => 123,
'requireOnBehalfOfConfirmation' => true,
'scopedId' => '<string>',
'approvalProcedureId' => '<string>',
'requireFormConfirmation' => true,
'approvalProcedure' => [
'steps' => [
[
'allowSelfApproval' => true,
'approvers' => [
[
'user' => [
'id' => '<string>'
],
'group' => [
'id' => '<string>'
],
'notify' => true,
'channel' => [
'slackChannelId' => '<string>'
]
]
],
'customWorkflow' => [
'id' => '<string>',
'scopedId' => '<string>'
],
'stageNumber' => 123,
'groupRequirements' => [
[
'group' => [
'id' => '<string>'
],
'minApprovals' => 123
]
],
'approverJustificationMode' => '<string>',
'channelRequirements' => [
[
'channel' => [
'slackChannelId' => '<string>'
],
'minApprovals' => 123
]
]
]
],
'timeoutSeconds' => 3888150
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://public.api.serval.com/v2/access-policies/{id}"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"maxAccessMinutes\": 123,\n \"requireBusinessJustification\": true,\n \"recommendedAccessMinutes\": 123,\n \"requireOnBehalfOfConfirmation\": true,\n \"scopedId\": \"<string>\",\n \"approvalProcedureId\": \"<string>\",\n \"requireFormConfirmation\": true,\n \"approvalProcedure\": {\n \"steps\": [\n {\n \"allowSelfApproval\": true,\n \"approvers\": [\n {\n \"user\": {\n \"id\": \"<string>\"\n },\n \"group\": {\n \"id\": \"<string>\"\n },\n \"notify\": true,\n \"channel\": {\n \"slackChannelId\": \"<string>\"\n }\n }\n ],\n \"customWorkflow\": {\n \"id\": \"<string>\",\n \"scopedId\": \"<string>\"\n },\n \"stageNumber\": 123,\n \"groupRequirements\": [\n {\n \"group\": {\n \"id\": \"<string>\"\n },\n \"minApprovals\": 123\n }\n ],\n \"approverJustificationMode\": \"<string>\",\n \"channelRequirements\": [\n {\n \"channel\": {\n \"slackChannelId\": \"<string>\"\n },\n \"minApprovals\": 123\n }\n ]\n }\n ],\n \"timeoutSeconds\": 3888150\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://public.api.serval.com/v2/access-policies/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"maxAccessMinutes\": 123,\n \"requireBusinessJustification\": true,\n \"recommendedAccessMinutes\": 123,\n \"requireOnBehalfOfConfirmation\": true,\n \"scopedId\": \"<string>\",\n \"approvalProcedureId\": \"<string>\",\n \"requireFormConfirmation\": true,\n \"approvalProcedure\": {\n \"steps\": [\n {\n \"allowSelfApproval\": true,\n \"approvers\": [\n {\n \"user\": {\n \"id\": \"<string>\"\n },\n \"group\": {\n \"id\": \"<string>\"\n },\n \"notify\": true,\n \"channel\": {\n \"slackChannelId\": \"<string>\"\n }\n }\n ],\n \"customWorkflow\": {\n \"id\": \"<string>\",\n \"scopedId\": \"<string>\"\n },\n \"stageNumber\": 123,\n \"groupRequirements\": [\n {\n \"group\": {\n \"id\": \"<string>\"\n },\n \"minApprovals\": 123\n }\n ],\n \"approverJustificationMode\": \"<string>\",\n \"channelRequirements\": [\n {\n \"channel\": {\n \"slackChannelId\": \"<string>\"\n },\n \"minApprovals\": 123\n }\n ]\n }\n ],\n \"timeoutSeconds\": 3888150\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://public.api.serval.com/v2/access-policies/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"maxAccessMinutes\": 123,\n \"requireBusinessJustification\": true,\n \"recommendedAccessMinutes\": 123,\n \"requireOnBehalfOfConfirmation\": true,\n \"scopedId\": \"<string>\",\n \"approvalProcedureId\": \"<string>\",\n \"requireFormConfirmation\": true,\n \"approvalProcedure\": {\n \"steps\": [\n {\n \"allowSelfApproval\": true,\n \"approvers\": [\n {\n \"user\": {\n \"id\": \"<string>\"\n },\n \"group\": {\n \"id\": \"<string>\"\n },\n \"notify\": true,\n \"channel\": {\n \"slackChannelId\": \"<string>\"\n }\n }\n ],\n \"customWorkflow\": {\n \"id\": \"<string>\",\n \"scopedId\": \"<string>\"\n },\n \"stageNumber\": 123,\n \"groupRequirements\": [\n {\n \"group\": {\n \"id\": \"<string>\"\n },\n \"minApprovals\": 123\n }\n ],\n \"approverJustificationMode\": \"<string>\",\n \"channelRequirements\": [\n {\n \"channel\": {\n \"slackChannelId\": \"<string>\"\n },\n \"minApprovals\": 123\n }\n ]\n }\n ],\n \"timeoutSeconds\": 3888150\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "<string>",
"teamId": "<string>",
"name": "<string>",
"description": "<string>",
"maxAccessMinutes": 123,
"requireBusinessJustification": true,
"recommendedAccessMinutes": 123,
"requireOnBehalfOfConfirmation": true,
"scopedId": "<string>",
"approvalProcedureId": "<string>",
"requireFormConfirmation": true
}
}
