Search and filter policy components
curl --request POST \
--url https://api.draftt.io/v1/policy/{policyId}/component/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"filter": {
"technology": "mongodb",
"tags": [
{
"key": "environment",
"value": "development"
}
],
"dueDate": {
"gte": "2024-12-22T13:47:25.036Z",
"lt": "2025-12-31T00:00:00.000Z"
}
},
"sort": {
"createdAt": "asc"
},
"nextToken": "eyJza2lwIjoxMH0",
"pageSize": 10
}
'import requests
url = "https://api.draftt.io/v1/policy/{policyId}/component/search"
payload = {
"filter": {
"technology": "mongodb",
"tags": [
{
"key": "environment",
"value": "development"
}
],
"dueDate": {
"gte": "2024-12-22T13:47:25.036Z",
"lt": "2025-12-31T00:00:00.000Z"
}
},
"sort": { "createdAt": "asc" },
"nextToken": "eyJza2lwIjoxMH0",
"pageSize": 10
}
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({
filter: {
technology: 'mongodb',
tags: [{key: 'environment', value: 'development'}],
dueDate: {gte: '2024-12-22T13:47:25.036Z', lt: '2025-12-31T00:00:00.000Z'}
},
sort: {createdAt: 'asc'},
nextToken: 'eyJza2lwIjoxMH0',
pageSize: 10
})
};
fetch('https://api.draftt.io/v1/policy/{policyId}/component/search', 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.draftt.io/v1/policy/{policyId}/component/search",
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([
'filter' => [
'technology' => 'mongodb',
'tags' => [
[
'key' => 'environment',
'value' => 'development'
]
],
'dueDate' => [
'gte' => '2024-12-22T13:47:25.036Z',
'lt' => '2025-12-31T00:00:00.000Z'
]
],
'sort' => [
'createdAt' => 'asc'
],
'nextToken' => 'eyJza2lwIjoxMH0',
'pageSize' => 10
]),
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.draftt.io/v1/policy/{policyId}/component/search"
payload := strings.NewReader("{\n \"filter\": {\n \"technology\": \"mongodb\",\n \"tags\": [\n {\n \"key\": \"environment\",\n \"value\": \"development\"\n }\n ],\n \"dueDate\": {\n \"gte\": \"2024-12-22T13:47:25.036Z\",\n \"lt\": \"2025-12-31T00:00:00.000Z\"\n }\n },\n \"sort\": {\n \"createdAt\": \"asc\"\n },\n \"nextToken\": \"eyJza2lwIjoxMH0\",\n \"pageSize\": 10\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.draftt.io/v1/policy/{policyId}/component/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"filter\": {\n \"technology\": \"mongodb\",\n \"tags\": [\n {\n \"key\": \"environment\",\n \"value\": \"development\"\n }\n ],\n \"dueDate\": {\n \"gte\": \"2024-12-22T13:47:25.036Z\",\n \"lt\": \"2025-12-31T00:00:00.000Z\"\n }\n },\n \"sort\": {\n \"createdAt\": \"asc\"\n },\n \"nextToken\": \"eyJza2lwIjoxMH0\",\n \"pageSize\": 10\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.draftt.io/v1/policy/{policyId}/component/search")
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 \"filter\": {\n \"technology\": \"mongodb\",\n \"tags\": [\n {\n \"key\": \"environment\",\n \"value\": \"development\"\n }\n ],\n \"dueDate\": {\n \"gte\": \"2024-12-22T13:47:25.036Z\",\n \"lt\": \"2025-12-31T00:00:00.000Z\"\n }\n },\n \"sort\": {\n \"createdAt\": \"asc\"\n },\n \"nextToken\": \"eyJza2lwIjoxMH0\",\n \"pageSize\": 10\n}"
response = http.request(request)
puts response.read_body{
"items": [
{
"id": 22,
"componentId": 3,
"integrationId": 6,
"technology": "rds",
"type": "rds-postgres",
"typeDisplayName": "Amazon RDS PostgreSQL",
"name": "dev-1-rds",
"uniqueIdentifier": "arn:aws:rds:us-east-1:125422356123:db:dev-1-rds",
"urgency": 17.39,
"priority": 17.39,
"isCompliant": true,
"currentVersion": "14.10",
"requiredVersion": "14.11",
"recommendedVersion": "14.11",
"dueDate": "2025-12-22T00:00:00.000Z",
"tags": [
{
"key": "Terraform",
"value": "true"
},
{
"key": "Environment",
"value": "dev-us-east-1"
},
{
"key": "Name",
"value": "dev-1-rds"
}
],
"createdAt": "2024-05-06T11:25:51.513Z",
"updatedAt": "2024-01-06T11:25:51.513Z"
}
],
"nextToken": "<string>",
"totalCount": 12
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}Policy Component
Search and filter policy components
deprecated
Deprecated as of: 2026-06-04. Scheduled for removal: 2026-09-04. Replacement: POST /policy//component/query. Please migrate to the DrafttQL query endpoint for advanced filtering, field selection, and cursor-based pagination.
POST
/
policy
/
{policyId}
/
component
/
search
Search and filter policy components
curl --request POST \
--url https://api.draftt.io/v1/policy/{policyId}/component/search \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"filter": {
"technology": "mongodb",
"tags": [
{
"key": "environment",
"value": "development"
}
],
"dueDate": {
"gte": "2024-12-22T13:47:25.036Z",
"lt": "2025-12-31T00:00:00.000Z"
}
},
"sort": {
"createdAt": "asc"
},
"nextToken": "eyJza2lwIjoxMH0",
"pageSize": 10
}
'import requests
url = "https://api.draftt.io/v1/policy/{policyId}/component/search"
payload = {
"filter": {
"technology": "mongodb",
"tags": [
{
"key": "environment",
"value": "development"
}
],
"dueDate": {
"gte": "2024-12-22T13:47:25.036Z",
"lt": "2025-12-31T00:00:00.000Z"
}
},
"sort": { "createdAt": "asc" },
"nextToken": "eyJza2lwIjoxMH0",
"pageSize": 10
}
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({
filter: {
technology: 'mongodb',
tags: [{key: 'environment', value: 'development'}],
dueDate: {gte: '2024-12-22T13:47:25.036Z', lt: '2025-12-31T00:00:00.000Z'}
},
sort: {createdAt: 'asc'},
nextToken: 'eyJza2lwIjoxMH0',
pageSize: 10
})
};
fetch('https://api.draftt.io/v1/policy/{policyId}/component/search', 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.draftt.io/v1/policy/{policyId}/component/search",
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([
'filter' => [
'technology' => 'mongodb',
'tags' => [
[
'key' => 'environment',
'value' => 'development'
]
],
'dueDate' => [
'gte' => '2024-12-22T13:47:25.036Z',
'lt' => '2025-12-31T00:00:00.000Z'
]
],
'sort' => [
'createdAt' => 'asc'
],
'nextToken' => 'eyJza2lwIjoxMH0',
'pageSize' => 10
]),
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.draftt.io/v1/policy/{policyId}/component/search"
payload := strings.NewReader("{\n \"filter\": {\n \"technology\": \"mongodb\",\n \"tags\": [\n {\n \"key\": \"environment\",\n \"value\": \"development\"\n }\n ],\n \"dueDate\": {\n \"gte\": \"2024-12-22T13:47:25.036Z\",\n \"lt\": \"2025-12-31T00:00:00.000Z\"\n }\n },\n \"sort\": {\n \"createdAt\": \"asc\"\n },\n \"nextToken\": \"eyJza2lwIjoxMH0\",\n \"pageSize\": 10\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.draftt.io/v1/policy/{policyId}/component/search")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"filter\": {\n \"technology\": \"mongodb\",\n \"tags\": [\n {\n \"key\": \"environment\",\n \"value\": \"development\"\n }\n ],\n \"dueDate\": {\n \"gte\": \"2024-12-22T13:47:25.036Z\",\n \"lt\": \"2025-12-31T00:00:00.000Z\"\n }\n },\n \"sort\": {\n \"createdAt\": \"asc\"\n },\n \"nextToken\": \"eyJza2lwIjoxMH0\",\n \"pageSize\": 10\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.draftt.io/v1/policy/{policyId}/component/search")
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 \"filter\": {\n \"technology\": \"mongodb\",\n \"tags\": [\n {\n \"key\": \"environment\",\n \"value\": \"development\"\n }\n ],\n \"dueDate\": {\n \"gte\": \"2024-12-22T13:47:25.036Z\",\n \"lt\": \"2025-12-31T00:00:00.000Z\"\n }\n },\n \"sort\": {\n \"createdAt\": \"asc\"\n },\n \"nextToken\": \"eyJza2lwIjoxMH0\",\n \"pageSize\": 10\n}"
response = http.request(request)
puts response.read_body{
"items": [
{
"id": 22,
"componentId": 3,
"integrationId": 6,
"technology": "rds",
"type": "rds-postgres",
"typeDisplayName": "Amazon RDS PostgreSQL",
"name": "dev-1-rds",
"uniqueIdentifier": "arn:aws:rds:us-east-1:125422356123:db:dev-1-rds",
"urgency": 17.39,
"priority": 17.39,
"isCompliant": true,
"currentVersion": "14.10",
"requiredVersion": "14.11",
"recommendedVersion": "14.11",
"dueDate": "2025-12-22T00:00:00.000Z",
"tags": [
{
"key": "Terraform",
"value": "true"
},
{
"key": "Environment",
"value": "dev-us-east-1"
},
{
"key": "Name",
"value": "dev-1-rds"
}
],
"createdAt": "2024-05-06T11:25:51.513Z",
"updatedAt": "2024-01-06T11:25:51.513Z"
}
],
"nextToken": "<string>",
"totalCount": 12
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}{
"error": {
"message": "<string>"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Body
application/json
Show child attributes
Show child attributes
Example:
{
"technology": "mongodb",
"tags": [
{
"key": "environment",
"value": "development"
}
],
"dueDate": {
"gte": "2024-12-22T13:47:25.036Z",
"lt": "2025-12-31T00:00:00.000Z"
}
}
Show child attributes
Show child attributes
Example:
{ "createdAt": "asc" }
Example:
"eyJza2lwIjoxMH0"
Required range:
1 <= x <= 100⌘I