const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({policy_id: 'pol_01h2xcejqtf2nbrexx3vqjhp41'})
};
fetch('https://api.factify.com/v1/documents/{document_id}/policies', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"document_id": "doc_01h2xcejqtf2nbrexx3vqjhp41",
"attached_at": "2025-01-15T10:35:00Z",
"policy": {
"id": "pol_01h2xcejqtf2nbrexx3vqjhp41",
"org_id": "org_01h2xcejqtf2nbrexx3vqjhp41",
"name": "Default lead-gen policy",
"created_at": "2025-01-15T10:30:00Z",
"updated_at": "2025-01-15T10:35:00Z"
}
}Attach a policy to a document
Attaches an existing access policy to the document. The
caller must have manage_access capability on the document.
The policy’s effects (for example, lead-capture form gating)
are applied to subsequent access attempts; existing explicit
grants and the general access level are preserved. Attaching
a policy that is already attached is a no-op and returns the
existing attachment.
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({policy_id: 'pol_01h2xcejqtf2nbrexx3vqjhp41'})
};
fetch('https://api.factify.com/v1/documents/{document_id}/policies', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"document_id": "doc_01h2xcejqtf2nbrexx3vqjhp41",
"attached_at": "2025-01-15T10:35:00Z",
"policy": {
"id": "pol_01h2xcejqtf2nbrexx3vqjhp41",
"org_id": "org_01h2xcejqtf2nbrexx3vqjhp41",
"name": "Default lead-gen policy",
"created_at": "2025-01-15T10:30:00Z",
"updated_at": "2025-01-15T10:35:00Z"
}
}Documentation Index
Fetch the complete documentation index at: https://developers.factify.com/llms.txt
Use this file to discover all available pages before exploring further.
Authorizations
Bearer authentication using a factapi-issued API key
(ffy_<env>_<base32_uuid><base62_random>). Cookie-based
sessions are accepted automatically by user-facing endpoints
but are not surfaced as an OpenAPI auth scheme.
Path Parameters
Document to attach the policy to.
"doc_01h2xcejqtf2nbrexx3vqjhp41"
Body
ID of the policy to attach. Must belong to the same organization as the document.
"pol_01h2xcejqtf2nbrexx3vqjhp41"
Response
Created
A policy attached to a document.
Document the policy is attached to.
"doc_01h2xcejqtf2nbrexx3vqjhp41"
When the policy was attached to this document.
"2025-01-15T10:35:00Z"
A reusable access policy that can be attached to one or more documents.
Show child attributes
Show child attributes