Skip to main content
POST
/
v1beta
/
documents
TypeScript
import { Factify } from "@factify/sdk";
import { openAsBlob } from "node:fs";

const factify = new Factify({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await factify.documentService.create({
    payload: await openAsBlob("example.file"),
    title: "<value>",
  });

  console.log(result);
}

run();
{
  "document": {
    "access_level": "private",
    "created_at": "2023-11-07T05:31:56Z",
    "created_by": {
      "id": "user_01h2xcejqtf2nbrexx3vqjhp41",
      "name": "<string>",
      "type": "user"
    },
    "id": "doc_01h2xcejqtf2nbrexx3vqjhp41",
    "processing_status": "processing",
    "title": "Q4 2024 Financial Report",
    "url": "https://app.factify.com/d/01h2xcejqtf2nbrexx3vqjhp41",
    "current_version": {
      "id": "ver_01h2abcd1234efgh5678jkmnpt"
    },
    "description": "Quarterly financial report for Q4 2024",
    "general_access": "private",
    "last_viewed_at": "2023-11-07T05:31:56Z",
    "permission_set": {
      "attach_policy": true,
      "comment_private": true,
      "comment_public": true,
      "copy_content": true,
      "create_version": true,
      "export": true,
      "grant_access": true,
      "list_versions": true,
      "manage_access": true,
      "open": true,
      "screenshot": true,
      "trash": true,
      "view": true,
      "view_analytics": true,
      "view_leads": true,
      "view_timeline": true
    },
    "shared_at": "2023-11-07T05:31:56Z",
    "thumbnail_url": "<string>",
    "trashed_at": "2023-11-07T05:31:56Z",
    "updated_at": "2023-11-07T05:31:56Z"
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer , where is your auth token.

Body

multipart/form-data

CreateDocumentRequest contains the file and metadata for creating a document.

payload
file
required

PDF file to upload

title
string
required

Document title.

Required string length: 1 - 255
access_level
enum<string> | null

Document access level. Defaults to organization if user belongs to an org, otherwise private.

Available options:
private,
organization,
public
description
string | null

Optional document description.

Maximum string length: 2000

Response

Success

CreateDocumentResponse contains the newly created document.

document
document · object
required

The created document.