> Call POST /v1/check before a tool that writes. DENY means do not invoke the tool. For clean Markdown of any page, append .md to the page URL. For the complete index, fetch https://docs.withwrit.com/llms.txt.

# Update verb modes for this tenant

PUT https://api.withwrit.com/v1/policy
Content-Type: application/json

API key required. Sets the decision mode for one or more verbs in
the caller's tenant default policy. Send either a bare map
(`{"refund": "deny"}`) or wrapped as `{"policy": {"refund": "deny"}}`
— both are accepted. Keys named `tenantId`, `modes`, `verbs`, or
`policy` are ignored if they leak in from a GET response. Every verb
must be a known verb and every mode a known mode, otherwise the whole
update is rejected with the offending values listed. Every successful
update bumps the policy's `version` by one. Custom verbs count as
known verbs from the moment they are created with POST /v1/verbs —
deprecated verbs (renamed aliases and retired verbs) are rejected,
with the offending values listed. The response is the tenant's
**full** updated policy, not just what you sent.

Reference: https://docs.withwrit.com/api-reference/policy/update-verb-modes-for-this-tenant

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Servers

- `https://api.withwrit.com` (Writ gate, default)
- `https://j72ckh66ukck2kcbq3oiwxaalm0olxwb.lambda-url.us-east-1.on.aws` (Direct Lambda Function URL (fallback))

## Request

### Body (application/json)

This endpoint expects a map from string to enum.

- `map from string to enum`
  - Allowed values: `allow`, `deny`, `require_grant`, `step_up`

## Response

### 200

The tenant's full updated policy.

## Errors

### 400 Bad Request Error

Empty body, unknown verbs, or unknown modes. The response lists what was invalid plus the valid sets.

### 401 Unauthorized Error

API key required — missing, malformed, or unknown key.

- `any`

## Examples

### Policy_updateVerbModesForThisTenant_example

**Response**

```json
{
  "policy": {
    "admit": "require_grant",
    "prescribe": "require_grant",
    "provision": "require_grant",
    "refund": "deny",
    "verify": "require_grant",
    "verify_human": "require_grant"
  },
  "policyId": "pol_ten_3fa8b91c2d44_tenant",
  "scope": "tenant",
  "tenantId": "ten_3fa8b91c2d44",
  "version": 4
}
```

**SDK Code**

```python Policy_updateVerbModesForThisTenant_example
import requests

url = "https://api.withwrit.com/v1/policy"

headers = {"Authorization": "Bearer <token>"}

response = requests.put(url, headers=headers)

print(response.json())
```

```javascript Policy_updateVerbModesForThisTenant_example
const url = 'https://api.withwrit.com/v1/policy';
const options = {method: 'PUT', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Policy_updateVerbModesForThisTenant_example
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.withwrit.com/v1/policy"

	req, _ := http.NewRequest("PUT", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

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

url = URI("https://api.withwrit.com/v1/policy")

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

request = Net::HTTP::Put.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java Policy_updateVerbModesForThisTenant_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://api.withwrit.com/v1/policy")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.withwrit.com/v1/policy', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp Policy_updateVerbModesForThisTenant_example
using RestSharp;

var client = new RestClient("https://api.withwrit.com/v1/policy");
var request = new RestRequest(Method.PUT);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift Policy_updateVerbModesForThisTenant_example
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.withwrit.com/v1/policy")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers

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()
```

### bare

**Request**

```json
{
  "refund": "deny"
}
```

**Response**

```json
{
  "policy": {
    "admit": "require_grant",
    "prescribe": "require_grant",
    "provision": "require_grant",
    "refund": "deny",
    "verify": "require_grant",
    "verify_human": "require_grant"
  },
  "policyId": "pol_ten_3fa8b91c2d44_tenant",
  "scope": "tenant",
  "tenantId": "ten_3fa8b91c2d44",
  "version": 4
}
```

**SDK Code**

```python bare
import requests

url = "https://api.withwrit.com/v1/policy"

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

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

print(response.json())
```

```javascript bare
const url = 'https://api.withwrit.com/v1/policy';
const options = {
  method: 'PUT',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"refund":"deny"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go bare
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.withwrit.com/v1/policy"

	payload := strings.NewReader("{\n  \"refund\": \"deny\"\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(res)
	fmt.Println(string(body))

}
```

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

url = URI("https://api.withwrit.com/v1/policy")

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  \"refund\": \"deny\"\n}"

response = http.request(request)
puts response.read_body
```

```java bare
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://api.withwrit.com/v1/policy")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"refund\": \"deny\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.withwrit.com/v1/policy', [
  'body' => '{
  "refund": "deny"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp bare
using RestSharp;

var client = new RestClient("https://api.withwrit.com/v1/policy");
var request = new RestRequest(Method.PUT);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"refund\": \"deny\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift bare
import Foundation

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

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.withwrit.com/v1/policy")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
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()
```

### wrapped

**Request**

```json
{
  "policy": {
    "admit": "require_grant",
    "refund": "step_up"
  }
}
```

**Response**

```json
{
  "policy": {
    "admit": "require_grant",
    "prescribe": "require_grant",
    "provision": "require_grant",
    "refund": "deny",
    "verify": "require_grant",
    "verify_human": "require_grant"
  },
  "policyId": "pol_ten_3fa8b91c2d44_tenant",
  "scope": "tenant",
  "tenantId": "ten_3fa8b91c2d44",
  "version": 4
}
```

**SDK Code**

```python wrapped
import requests

url = "https://api.withwrit.com/v1/policy"

payload = { "policy": {
        "admit": "require_grant",
        "refund": "step_up"
    } }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript wrapped
const url = 'https://api.withwrit.com/v1/policy';
const options = {
  method: 'PUT',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"policy":{"admit":"require_grant","refund":"step_up"}}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go wrapped
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.withwrit.com/v1/policy"

	payload := strings.NewReader("{\n  \"policy\": {\n    \"admit\": \"require_grant\",\n    \"refund\": \"step_up\"\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(res)
	fmt.Println(string(body))

}
```

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

url = URI("https://api.withwrit.com/v1/policy")

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  \"policy\": {\n    \"admit\": \"require_grant\",\n    \"refund\": \"step_up\"\n  }\n}"

response = http.request(request)
puts response.read_body
```

```java wrapped
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://api.withwrit.com/v1/policy")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"policy\": {\n    \"admit\": \"require_grant\",\n    \"refund\": \"step_up\"\n  }\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.withwrit.com/v1/policy', [
  'body' => '{
  "policy": {
    "admit": "require_grant",
    "refund": "step_up"
  }
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp wrapped
using RestSharp;

var client = new RestClient("https://api.withwrit.com/v1/policy");
var request = new RestRequest(Method.PUT);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"policy\": {\n    \"admit\": \"require_grant\",\n    \"refund\": \"step_up\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift wrapped
import Foundation

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

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.withwrit.com/v1/policy")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
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()
```