Create policy
curl --request POST \
--url https://api.truthlocks.com/v1/policies \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "<string>",
"rules": {
"rules": [
{
"id": "<string>",
"description": "<string>",
"conditions": [
{}
]
}
]
},
"description": "<string>",
"language": "json_rules"
}
'import requests
url = "https://api.truthlocks.com/v1/policies"
payload = {
"name": "<string>",
"rules": { "rules": [
{
"id": "<string>",
"description": "<string>",
"conditions": [{}]
}
] },
"description": "<string>",
"language": "json_rules"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
rules: {rules: [{id: '<string>', description: '<string>', conditions: [{}]}]},
description: '<string>',
language: 'json_rules'
})
};
fetch('https://api.truthlocks.com/v1/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.truthlocks.com/v1/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>',
'rules' => [
'rules' => [
[
'id' => '<string>',
'description' => '<string>',
'conditions' => [
[
]
]
]
]
],
'description' => '<string>',
'language' => 'json_rules'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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.truthlocks.com/v1/policies"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"rules\": {\n \"rules\": [\n {\n \"id\": \"<string>\",\n \"description\": \"<string>\",\n \"conditions\": [\n {}\n ]\n }\n ]\n },\n \"description\": \"<string>\",\n \"language\": \"json_rules\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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.truthlocks.com/v1/policies")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"rules\": {\n \"rules\": [\n {\n \"id\": \"<string>\",\n \"description\": \"<string>\",\n \"conditions\": [\n {}\n ]\n }\n ]\n },\n \"description\": \"<string>\",\n \"language\": \"json_rules\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.truthlocks.com/v1/policies")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"rules\": {\n \"rules\": [\n {\n \"id\": \"<string>\",\n \"description\": \"<string>\",\n \"conditions\": [\n {}\n ]\n }\n ]\n },\n \"description\": \"<string>\",\n \"language\": \"json_rules\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"name": "<string>",
"category": "<string>",
"status": "<string>",
"version": 123,
"created_at": "<string>"
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}Policies
Create policy
Create a new issuance policy with rules that control minting, verification, or proof-bundle export.
POST
/
v1
/
policies
Create policy
curl --request POST \
--url https://api.truthlocks.com/v1/policies \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"name": "<string>",
"rules": {
"rules": [
{
"id": "<string>",
"description": "<string>",
"conditions": [
{}
]
}
]
},
"description": "<string>",
"language": "json_rules"
}
'import requests
url = "https://api.truthlocks.com/v1/policies"
payload = {
"name": "<string>",
"rules": { "rules": [
{
"id": "<string>",
"description": "<string>",
"conditions": [{}]
}
] },
"description": "<string>",
"language": "json_rules"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: '<string>',
rules: {rules: [{id: '<string>', description: '<string>', conditions: [{}]}]},
description: '<string>',
language: 'json_rules'
})
};
fetch('https://api.truthlocks.com/v1/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.truthlocks.com/v1/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>',
'rules' => [
'rules' => [
[
'id' => '<string>',
'description' => '<string>',
'conditions' => [
[
]
]
]
]
],
'description' => '<string>',
'language' => 'json_rules'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$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.truthlocks.com/v1/policies"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"rules\": {\n \"rules\": [\n {\n \"id\": \"<string>\",\n \"description\": \"<string>\",\n \"conditions\": [\n {}\n ]\n }\n ]\n },\n \"description\": \"<string>\",\n \"language\": \"json_rules\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
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.truthlocks.com/v1/policies")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"<string>\",\n \"rules\": {\n \"rules\": [\n {\n \"id\": \"<string>\",\n \"description\": \"<string>\",\n \"conditions\": [\n {}\n ]\n }\n ]\n },\n \"description\": \"<string>\",\n \"language\": \"json_rules\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.truthlocks.com/v1/policies")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"<string>\",\n \"rules\": {\n \"rules\": [\n {\n \"id\": \"<string>\",\n \"description\": \"<string>\",\n \"conditions\": [\n {}\n ]\n }\n ]\n },\n \"description\": \"<string>\",\n \"language\": \"json_rules\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"name": "<string>",
"category": "<string>",
"status": "<string>",
"version": 123,
"created_at": "<string>"
}{
"code": "AUTH_REQUIRED",
"message": "Authentication required",
"http_status": 401
}Creates a policy for the authenticated tenant. Set
status to DRAFT to save without enforcing, or ACTIVE to begin enforcement immediately.
Each policy contains a set of rules evaluated in order. The first matching rule determines the outcome. If no rule matches, the default_effect applies.
See the issuance policies guide for a walkthrough of rule syntax, condition operators, and lifecycle management.
Parameters
string
required
A human-readable name for the policy (e.g., “US Issuers Only”).
string
required
The action this policy applies to:
MINT, VERIFY, or BUNDLE_EXPORT.string
required
Initial status:
DRAFT, ACTIVE, or DISABLED. Only ACTIVE policies are enforced.string
Optional description explaining the policy’s purpose.
string
Rule language. Use
json_rules for the built-in JSON rules engine.object
required
Responses
Authorizations
API key for machine-to-machine authentication
Body
application/json
Available options:
MINT, VERIFY, BUNDLE_EXPORT Available options:
DRAFT, ACTIVE, DISABLED Rule set with rules array and default_effect
Show child attributes
Show child attributes
⌘I

