Skip to main content
POST
/
v1
/
documents
/
{document_id}
/
policies
Attach a policy to a document
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

Authorization
string
header
required

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_id
string
required

Document to attach the policy to.

Example:

"doc_01h2xcejqtf2nbrexx3vqjhp41"

Body

application/json
policy_id
string
required

ID of the policy to attach. Must belong to the same organization as the document.

Example:

"pol_01h2xcejqtf2nbrexx3vqjhp41"

Response

Created

A policy attached to a document.

document_id
string
required

Document the policy is attached to.

Example:

"doc_01h2xcejqtf2nbrexx3vqjhp41"

attached_at
string<date-time>
required

When the policy was attached to this document.

Example:

"2025-01-15T10:35:00Z"

policy
object
required

A reusable access policy that can be attached to one or more documents.