Import Policy
curl --request POST \
--url https://api.zerodrift.ai/api/policies/import \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"source": "<string>",
"content": "<string>"
}
'import requests
url = "https://api.zerodrift.ai/api/policies/import"
payload = {
"source": "<string>",
"content": "<string>"
}
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({source: '<string>', content: '<string>'})
};
fetch('https://api.zerodrift.ai/api/policies/import', 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.zerodrift.ai/api/policies/import",
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([
'source' => '<string>',
'content' => '<string>'
]),
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.zerodrift.ai/api/policies/import"
payload := strings.NewReader("{\n \"source\": \"<string>\",\n \"content\": \"<string>\"\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.zerodrift.ai/api/policies/import")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"source\": \"<string>\",\n \"content\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zerodrift.ai/api/policies/import")
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 \"source\": \"<string>\",\n \"content\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"import_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "processing",
"message": "Import accepted. Poll GET /api/policies/import/{import_id} for results."
}
{
"error": "Missing required field: source"
}
{
"error": "Cannot extract text from document"
}
Policy
Import Policy
Upload a policy and extract enforceable rules.
POST
/
api
/
policies
/
import
Import Policy
curl --request POST \
--url https://api.zerodrift.ai/api/policies/import \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"source": "<string>",
"content": "<string>"
}
'import requests
url = "https://api.zerodrift.ai/api/policies/import"
payload = {
"source": "<string>",
"content": "<string>"
}
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({source: '<string>', content: '<string>'})
};
fetch('https://api.zerodrift.ai/api/policies/import', 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.zerodrift.ai/api/policies/import",
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([
'source' => '<string>',
'content' => '<string>'
]),
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.zerodrift.ai/api/policies/import"
payload := strings.NewReader("{\n \"source\": \"<string>\",\n \"content\": \"<string>\"\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.zerodrift.ai/api/policies/import")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"source\": \"<string>\",\n \"content\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zerodrift.ai/api/policies/import")
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 \"source\": \"<string>\",\n \"content\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"import_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "processing",
"message": "Import accepted. Poll GET /api/policies/import/{import_id} for results."
}
{
"error": "Missing required field: source"
}
{
"error": "Cannot extract text from document"
}
Upload a policy and extract enforceable rules. The endpoint returns immediately with a
processing status while rule extraction runs in the background. Poll Get Import Details to check when extraction is complete.
Documents you pick from a Notion, Linear, Confluence, or Google Drive connection go through this same import pipeline. Connect the source in Command, then treat the resulting import_id like any other import — see Connecting the MCP server.
This endpoint sends the document inline in the request body (base64-encoded when
source is file), which is capped by API Gateway / Lambda
payload limits (a few MB after encoding). For large policy files, use the presigned upload flow
instead: Get Import Presigned URL →
upload to S3 → Start Import.Request Body
string
required
Content type indicator:
file for base64-encoded documents or text for plain text.string
required
The policy content. Base64-encoded document bytes when
source is file, or plain text when source is text.string
Original filename for reference (optional, used with
file source).Response
string
Unique identifier for the import. Use this to poll for status, view details, or activate rules.
string
Initial status:
processing. Poll the Get Import Details endpoint until status transitions to pending_review, no_rules_found, or failed.string
Human-readable message with next steps.
{
"import_id": "550e8400-e29b-41d4-a716-446655440000",
"status": "processing",
"message": "Import accepted. Poll GET /api/policies/import/{import_id} for results."
}
{
"error": "Missing required field: source"
}
{
"error": "Cannot extract text from document"
}
Status Lifecycle
| Status | Description |
|---|---|
processing | Import accepted, AI extraction in progress |
pending_review | Extraction complete, rules ready for review and activation |
no_rules_found | Extraction complete but no compliance rules were identified |
failed | Extraction failed (see error_message in Get Import Details) |
activated | All extracted rules have been activated |
partially_activated | Some rules activated, others still pending |
Example
Two request shapes (source: "file" with a base64 PDF, and source: "text"),
then poll Get Import Details
until extraction finishes.
DOC_BASE64=$(base64 -i compliance-policy.pdf)
# Submit the import
curl -X POST "https://api.zerodrift.ai/api/policies/import" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d "{
\"source\": \"file\",
\"content\": \"$DOC_BASE64\",
\"filename\": \"compliance-policy.pdf\"
}"
# Poll for results (returns 'processing' until extraction completes)
curl -X GET "https://api.zerodrift.ai/api/policies/import/IMPORT_ID" \
-H "x-api-key: YOUR_API_KEY"
curl -X POST "https://api.zerodrift.ai/api/policies/import" \
-H "x-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"source": "text",
"content": "All marketing materials must include a risk disclosure. Performance claims require a 1-year, 5-year, and since-inception comparison to the benchmark."
}'
import requests
import base64
import time
API_KEY = "YOUR_API_KEY"
API_BASE = "https://api.zerodrift.ai"
# Submit file import
with open("compliance-policy.pdf", "rb") as f:
doc_bytes = base64.b64encode(f.read()).decode()
response = requests.post(
f"{API_BASE}/api/policies/import",
headers={
"x-api-key": API_KEY,
"Content-Type": "application/json"
},
json={
"source": "file",
"content": doc_bytes,
"filename": "compliance-policy.pdf"
}
)
import_id = response.json()["import_id"]
print(f"Import ID: {import_id} — polling for results...")
# Poll until extraction completes
while True:
details = requests.get(
f"{API_BASE}/api/policies/import/{import_id}",
headers={"x-api-key": API_KEY}
).json()
if details["status"] != "processing":
break
time.sleep(3)
print(f"Status: {details['status']}")
if details.get("rule_count") is not None:
print(f"Rules extracted: {details['rule_count']}")
const fs = require('fs');
const axios = require('axios');
const API_KEY = 'YOUR_API_KEY';
const API_BASE = 'https://api.zerodrift.ai';
const docBytes = fs.readFileSync('compliance-policy.pdf').toString('base64');
// Submit import
const { data } = await axios.post(
`${API_BASE}/api/policies/import`,
{
source: 'file',
content: docBytes,
filename: 'compliance-policy.pdf'
},
{
headers: {
'x-api-key': API_KEY,
'Content-Type': 'application/json'
}
}
);
console.log(`Import ID: ${data.import_id} — polling for results...`);
// Poll until extraction completes
let details;
do {
await new Promise(r => setTimeout(r, 3000));
const res = await axios.get(
`${API_BASE}/api/policies/import/${data.import_id}`,
{ headers: { 'x-api-key': API_KEY } }
);
details = res.data;
} while (details.status === 'processing');
console.log(`Status: ${details.status}`);
if (details.rule_count != null) {
console.log(`Rules extracted: ${details.rule_count}`);
}

