> For the complete documentation index, see [llms.txt](https://docs.workfx.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.workfx.ai/workfx-companion-agent-knowledge/developer-docs/api-reference/documents.md).

# Documents

## POST /admin/api/v1/documents

> Create A Document

```json
{"openapi":"3.0.1","info":{"title":"TargetPilot-Admin-API","version":"1.0.0"},"servers":[{"url":"https://api.workfx.ai","description":"Wfx Dev Env V1"}],"security":[],"paths":{"/admin/api/v1/documents":{"post":{"summary":"Create A Document","deprecated":false,"description":"","tags":[],"parameters":[{"name":"datasetIds","in":"query","description":"","required":false,"schema":{"type":"string"}},{"name":"tenantUnitId","in":"query","description":"","required":false,"schema":{"type":"string"}},{"name":"tenantId","in":"query","description":"","required":true,"schema":{"type":"string"}},{"name":"X-Api-Key","in":"header","description":"the API Key","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"tenantId":{"type":"string"},"tenantUnitId":{"type":"string"},"documentType":{"type":"string","enum":["UnstructuredFile","StructuredFile","UnstructuredWebpage","StructuredWebpage"]},"documentSubType":{"type":"string","enum":["pdf","txt","html","xml","json","csv","xlsx","docx"]},"documentName":{"type":"string"},"storageType":{"type":"string","description":"s3, gcs"},"storageBucket":{"type":"string","description":"use url or storageBucket + storagePath"},"storagePath":{"type":"string"},"url":{"type":"string","description":"use url or storageBucket + storagePath"},"title":{"type":"string"},"customProperties":{"type":"object","properties":{}},"enabled":{"type":"boolean"},"documentContent":{"type":"string"}},"required":["tenantId","tenantUnitId","documentType"]}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"tenantUnitId":{"type":"string"},"documentType":{"type":"string","enum":["UnstructuredFile","StructuredFile","UnstructuredWebpage","StructuredWebpage"]},"documentSubType":{"type":"string","enum":["pdf","txt","html","xml","json","csv","xlsx","docx"]},"documentName":{"type":"string"},"storageType":{"type":"string","description":"s3, gcs"},"storageBucket":{"type":"string","description":"use url or storageBucket + storagePath"},"storagePath":{"type":"string"},"url":{"type":"string","description":"use url or storageBucket + storagePath"},"createdTime":{"type":"string"},"updatedTime":{"type":"string"},"status":{"type":"string","enum":["created","processing","process_failed","processed"]},"createdBy":{"type":"string"},"updatedBy":{"type":"string"},"title":{"type":"string"},"category":{"type":"string"},"processingProgress":{"type":"number"},"customProperties":{"type":"object","properties":{}},"enabled":{"type":"boolean"},"documentContent":{"type":"string"}},"required":["tenantUnitId","documentType"]}}},"headers":{}}}}}}}
```

## POST /admin/api/v1/documents/upload

> Create a Document by Uploading a File

```json
{"openapi":"3.0.1","info":{"title":"TargetPilot-Admin-API","version":"1.0.0"},"servers":[{"url":"https://api.workfx.ai","description":"Wfx Dev Env V1"}],"security":[],"paths":{"/admin/api/v1/documents/upload":{"post":{"summary":"Create a Document by Uploading a File","deprecated":false,"description":"","tags":[],"parameters":[{"name":"tenantId","in":"query","description":"","required":false,"schema":{"type":"string"}},{"name":"tenantUnitId","in":"query","description":"","required":false,"schema":{"type":"string"}},{"name":"X-Api-Key","in":"header","description":"the API Key","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"documentType":{"type":"string"},"documentSubType":{"type":"string"},"category":{"type":"string"},"datasetIds":{"type":"array"},"tenantUnitId":{"type":"string"},"file":{"format":"binary","type":"string"},"tenantId":{"type":"string"},"customProperties":{"type":"string"}},"required":["documentType","datasetIds","tenantUnitId","file","tenantId"]}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/document"}}},"headers":{}}}}}},"components":{"schemas":{"document":{"type":"object","properties":{"id":{"type":"string"},"tenantId":{"type":"string"},"tenantUnitId":{"type":"string"},"documentType":{"type":"string","enum":["UnstructuredFile","StructuredFile","UnstructuredWebpage","StructuredWebpage"]},"documentSubType":{"type":"string","enum":["pdf","txt","html","xml","json","csv","xlsx","docx"]},"documentName":{"type":"string"},"storageType":{"type":"string","description":"s3, gcs"},"storageBucket":{"type":"string","description":"use url or storageBucket + storagePath"},"storagePath":{"type":"string"},"url":{"type":"string","description":"use url or storageBucket + storagePath"},"createdTime":{"type":"string"},"updatedTime":{"type":"string"},"status":{"type":"string","enum":["created","processing","process_failed","processed"]},"createdBy":{"type":"string"},"updatedBy":{"type":"string"},"title":{"type":"string"},"category":{"type":"string"},"processingProgress":{"type":"number"},"customProperties":{"type":"object","properties":{}},"enabled":{"type":"boolean"},"documentContent":{"type":"string"}},"required":["tenantId","documentType","tenantUnitId"]}}}}
```

## PUT /admin/api/v1/api/v1/documents/byExternalId/{externalId}

> Upsert a document by external ID

```json
{"openapi":"3.0.1","info":{"title":"TargetPilot-Admin-API","version":"1.0.0"},"servers":[{"url":"https://api.workfx.ai","description":"Wfx Dev Env V1"}],"security":[],"paths":{"/admin/api/v1/api/v1/documents/byExternalId/{externalId}":{"put":{"summary":"Upsert a document by external ID","deprecated":false,"description":"","tags":[],"parameters":[{"name":"externalId","in":"path","description":"External ID of the document","required":true,"schema":{"type":"string"}},{"name":"datasetIds","in":"query","description":"Optional list of dataset IDs as JSON string","required":false,"schema":{"type":"string"}},{"name":"tenantId","in":"query","description":"","required":true,"schema":{"type":"string"}},{"name":"X-Api-Key","in":"header","description":"the API Key","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["externalId","tenantId","tenantUnitId"],"properties":{"externalId":{"type":"string","description":"External ID used to identify the document"},"documentName":{"type":"string","description":"Name of the document"},"tenantId":{"type":"string","description":"Tenant ID"},"tenantUnitId":{"type":"string","description":"Tenant Unit ID"},"url":{"type":"string","format":"uri","description":"URL of the document to fetch and process"},"documentContent":{"type":"string","description":"Direct content of the document, if provided"},"custom_properties":{"type":"object","additionalProperties":true,"description":"Optional custom properties for the document","properties":{}}}}}}},"responses":{"200":{"description":"Document successfully upserted","content":{"application/json":{"schema":{"type":"object","properties":{"externalId":{"type":"string"},"documentName":{"type":"string"},"status":{"type":"string"}}}}},"headers":{}},"400":{"description":"Invalid input","headers":{}},"401":{"description":"Unauthorized","headers":{}},"500":{"description":"Internal server error","headers":{}}}}}}}
```

## GET /admin/api/v1/documents/{documentId}

> Get a Document

```json
{"openapi":"3.0.1","info":{"title":"TargetPilot-Admin-API","version":"1.0.0"},"servers":[{"url":"https://api.workfx.ai","description":"Wfx Dev Env V1"}],"security":[],"paths":{"/admin/api/v1/documents/{documentId}":{"get":{"summary":"Get a Document","deprecated":false,"description":"","tags":[],"parameters":[{"name":"documentId","in":"path","description":"","required":true,"schema":{"type":"string"}},{"name":"tenantId","in":"query","description":"","required":true,"schema":{"type":"string"}},{"name":"X-Api-Key","in":"header","description":"the API Key","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/document"}}},"headers":{}}}}}},"components":{"schemas":{"document":{"type":"object","properties":{"id":{"type":"string"},"tenantId":{"type":"string"},"tenantUnitId":{"type":"string"},"documentType":{"type":"string","enum":["UnstructuredFile","StructuredFile","UnstructuredWebpage","StructuredWebpage"]},"documentSubType":{"type":"string","enum":["pdf","txt","html","xml","json","csv","xlsx","docx"]},"documentName":{"type":"string"},"storageType":{"type":"string","description":"s3, gcs"},"storageBucket":{"type":"string","description":"use url or storageBucket + storagePath"},"storagePath":{"type":"string"},"url":{"type":"string","description":"use url or storageBucket + storagePath"},"createdTime":{"type":"string"},"updatedTime":{"type":"string"},"status":{"type":"string","enum":["created","processing","process_failed","processed"]},"createdBy":{"type":"string"},"updatedBy":{"type":"string"},"title":{"type":"string"},"category":{"type":"string"},"processingProgress":{"type":"number"},"customProperties":{"type":"object","properties":{}},"enabled":{"type":"boolean"},"documentContent":{"type":"string"}},"required":["tenantId","documentType","tenantUnitId"]}}}}
```

## GET /admin/api/v1/documents

> List Documents

```json
{"openapi":"3.0.1","info":{"title":"TargetPilot-Admin-API","version":"1.0.0"},"servers":[{"url":"https://api.workfx.ai","description":"Wfx Dev Env V1"}],"security":[],"paths":{"/admin/api/v1/documents":{"get":{"summary":"List Documents","deprecated":false,"description":"","tags":[],"parameters":[{"name":"type","in":"query","description":"","required":false,"schema":{"type":"string"}},{"name":"tenantUnitId","in":"query","description":"","required":false,"schema":{"type":"string"}},{"name":"datasetIds","in":"query","description":"dataset ids, seperate with comma","required":false,"schema":{"type":"string"}},{"name":"types","in":"query","description":"UnstructuredFile\nStructuredFile\nUnstructuredWebpage\nStructuredWebpage","required":false,"schema":{"type":"string"}},{"name":"page","in":"query","description":"default to 1 if not passing this query","schema":{"type":"integer"}},{"name":"pageSize","in":"query","description":"default to 10 if not passing this query","schema":{"type":"integer"}},{"name":"tenantId","in":"query","description":"","required":true,"schema":{"type":"string"}},{"name":"X-Api-Key","in":"header","description":"the API Key","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/document"}},"pagination":{"$ref":"#/components/schemas/paginationResponse"}},"required":["data","pagination"]}}},"headers":{}}}}}},"components":{"schemas":{"document":{"type":"object","properties":{"id":{"type":"string"},"tenantId":{"type":"string"},"tenantUnitId":{"type":"string"},"documentType":{"type":"string","enum":["UnstructuredFile","StructuredFile","UnstructuredWebpage","StructuredWebpage"]},"documentSubType":{"type":"string","enum":["pdf","txt","html","xml","json","csv","xlsx","docx"]},"documentName":{"type":"string"},"storageType":{"type":"string","description":"s3, gcs"},"storageBucket":{"type":"string","description":"use url or storageBucket + storagePath"},"storagePath":{"type":"string"},"url":{"type":"string","description":"use url or storageBucket + storagePath"},"createdTime":{"type":"string"},"updatedTime":{"type":"string"},"status":{"type":"string","enum":["created","processing","process_failed","processed"]},"createdBy":{"type":"string"},"updatedBy":{"type":"string"},"title":{"type":"string"},"category":{"type":"string"},"processingProgress":{"type":"number"},"customProperties":{"type":"object","properties":{}},"enabled":{"type":"boolean"},"documentContent":{"type":"string"}},"required":["tenantId","documentType","tenantUnitId"]},"paginationResponse":{"type":"object","properties":{"totalCount":{"type":"integer"},"currentPage":{"type":"integer"},"pageSize":{"type":"integer"},"totalPages":{"type":"integer"}},"required":["totalCount","totalPages","pageSize","currentPage"]}}}}
```

## DELETE /admin/api/v1/documents/{documentId}

> Delete a Document

```json
{"openapi":"3.0.1","info":{"title":"TargetPilot-Admin-API","version":"1.0.0"},"servers":[{"url":"https://api.workfx.ai","description":"Wfx Dev Env V1"}],"security":[],"paths":{"/admin/api/v1/documents/{documentId}":{"delete":{"summary":"Delete a Document","deprecated":false,"description":"","tags":[],"parameters":[{"name":"documentId","in":"path","description":"","required":true,"schema":{"type":"string"}},{"name":"tenantId","in":"query","description":"","required":true,"schema":{"type":"string"}},{"name":"X-Api-Key","in":"header","description":"the API Key","required":false,"schema":{"type":"string"}}],"responses":{"204":{"description":"","content":{"application/json":{"schema":{"type":"null"}}},"headers":{}}}}}}}
```

## GET /admin/api/v1/documents/byIds

> Get Documents By Ids

```json
{"openapi":"3.0.1","info":{"title":"TargetPilot-Admin-API","version":"1.0.0"},"servers":[{"url":"https://api.workfx.ai","description":"Wfx Dev Env V1"}],"security":[],"paths":{"/admin/api/v1/documents/byIds":{"get":{"summary":"Get Documents By Ids","deprecated":false,"description":"","tags":[],"parameters":[{"name":"documentIds","in":"query","description":"","required":false,"schema":{"type":"string"}},{"name":"tenantId","in":"query","description":"","required":true,"schema":{"type":"string"}},{"name":"X-Api-Key","in":"header","description":"the API Key","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/document"}}}},"headers":{}}}}}},"components":{"schemas":{"document":{"type":"object","properties":{"id":{"type":"string"},"tenantId":{"type":"string"},"tenantUnitId":{"type":"string"},"documentType":{"type":"string","enum":["UnstructuredFile","StructuredFile","UnstructuredWebpage","StructuredWebpage"]},"documentSubType":{"type":"string","enum":["pdf","txt","html","xml","json","csv","xlsx","docx"]},"documentName":{"type":"string"},"storageType":{"type":"string","description":"s3, gcs"},"storageBucket":{"type":"string","description":"use url or storageBucket + storagePath"},"storagePath":{"type":"string"},"url":{"type":"string","description":"use url or storageBucket + storagePath"},"createdTime":{"type":"string"},"updatedTime":{"type":"string"},"status":{"type":"string","enum":["created","processing","process_failed","processed"]},"createdBy":{"type":"string"},"updatedBy":{"type":"string"},"title":{"type":"string"},"category":{"type":"string"},"processingProgress":{"type":"number"},"customProperties":{"type":"object","properties":{}},"enabled":{"type":"boolean"},"documentContent":{"type":"string"}},"required":["tenantId","documentType","tenantUnitId"]}}}}
```

## PATCH /admin/api/v1/documents/{documentId}

> Partial update document

```json
{"openapi":"3.0.1","info":{"title":"TargetPilot-Admin-API","version":"1.0.0"},"servers":[{"url":"https://api.workfx.ai","description":"Wfx Dev Env V1"}],"security":[],"paths":{"/admin/api/v1/documents/{documentId}":{"patch":{"summary":"Partial update document","deprecated":false,"description":"","tags":[],"parameters":[{"name":"documentId","in":"path","description":"","required":true,"schema":{"type":"string"}},{"name":"tenantId","in":"query","description":"","required":true,"schema":{"type":"string"}},{"name":"X-Api-Key","in":"header","description":"the API Key","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string","description":"use url or storageBucket + storagePath"},"customProperties":{"type":"object","properties":{}},"enabled":{"type":"boolean"},"documentContent":{"type":"string"}}}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/document"}}},"headers":{}}}}}},"components":{"schemas":{"document":{"type":"object","properties":{"id":{"type":"string"},"tenantId":{"type":"string"},"tenantUnitId":{"type":"string"},"documentType":{"type":"string","enum":["UnstructuredFile","StructuredFile","UnstructuredWebpage","StructuredWebpage"]},"documentSubType":{"type":"string","enum":["pdf","txt","html","xml","json","csv","xlsx","docx"]},"documentName":{"type":"string"},"storageType":{"type":"string","description":"s3, gcs"},"storageBucket":{"type":"string","description":"use url or storageBucket + storagePath"},"storagePath":{"type":"string"},"url":{"type":"string","description":"use url or storageBucket + storagePath"},"createdTime":{"type":"string"},"updatedTime":{"type":"string"},"status":{"type":"string","enum":["created","processing","process_failed","processed"]},"createdBy":{"type":"string"},"updatedBy":{"type":"string"},"title":{"type":"string"},"category":{"type":"string"},"processingProgress":{"type":"number"},"customProperties":{"type":"object","properties":{}},"enabled":{"type":"boolean"},"documentContent":{"type":"string"}},"required":["tenantId","documentType","tenantUnitId"]}}}}
```

## PATCH /admin/api/v1/documents/{documentId}/toggle

> Toggle Document(Enable/Disable)

```json
{"openapi":"3.0.1","info":{"title":"TargetPilot-Admin-API","version":"1.0.0"},"servers":[{"url":"https://api.workfx.ai","description":"Wfx Dev Env V1"}],"security":[],"paths":{"/admin/api/v1/documents/{documentId}/toggle":{"patch":{"summary":"Toggle Document(Enable/Disable)","deprecated":false,"description":"","tags":[],"parameters":[{"name":"documentId","in":"path","description":"","required":true,"schema":{"type":"string"}},{"name":"tenantId","in":"query","description":"","required":true,"schema":{"type":"string"}},{"name":"X-Api-Key","in":"header","description":"the API Key","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"enabled":{"type":"boolean"}}}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{}}}},"headers":{}}}}}}}
```

## GET /admin/api/v1/api/v1/documents/{documentId}/documentChunks/

> List Document Chunks

```json
{"openapi":"3.0.1","info":{"title":"TargetPilot-Admin-API","version":"1.0.0"},"servers":[{"url":"https://api.workfx.ai","description":"Wfx Dev Env V1"}],"security":[],"paths":{"/admin/api/v1/api/v1/documents/{documentId}/documentChunks/":{"get":{"summary":"List Document Chunks","deprecated":false,"description":"","tags":[],"parameters":[{"name":"documentId","in":"path","description":"","required":true,"schema":{"type":"string"}},{"name":"page","in":"query","description":"default to 1 if not passing this query","schema":{"type":"integer"}},{"name":"pageSize","in":"query","description":"default to 10 if not passing this query","schema":{"type":"integer"}},{"name":"tenantId","in":"query","description":"","required":true,"schema":{"type":"string"}},{"name":"X-Api-Key","in":"header","description":"the API Key","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"content":{"type":"string"},"contentComplement":{"type":"string"},"createdTime":{"type":"string"},"documentId":{"type":"string"},"id":{"type":"string"},"keywords":{"type":"object","properties":{}},"metadata":{"type":"object","properties":{"file_directory":{"type":"string"},"filename":{"type":"string"},"filetype":{"type":"string"},"languages":{"type":"array","items":{"type":"string"}},"last_modified":{"type":"string"},"page_number":{"type":"integer"}},"required":["file_directory","filename","filetype","languages","last_modified","page_number"]},"status":{"type":"string"},"tenantId":{"type":"string"},"tenantUnitId":{"type":"string"},"updatedTime":{"type":"string"}},"required":["content","contentComplement","createdTime","documentId","id","keywords","metadata","status","tenantId","tenantUnitId","updatedTime"]}},"pagination":{"type":"object","properties":{"currentPage":{"type":"integer"},"pageSize":{"type":"integer"},"totalCount":{"type":"integer"},"totalPages":{"type":"integer"}},"required":["currentPage","pageSize","totalCount","totalPages"]}},"required":["data","pagination"]}}},"headers":{}}}}}}}
```

## POST /admin/api/v1/api/v1/documentChunks/search

> Document Chunks Search

```json
{"openapi":"3.0.1","info":{"title":"TargetPilot-Admin-API","version":"1.0.0"},"servers":[{"url":"https://api.workfx.ai","description":"Wfx Dev Env V1"}],"security":[],"paths":{"/admin/api/v1/api/v1/documentChunks/search":{"post":{"summary":"Document Chunks Search","deprecated":false,"description":"","tags":[],"parameters":[{"name":"tenantId","in":"query","description":"","required":true,"schema":{"type":"string"}},{"name":"X-Api-Key","in":"header","description":"the API Key","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"tenant_id":{"type":"string"},"tenant_unit_id":{"type":"string"},"dataset_ids":{"type":"array","items":{"type":"string"}},"query":{"type":"string"},"top_k":{"type":"integer","description":"default is 5"},"language":{"type":"string","description":"currently support  'english' or 'chinese' , default is 'english'"}},"required":["tenant_id","tenant_unit_id","dataset_ids","query"]}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"content":{"type":"string"},"content_complement":{"type":"string"},"created_time":{"type":"string"},"document_id":{"type":"string"},"document_name":{"type":"string"},"document_sub_type":{"type":"string"},"document_type":{"type":"string"},"id":{"type":"string"},"keywords":{"type":"array","items":{"type":"string"}},"metadata":{"type":"object","properties":{"dataset_ids":{"type":"array","items":{"type":"string"}}},"required":["dataset_ids"]},"score":{"type":"number"},"tenant_id":{"type":"string"},"tenant_unit_id":{"type":"string"},"updated_time":{"type":"string"}},"required":["content","content_complement","created_time","document_id","document_name","document_sub_type","document_type","id","keywords","metadata","score","tenant_id","tenant_unit_id","updated_time"]}}}},"headers":{}}}}}}}
```

## PATCH /admin/api/v1/api/v1/documents/{document\_id}/documentChunks/\<chunk\_id>

> Patch Document Chunks

```json
{"openapi":"3.0.1","info":{"title":"TargetPilot-Admin-API","version":"1.0.0"},"servers":[{"url":"https://api.workfx.ai","description":"Wfx Dev Env V1"}],"security":[],"paths":{"/admin/api/v1/api/v1/documents/{document_id}/documentChunks/<chunk_id>":{"patch":{"summary":"Patch Document Chunks","deprecated":false,"description":"","tags":[],"parameters":[{"name":"document_id","in":"path","description":"","required":true,"schema":{"type":"string"}},{"name":"tenantId","in":"query","description":"","required":true,"schema":{"type":"string"}},{"name":"X-Api-Key","in":"header","description":"the API Key","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"content":{"type":"string"},"keywords":{"type":"array","items":{"type":"string"}}}}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{}}}},"headers":{}}}}}}}
```

## DELETE /admin/api/v1/documents/{document\_id}/documentChunks/batch

> Batch Delete Document Chunks

```json
{"openapi":"3.0.1","info":{"title":"TargetPilot-Admin-API","version":"1.0.0"},"servers":[{"url":"https://api.workfx.ai","description":"Wfx Dev Env V1"}],"security":[],"paths":{"/admin/api/v1/documents/{document_id}/documentChunks/batch":{"delete":{"summary":"Batch Delete Document Chunks","deprecated":false,"description":"","tags":[],"parameters":[{"name":"document_id","in":"path","description":"","required":true,"schema":{"type":"string"}},{"name":"tenantUnitId","in":"query","description":"","required":false,"schema":{"type":"array","items":{"type":"string"}}},{"name":"tenantId","in":"query","description":"","required":false,"schema":{"type":"string"}},{"name":"X-Api-Key","in":"header","description":"the API Key","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{}}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{}}}},"headers":{}}}}}}}
```

## PATCH /admin/api/v1/documents/{document\_id}/documentChunks/batch/status

> Batch Change Document Chunks Status

```json
{"openapi":"3.0.1","info":{"title":"TargetPilot-Admin-API","version":"1.0.0"},"servers":[{"url":"https://api.workfx.ai","description":"Wfx Dev Env V1"}],"security":[],"paths":{"/admin/api/v1/documents/{document_id}/documentChunks/batch/status":{"patch":{"summary":"Batch Change Document Chunks Status","deprecated":false,"description":"","tags":[],"parameters":[{"name":"document_id","in":"path","description":"","required":true,"schema":{"type":"string"}},{"name":"tenantUnitId","in":"query","description":"","required":true,"schema":{"type":"string"}},{"name":"tenantId","in":"query","description":"","required":false,"schema":{"type":"string"}},{"name":"X-Api-Key","in":"header","description":"the API Key","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","description":"active or inactive"},"documentChunkIds":{"type":"array","items":{"type":"string"}}},"required":["status","documentChunkIds"]}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{}}}},"headers":{}}}}}}}
```

## PATCH /admin/api/v1/api/v1/documents/{document\_id}/documentChunks/\<chunk\_id>/status

> Change Document Chunks Status

```json
{"openapi":"3.0.1","info":{"title":"TargetPilot-Admin-API","version":"1.0.0"},"servers":[{"url":"https://api.workfx.ai","description":"Wfx Dev Env V1"}],"security":[],"paths":{"/admin/api/v1/api/v1/documents/{document_id}/documentChunks/<chunk_id>/status":{"patch":{"summary":"Change Document Chunks Status","deprecated":false,"description":"","tags":[],"parameters":[{"name":"document_id","in":"path","description":"","required":true,"schema":{"type":"string"}},{"name":"tenantUnitId","in":"query","description":"","required":true,"schema":{"type":"string"}},{"name":"tenantId","in":"query","description":"","required":true,"schema":{"type":"string"}},{"name":"X-Api-Key","in":"header","description":"the API Key","required":false,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","description":"active or inactive"}},"required":["status"]}}}},"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{}}}},"headers":{}}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.workfx.ai/workfx-companion-agent-knowledge/developer-docs/api-reference/documents.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
