> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.getdial.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.getdial.ai/_mcp/server.

# Update a policy

PATCH https://api.getdial.ai/api/v1/policies/{id}
Content-Type: application/json

Change any subset of a policy's fields. `entries`, when present, replaces the whole list of allowed callers; to add or remove a few, use Add policy entries and Remove policy entries instead. Changes apply to the next inbound call, never to one already in progress.

Reference: https://docs.getdial.ai/api-reference/rest-api/policies/update-policy

## Authentication

- `Authorization` header (bearer token, required) — Your Dial API key, sent as `Authorization: Bearer sk_live_...`

## Request

### Path parameters

- `id` (string, required)

### Body (application/json)

This endpoint expects an UpdatePolicyRequest.

- `name` (string, optional)
- `scope` (enum, optional)
  - Allowed values: `account`, `numbers`
- `numberIds` (list of string, optional) — Replaces the covered numbers. Required, and non-empty, when changing `scope` to `numbers`.
- `enabled` (boolean, optional)
- `entries` (list of PolicyEntry, optional) — Replaces the whole list of allowed callers.

## Response

### 200

The updated policy, with its entries.

- `policy` (Policy, optional)

## Errors

### 400 Bad Request Error

The request body failed validation.

- `error` (ErrorError, optional) — An error message, or a validation-error object for 400 responses.

### 401 Unauthorized Error

Missing or invalid API key.

- `error` (ErrorError, optional) — An error message, or a validation-error object for 400 responses.

### 404 Not Found Error

The requested resource was not found on this account.

- `error` (ErrorError, optional) — An error message, or a validation-error object for 400 responses.

### 409 Conflict Error

The policy would break one of the allow-list rules. Either the account already has an account-wide allow list (error code `account_policy_exists`), or a number in `numberIds` is already on another allow list of its own (error code `number_policy_conflict`). The message names the policy that holds it; edit or delete that one first.

- `error` (ErrorError, optional) — An error message, or a validation-error object for 400 responses.

## Types

### PolicyEntry

- `number` (string, required) — A caller allowed through, in E.164. On input, a number without a leading `+` is accepted only as 10 digits (or `1` followed by 10 digits) and read as a US number; anything else is refused with `400`.
- `label` (string, optional, nullable) — Who this caller is, for your own reference.

### Policy

- `id` (string, optional)
- `name` (string, optional)
- `type` (enum, optional) — The kind of policy. `allow_list` is the only type today.
  - Allowed values: `allow_list`
- `appliesTo` (enum, optional) — What the policy screens. `inbound_calls` is the only value today: outbound calls and messages are never affected.
  - Allowed values: `inbound_calls`
- `scope` (enum, optional) — `account` covers every number on the account, including numbers added later, except numbers that have an enabled allow list of their own. `numbers` covers only `numberIds`, and on those numbers it replaces the account-wide list.
  - Allowed values: `account`, `numbers`
- `numberIds` (list of string, optional) — The phone numbers a `numbers`-scoped policy covers. Always empty for `account` scope. Only numbers that can take calls can be added. A number can be on at most one policy of its own.
- `enabled` (boolean, optional) — Whether the policy is screening calls. A disabled policy counts as if it weren't there: its numbers fall back to the account-wide list, if there is one.
- `entryCount` (integer, optional) — How many callers are on the list.
- `entries` (list of PolicyEntry, optional) — The callers allowed through. Present on Get, Create and Update responses and on the entry endpoints; omitted from List.
- `blockedCallsLast7Days` (integer, optional) — Inbound calls this policy declined in the last 7 days. Each one is a call record with `status.terminationType` `blocked` and `blockedByPolicyId` set to this policy's `id`.
- `createdAt` (datetime, optional)
- `updatedAt` (datetime, optional) — Last change to the policy, including changes to its entries.

### ErrorError

An error message, or a validation-error object for 400 responses.

- string
- map from string to any

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "policy": {
    "id": "string",
    "name": "Known customers",
    "type": "allow_list",
    "appliesTo": "inbound_calls",
    "scope": "account",
    "numberIds": [
      "string"
    ],
    "enabled": true,
    "entryCount": 42,
    "entries": [
      {
        "number": "+14155550123",
        "label": "Jordan Lee"
      }
    ],
    "blockedCallsLast7Days": 19,
    "createdAt": "2024-01-15T09:30:00Z",
    "updatedAt": "2024-01-15T09:30:00Z"
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.getdial.ai/api/v1/policies/id"

payload = {}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.getdial.ai/api/v1/policies/id';
const options = {
  method: 'PATCH',
  headers: {Authorization: 'Bearer <token>', '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.getdial.ai/api/v1/policies/id"

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

	req, _ := http.NewRequest("PATCH", 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(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.getdial.ai/api/v1/policies/id")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
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.patch("https://api.getdial.ai/api/v1/policies/id")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api.getdial.ai/api/v1/policies/id', [
  'body' => '{}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.getdial.ai/api/v1/policies/id");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

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

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.getdial.ai/api/v1/policies/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()
```