Skip to main content
POST
/
orgs
/
{org_id}
/
k2
/
{kb_id}
/
policies
cURL
curl --request POST \
  --url https://api.timbal.ai/orgs/{org_id}/k2/{kb_id}/policies \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "row_filter_dsl": {},
  "break_glass_allowed": true,
  "column_masks": {},
  "compliance_tags": [
    "<string>"
  ],
  "description": "<string>",
  "enabled": true,
  "external_id": "<string>",
  "labels": {},
  "purpose_tags": [
    "<string>"
  ],
  "table_name": "<string>"
}
'
import requests

url = "https://api.timbal.ai/orgs/{org_id}/k2/{kb_id}/policies"

payload = {
"name": "<string>",
"row_filter_dsl": {},
"break_glass_allowed": True,
"column_masks": {},
"compliance_tags": ["<string>"],
"description": "<string>",
"enabled": True,
"external_id": "<string>",
"labels": {},
"purpose_tags": ["<string>"],
"table_name": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

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

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
row_filter_dsl: {},
break_glass_allowed: true,
column_masks: {},
compliance_tags: ['<string>'],
description: '<string>',
enabled: true,
external_id: '<string>',
labels: {},
purpose_tags: ['<string>'],
table_name: '<string>'
})
};

fetch('https://api.timbal.ai/orgs/{org_id}/k2/{kb_id}/policies', 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://api.timbal.ai/orgs/{org_id}/k2/{kb_id}/policies",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'row_filter_dsl' => [

],
'break_glass_allowed' => true,
'column_masks' => [

],
'compliance_tags' => [
'<string>'
],
'description' => '<string>',
'enabled' => true,
'external_id' => '<string>',
'labels' => [

],
'purpose_tags' => [
'<string>'
],
'table_name' => '<string>'
]),
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://api.timbal.ai/orgs/{org_id}/k2/{kb_id}/policies"

payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"row_filter_dsl\": {},\n \"break_glass_allowed\": true,\n \"column_masks\": {},\n \"compliance_tags\": [\n \"<string>\"\n ],\n \"description\": \"<string>\",\n \"enabled\": true,\n \"external_id\": \"<string>\",\n \"labels\": {},\n \"purpose_tags\": [\n \"<string>\"\n ],\n \"table_name\": \"<string>\"\n}")

req, _ := http.NewRequest("POST", 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.post("https://api.timbal.ai/orgs/{org_id}/k2/{kb_id}/policies")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"row_filter_dsl\": {},\n \"break_glass_allowed\": true,\n \"column_masks\": {},\n \"compliance_tags\": [\n \"<string>\"\n ],\n \"description\": \"<string>\",\n \"enabled\": true,\n \"external_id\": \"<string>\",\n \"labels\": {},\n \"purpose_tags\": [\n \"<string>\"\n ],\n \"table_name\": \"<string>\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.timbal.ai/orgs/{org_id}/k2/{kb_id}/policies")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"row_filter_dsl\": {},\n \"break_glass_allowed\": true,\n \"column_masks\": {},\n \"compliance_tags\": [\n \"<string>\"\n ],\n \"description\": \"<string>\",\n \"enabled\": true,\n \"external_id\": \"<string>\",\n \"labels\": {},\n \"purpose_tags\": [\n \"<string>\"\n ],\n \"table_name\": \"<string>\"\n}"

response = http.request(request)
puts response.read_body
{
  "break_glass_allowed": true,
  "compliance_tags": [
    "<string>"
  ],
  "created_at": "2023-11-07T05:31:56Z",
  "enabled": true,
  "id": "<string>",
  "kb_id": "<string>",
  "labels": {},
  "name": "<string>",
  "purpose_tags": [
    "<string>"
  ],
  "revision": 123,
  "row_filter_dsl": {},
  "updated_at": "2023-11-07T05:31:56Z",
  "column_masks": {},
  "description": "<string>",
  "external_id": "<string>",
  "table_name": "<string>"
}
{
"code": "<string>",
"message": "<string>"
}

Authorizations

Authorization
string
header
required

Timbal API key. Obtain your API key from the Timbal platform settings. See Authentication for more information.

Path Parameters

org_id
string
required
kb_id
string
required

Body

application/json
name
string
required

Operator-facing label.

row_filter_dsl
object
required

Row predicate JSON. Stored opaquely in this release.

audit_level
enum<string>

Audit verbosity for matches against this rule.

Available options:
none,
normal,
verbose
break_glass_allowed
boolean
column_masks
null | object
compliance_tags
string[]
description
string | null
enabled
boolean

Defaults to true; set false to author the rule in a draft state.

external_id
string | null
labels
object

Free-form key/value labels.

purpose_tags
string[]
source
enum<string>

Provenance of the rule.

Available options:
manual,
imported,
derived
table_name
string | null

Target table within the knowledge base. Omit to apply to every table.

Response

Policy created

audit_level
enum<string>
required

Audit verbosity for matches against this rule.

Available options:
none,
normal,
verbose
break_glass_allowed
boolean
required

Whether sessions may bypass the rule via a logged escalation.

compliance_tags
string[]
required

Compliance classifications (e.g. hipaa.phi, pci.pan).

created_at
string<date-time>
required
enabled
boolean
required

When false, the rule body is inactive everywhere it is bound.

id
string
required
kb_id
string
required
labels
object
required

Free-form key/value labels.

name
string
required

Operator-facing label.

purpose_tags
string[]
required

Purpose-of-use bindings (e.g. treatment, research).

revision
integer<int32>
required

Revision token for optimistic concurrency on update and delete.

row_filter_dsl
object
required

Row predicate authored as JSON. Stored opaquely in this release.

source
enum<string>
required

Provenance of the rule.

Available options:
manual,
imported,
derived
updated_at
string<date-time>
required
column_masks
null | object

Per-column transformation map. Null means no masks. {"col": {"type":"redact"}} is the canonical "hide this column".

description
string | null
external_id
string | null
table_name
string | null

Target table within the knowledge base. Null applies to every table.