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.documents.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": "John Doe",
      "type": "user_account"
    },
    "id": "doc_01h2xcejqtf2nbrexx3vqjhp41",
    "processing_status": "processing",
    "title": "Q4 2024 Financial Report",
    "url": "https://d.factify.com/d/01h2xcejqtf2nbrexx3vqjhp41",
    "current_version": {
      "id": "ver_01h2abcd1234efgh5678jkmnpt"
    },
    "description": "Quarterly financial report for Q4 2024"
  }
}

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

The created document.