Overview
Policies enable you to enforce governance rules on documents. Common policies include GDPR compliance, retention periods, and access restrictions.Prerequisites
- An existing document ID
- A policy ID from your organization
- A valid API key
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Factify API is currently in Beta.
Apply governance policies to documents for compliance enforcement.
import { Factify } from "@factify/sdk";
const factify = new Factify({ bearerAuth: process.env.FACTIFY_KEY });
async function attachPolicy(documentId: string, policyId: string) {
const result = await factify.policies.attach({
documentId,
body: {
policyId,
},
});
console.log("Policy attached successfully");
return result.attachDocumentPolicyResponse;
}
attachPolicy(
"doc_01h2xcejqtf2nbrexx3vqjhp41",
"pol_01h2xcejqtf2nbrexx3vqjhp41"
);
for await (const page of await factify.policies.list({
documentId: "doc_01h2xcejqtf2nbrexx3vqjhp41"
})) {
for (const item of page.listDocumentPoliciesResponse?.items ?? []) {
console.log(`Policy: ${item.policy.name}`);
console.log(`Attached at: ${item.attachedAt}`);
}
}
{
"document_policy": {
"document_id": "doc_01h2xcejqtf2nbrexx3vqjhp41",
"policy": {
"id": "pol_01h2xcejqtf2nbrexx3vqjhp41",
"name": "GDPR Compliance",
"created_at": "2024-01-15T10:30:00Z"
},
"attached_at": "2024-01-15T10:30:00Z",
"attached_by": {
"id": "user_01h2xcejqtf2nbrexx3vqjhp41",
"name": "John Doe",
"type": "user_account"
}
}
}