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
post
/admin/api/v1/documents
200Success

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
post
/admin/api/v1/documents/upload
200Success

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
put
/admin/api/v1/api/v1/documents/byExternalId/{externalId}

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
get
/admin/api/v1/documents/{documentId}
200Success

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
get
/admin/api/v1/documents
200Success

Delete a Document

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

the API Key

Example: {{apiKey}}
Responses
delete
/admin/api/v1/documents/{documentId}
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
get
/admin/api/v1/documents/byIds
200Success

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
patch
/admin/api/v1/documents/{documentId}
200Success

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
patch
/admin/api/v1/documents/{documentId}/toggle
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
get
/admin/api/v1/api/v1/documents/{documentId}/documentChunks/
200Success

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
post
/admin/api/v1/api/v1/documentChunks/search
200Success

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
patch
/admin/api/v1/api/v1/documents/{document_id}/documentChunks/<chunk_id>
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
delete
/admin/api/v1/documents/{document_id}/documentChunks/batch
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
patch
/admin/api/v1/documents/{document_id}/documentChunks/batch/status
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
patch
/admin/api/v1/api/v1/documents/{document_id}/documentChunks/<chunk_id>/status
200Success

Last updated

Was this helpful?