Documents

Manage documents and their chunks, including creation via URL or file upload, retrieval, update, deletion, search, and status control. Documents can be associated with datasets.

Create A Document

post
Query parameters
datasetIdsstringOptionalExample: ["xxxx"]
tenantUnitIdstringOptionalExample: 78c8e44c-9ef2-461d-88ba-ee7783a90251
tenantIdstringRequiredExample: {{tenantId}}
Header parameters
X-Api-KeystringOptional

the API Key

Example: {{apiKey}}
Body
idstringOptional
tenantIdstringRequired
tenantUnitIdstringRequired
documentTypestring · enumRequiredPossible values:
documentSubTypestring · enumOptionalPossible values:
documentNamestringOptional
storageTypestringOptional

s3, gcs

storageBucketstringOptional

use url or storageBucket + storagePath

storagePathstringOptional
urlstringOptional

use url or storageBucket + storagePath

titlestringOptional
customPropertiesobjectOptional
enabledbooleanOptional
documentContentstringOptional
Responses
200Success
application/json
post
POST /admin/api/v1/documents HTTP/1.1
Host: api.workfx.ai
Content-Type: application/json
Accept: */*
Content-Length: 288

{
  "id": "text",
  "tenantId": "text",
  "tenantUnitId": "text",
  "documentType": "UnstructuredFile",
  "documentSubType": "pdf",
  "documentName": "text",
  "storageType": "text",
  "storageBucket": "text",
  "storagePath": "text",
  "url": "text",
  "title": "text",
  "customProperties": {},
  "enabled": true,
  "documentContent": "text"
}
200Success
{
  "id": "text",
  "tenantUnitId": "text",
  "documentType": "UnstructuredFile",
  "documentSubType": "pdf",
  "documentName": "text",
  "storageType": "text",
  "storageBucket": "text",
  "storagePath": "text",
  "url": "text",
  "createdTime": "text",
  "updatedTime": "text",
  "status": "created",
  "createdBy": "text",
  "updatedBy": "text",
  "title": "text",
  "category": "text",
  "processingProgress": 1,
  "customProperties": {},
  "enabled": true,
  "documentContent": "text"
}

Create a Document by Uploading a File

post
Query parameters
tenantIdstringOptionalExample: {{currentTenantId}}
tenantUnitIdstringOptionalExample: {{tenantUnitId}}
Header parameters
X-Api-KeystringOptional

the API Key

Example: {{apiKey}}
Body
documentTypestringRequiredExample: UnstructuredFile
documentSubTypestringOptionalExample: pdf
categorystringOptional
datasetIdsarrayRequiredExample: ["[\"{{datasetId}}\"]"]
tenantUnitIdstringRequiredExample: {{tenantUnitId}}
filestring · binaryRequiredExample: file://D:\study\Code\codeRepos\ecompilot-web\tests\synthetic_tests\WoolworthsAnnualReport.pdf
tenantIdstringRequiredExample: {{tenantId}}
customPropertiesstringOptionalExample: {"test":true}
Responses
200Success
application/json
post
POST /admin/api/v1/documents/upload HTTP/1.1
Host: api.workfx.ai
Content-Type: multipart/form-data
Accept: */*
Content-Length: 317

{
  "documentType": "UnstructuredFile",
  "documentSubType": "pdf",
  "category": "",
  "datasetIds": [
    "[\"{{datasetId}}\"]"
  ],
  "tenantUnitId": "{{tenantUnitId}}",
  "file": "file://D:\\study\\Code\\codeRepos\\ecompilot-web\\tests\\synthetic_tests\\WoolworthsAnnualReport.pdf",
  "tenantId": "{{tenantId}}",
  "customProperties": "{\"test\":true}"
}
200Success
{
  "id": "text",
  "tenantId": "text",
  "tenantUnitId": "text",
  "documentType": "UnstructuredFile",
  "documentSubType": "pdf",
  "documentName": "text",
  "storageType": "text",
  "storageBucket": "text",
  "storagePath": "text",
  "url": "text",
  "createdTime": "text",
  "updatedTime": "text",
  "status": "created",
  "createdBy": "text",
  "updatedBy": "text",
  "title": "text",
  "category": "text",
  "processingProgress": 1,
  "customProperties": {},
  "enabled": true,
  "documentContent": "text"
}

Upsert a document by external ID

put
Path parameters
externalIdstringRequired

External ID of the document

Query parameters
datasetIdsstringOptional

Optional list of dataset IDs as JSON string

Example: ["your-dataset-id"]
tenantIdstringRequiredExample: {{tenantId}}
Header parameters
X-Api-KeystringOptional

the API Key

Example: {{apiKey}}
Body
externalIdstringRequired

External ID used to identify the document

documentNamestringOptional

Name of the document

tenantIdstringRequired

Tenant ID

tenantUnitIdstringRequired

Tenant Unit ID

urlstring · uriOptional

URL of the document to fetch and process

documentContentstringOptional

Direct content of the document, if provided

Responses
200
Document successfully upserted
application/json
put
PUT /admin/api/v1/api/v1/documents/byExternalId/{externalId} HTTP/1.1
Host: api.workfx.ai
Content-Type: application/json
Accept: */*
Content-Length: 216

{
  "externalId": "integration_test_external_id",
  "documentName": "integration_test_document",
  "tenantUnitId": "your-tenant-unit-id",
  "tenantId": "your-tenant-id",
  "url": "https://example.com/sample.docx",
  "custom_properties": {}
}
{
  "externalId": "text",
  "documentName": "text",
  "status": "text"
}

Get a Document

get
Path parameters
documentIdstringRequiredExample: 2549d630-81ab-41b9-a691-5377fe140fed
Query parameters
tenantIdstringRequiredExample: {{tenantId}}
Header parameters
X-Api-KeystringOptional

the API Key

Example: {{apiKey}}
Responses
200Success
application/json
get
GET /admin/api/v1/documents/{documentId} HTTP/1.1
Host: api.workfx.ai
Accept: */*
200Success
{
  "id": "text",
  "tenantId": "text",
  "tenantUnitId": "text",
  "documentType": "UnstructuredFile",
  "documentSubType": "pdf",
  "documentName": "text",
  "storageType": "text",
  "storageBucket": "text",
  "storagePath": "text",
  "url": "text",
  "createdTime": "text",
  "updatedTime": "text",
  "status": "created",
  "createdBy": "text",
  "updatedBy": "text",
  "title": "text",
  "category": "text",
  "processingProgress": 1,
  "customProperties": {},
  "enabled": true,
  "documentContent": "text"
}

List Documents

get
Query parameters
typestringOptionalExample: UnstructuredFile
tenantUnitIdstringOptionalExample: {{tenantUnitId}}
datasetIdsstringOptional

dataset ids, seperate with comma

Example: xxx,yyy,zzz
typesstringOptional

UnstructuredFile StructuredFile UnstructuredWebpage StructuredWebpage

Example: UnstructuredFile
pageintegerOptional

default to 1 if not passing this query

Example: 1
pageSizeintegerOptional

default to 10 if not passing this query

Example: 10
tenantIdstringRequiredExample: {{tenantId}}
Header parameters
X-Api-KeystringOptional

the API Key

Example: {{apiKey}}
Responses
200Success
application/json
get
GET /admin/api/v1/documents HTTP/1.1
Host: api.workfx.ai
Accept: */*
200Success
{
  "data": [
    {
      "id": "text",
      "tenantId": "text",
      "tenantUnitId": "text",
      "documentType": "UnstructuredFile",
      "documentSubType": "pdf",
      "documentName": "text",
      "storageType": "text",
      "storageBucket": "text",
      "storagePath": "text",
      "url": "text",
      "createdTime": "text",
      "updatedTime": "text",
      "status": "created",
      "createdBy": "text",
      "updatedBy": "text",
      "title": "text",
      "category": "text",
      "processingProgress": 1,
      "customProperties": {},
      "enabled": true,
      "documentContent": "text"
    }
  ],
  "pagination": {
    "totalCount": 1,
    "currentPage": 1,
    "pageSize": 1,
    "totalPages": 1
  }
}

Delete a Document

delete
Path parameters
documentIdstringRequired
Query parameters
tenantIdstringRequiredExample: {{tenantId}}
Header parameters
X-Api-KeystringOptional

the API Key

Example: {{apiKey}}
Responses
204Success
application/json
Responsenull
delete
DELETE /admin/api/v1/documents/{documentId} HTTP/1.1
Host: api.workfx.ai
Accept: */*
204Success

No content

Get Documents By Ids

get
Query parameters
documentIdsstringOptionalExample: ["xxxx","yyyy"]
tenantIdstringRequiredExample: {{tenantId}}
Header parameters
X-Api-KeystringOptional

the API Key

Example: {{apiKey}}
Responses
200Success
application/json
get
GET /admin/api/v1/documents/byIds HTTP/1.1
Host: api.workfx.ai
Accept: */*
200Success
[
  {
    "id": "text",
    "tenantId": "text",
    "tenantUnitId": "text",
    "documentType": "UnstructuredFile",
    "documentSubType": "pdf",
    "documentName": "text",
    "storageType": "text",
    "storageBucket": "text",
    "storagePath": "text",
    "url": "text",
    "createdTime": "text",
    "updatedTime": "text",
    "status": "created",
    "createdBy": "text",
    "updatedBy": "text",
    "title": "text",
    "category": "text",
    "processingProgress": 1,
    "customProperties": {},
    "enabled": true,
    "documentContent": "text"
  }
]

Partial update document

patch
Path parameters
documentIdstringRequired
Query parameters
tenantIdstringRequiredExample: {{tenantId}}
Header parameters
X-Api-KeystringOptional

the API Key

Example: {{apiKey}}
Body
urlstringOptional

use url or storageBucket + storagePath

customPropertiesobjectOptional
enabledbooleanOptional
documentContentstringOptional
Responses
200Success
application/json
patch
PATCH /admin/api/v1/documents/{documentId} HTTP/1.1
Host: api.workfx.ai
Content-Type: application/json
Accept: */*
Content-Length: 76

{
  "url": "text",
  "customProperties": {},
  "enabled": true,
  "documentContent": "text"
}
200Success
{
  "id": "text",
  "tenantId": "text",
  "tenantUnitId": "text",
  "documentType": "UnstructuredFile",
  "documentSubType": "pdf",
  "documentName": "text",
  "storageType": "text",
  "storageBucket": "text",
  "storagePath": "text",
  "url": "text",
  "createdTime": "text",
  "updatedTime": "text",
  "status": "created",
  "createdBy": "text",
  "updatedBy": "text",
  "title": "text",
  "category": "text",
  "processingProgress": 1,
  "customProperties": {},
  "enabled": true,
  "documentContent": "text"
}

Toggle Document(Enable/Disable)

patch
Path parameters
documentIdstringRequired
Query parameters
tenantIdstringRequiredExample: {{tenantId}}
Header parameters
X-Api-KeystringOptional

the API Key

Example: {{apiKey}}
Body
enabledbooleanOptional
Responses
200Success
application/json
Responseobject
patch
PATCH /admin/api/v1/documents/{documentId}/toggle HTTP/1.1
Host: api.workfx.ai
Content-Type: application/json
Accept: */*
Content-Length: 16

{
  "enabled": true
}
200Success
{}

List Document Chunks

get
Path parameters
documentIdstringRequired
Query parameters
pageintegerOptional

default to 1 if not passing this query

Example: 1
pageSizeintegerOptional

default to 10 if not passing this query

Example: 10
tenantIdstringRequiredExample: {{tenantId}}
Header parameters
X-Api-KeystringOptional

the API Key

Example: {{apiKey}}
Responses
200Success
application/json
get
GET /admin/api/v1/api/v1/documents/{documentId}/documentChunks/ HTTP/1.1
Host: api.workfx.ai
Accept: */*
200Success
{
  "data": [
    {
      "content": "text",
      "contentComplement": "text",
      "createdTime": "text",
      "documentId": "text",
      "id": "text",
      "keywords": {},
      "metadata": {
        "file_directory": "text",
        "filename": "text",
        "filetype": "text",
        "languages": [
          "text"
        ],
        "last_modified": "text",
        "page_number": 1
      },
      "status": "text",
      "tenantId": "text",
      "tenantUnitId": "text",
      "updatedTime": "text"
    }
  ],
  "pagination": {
    "currentPage": 1,
    "pageSize": 1,
    "totalCount": 1,
    "totalPages": 1
  }
}

Document Chunks Search

post
Query parameters
tenantIdstringRequiredExample: {{tenantId}}
Header parameters
X-Api-KeystringOptional

the API Key

Example: {{apiKey}}
Body
tenant_idstringRequired
tenant_unit_idstringRequired
dataset_idsstring[]Required
querystringRequired
top_kintegerOptional

default is 5

languagestringOptional

currently support 'english' or 'chinese' , default is 'english'

Responses
200Success
application/json
post
POST /admin/api/v1/api/v1/documentChunks/search HTTP/1.1
Host: api.workfx.ai
Content-Type: application/json
Accept: */*
Content-Length: 110

{
  "tenant_id": "text",
  "tenant_unit_id": "text",
  "dataset_ids": [
    "text"
  ],
  "query": "text",
  "top_k": 1,
  "language": "text"
}
200Success
[
  {
    "content": "text",
    "content_complement": "text",
    "created_time": "text",
    "document_id": "text",
    "document_name": "text",
    "document_sub_type": "text",
    "document_type": "text",
    "id": "text",
    "keywords": [
      "text"
    ],
    "metadata": {
      "dataset_ids": [
        "text"
      ]
    },
    "score": 1,
    "tenant_id": "text",
    "tenant_unit_id": "text",
    "updated_time": "text"
  }
]

Patch Document Chunks

patch
Path parameters
document_idstringRequired
Query parameters
tenantIdstringRequiredExample: {{tenantId}}
Header parameters
X-Api-KeystringOptional

the API Key

Example: {{apiKey}}
Body
contentstringOptional
keywordsstring[]Optional
Responses
200Success
application/json
Responseobject
patch
PATCH /admin/api/v1/api/v1/documents/{document_id}/documentChunks/<chunk_id> HTTP/1.1
Host: api.workfx.ai
Content-Type: application/json
Accept: */*
Content-Length: 38

{
  "content": "text",
  "keywords": [
    "text"
  ]
}
200Success
{}

Batch Delete Document Chunks

delete
Path parameters
document_idstringRequired
Query parameters
tenantUnitIdstring[]OptionalExample: [""]
tenantIdstringOptional
Header parameters
X-Api-KeystringOptional

the API Key

Example: {{apiKey}}
Body
objectOptional
Responses
200Success
application/json
Responseobject
delete
DELETE /admin/api/v1/documents/{document_id}/documentChunks/batch HTTP/1.1
Host: api.workfx.ai
Content-Type: application/json
Accept: */*
Content-Length: 28

{
  "documentChunkIds": [
    "id1"
  ]
}
200Success
{}

Batch Change Document Chunks Status

patch
Path parameters
document_idstringRequired
Query parameters
tenantUnitIdstringRequiredExample: 8313c091-eb49-4d42-91cb-0a1f965a4e90
tenantIdstringOptionalExample: 07284edf-f254-4503-8ca6-c2deff022fd4
Header parameters
X-Api-KeystringOptional

the API Key

Example: {{apiKey}}
Body
statusstringRequired

active or inactive

documentChunkIdsstring[]Required
Responses
200Success
application/json
Responseobject
patch
PATCH /admin/api/v1/documents/{document_id}/documentChunks/batch/status HTTP/1.1
Host: api.workfx.ai
Content-Type: application/json
Accept: */*
Content-Length: 52

{
  "status": "active",
  "documentChunkIds": [
    "id1",
    "id2"
  ]
}
200Success
{}

Change Document Chunks Status

patch
Path parameters
document_idstringRequired
Query parameters
tenantUnitIdstringRequired
tenantIdstringRequiredExample: {{tenantId}}
Header parameters
X-Api-KeystringOptional

the API Key

Example: {{apiKey}}
Body
statusstringRequired

active or inactive

Responses
200Success
application/json
Responseobject
patch
PATCH /admin/api/v1/api/v1/documents/{document_id}/documentChunks/<chunk_id>/status HTTP/1.1
Host: api.workfx.ai
Content-Type: application/json
Accept: */*
Content-Length: 19

{
  "status": "active"
}
200Success
{}

Last updated

Was this helpful?