Skip to content

Back to API List

Chunks APIs

Get Chunks By Condition

This API returns the complete list of chunks that satisfy the given condition in the request body.

Method POST
Endpoint <host_url>/api/public/bot/:botId/chunk/list
Content-Type application/json
Authorization auth: <JWT Token>
API Scope Chunk Management

Query Parameters

Parameters Description Mandatory
Bot ID Provide your application ID here. Yes

Request Parameters

Parameters Description Mandatory
filters This field is used to set the filters for selecting the chunks. Filters contains
  • Conditions: This is an array of conditions where each condition is a set of operands, which are applied on the conditions and the conditions to be applied.
  • Operand: The operand to be applied on all the conditions in the array.

    For instance, if the value of the filter field is set as shown below, then a logical OR operation is performed on the chunks using source name field, another logical OR is performed on chunks using the Record Title, and then an AND operation is performed on chunks filtered by above two conditions to further filter the result set. "conditions": [ { "operand": "or", "conditions": [ { "key": "sourceName", "op": "equals", "value": "https://www.blogs.kore.com/" }, { "key": "sourceName", "op": "equals", "value": "www.kore.com" } ] }, { "operand": "or", "conditions": [ { "key": "recordTitle", "op": "equals", "value": "FAQs" }, { "key": "recordTitle", "op": "equals", "value": "Frequently Asked Questions" } ] } ], "operand": "and" }

No. If no filters are provided, all the chunks are returned.
enableFilters Set this to true if the filter field is to be applied to the chunks in response. No
nextCursor Cursor are used for cursor based pagination. When cursor is not passed in the API, the first set of results are returned in the API. The response of the API returns the cursor value to be sent in the next API request to fetch the next set of results. Use the value in the response to set this cursor in the subsequent request. No
prevCursor Cursor are used for cursor based pagination. When cursor is not passed in the API, the first set of results are returned in the API. The response of the API returns the cursor value to be sent in the next API request to fetch the next set of results. Use the value of the cursor in the previous request. No

Sample Response

"count": 888,
   "chunks": [
       {
           "_id": "chk-fffb8f28-29c2-4afe-8d2c-9379dad4446c",
           "chunkTitle": "",
           "chunkText": "191 agreement of trial balance. Only the total of the trial balance would be short by Rs. 100. But if posting is not done in one of the accounts, this will affect the agreement of trial balance.    b) Errors of Commission Errors of commission take place when some transactions are incorrectly recorded in the books of accounts. Such errors include errors on account of wrong balancing of an account, wrong posting, wrong totalling, wrong carry forwards, etc. For example, if a sum of Rs. 255    received from John is credited to his account as Rs. 525, this is an error of commission.",
           "sourceType": "file",
           "sourceName": "Default Directory",
           "extractionMethod": "text",
           "chunkType": "Text",
           "chunkContent": "chunkText : 191    agreement of trial balance. Only the total of the trial balance would be    short by Rs. 100. But if posting is not done in one of the accounts, this    will affect the agreement of trial balance.    b) Errors of Commission    Errors of commission take place when some transactions are    incorrectly recorded in the books of accounts. Such errors include errors    on account of wrong balancing of an account, wrong posting, wrong    totalling, wrong carry forwards, etc. For example, if chunkTitle :  sourceName : Default Directory",
           "chunkId": "chk-fffb8f28-29c2-4afe-8d2c-9379dad4446c",
           "sourceUrl": "https://qa1-uxo.kore.ai:443/api/getMediaStream/findly/f-e7e04183-c53a-5013-9f93-f77f438aa7f9.pdf?n=4272962592&s=IkFHSDh1L3MxejB0OHU0MFg0MEVPV3AwSXRQZy9rbUhOOHh3RGdKaVpCSVk9Ig$$",
           "pageNumber": 191,
           "recordTitle": "accounts.pdf",
           "recordUrl": "https://qa1-uxo.kore.ai:443/api/getMediaStream/findly/f-e7e04183-c53a-5013-9f93-f77f438aa7f9.pdf?n=4272962592&s=IkFHSDh1L3MxejB0OHU0MFg0MEVPV3AwSXRQZy9rbUhOOHh3RGdKaVpCSVk9Ig$$#page=191",
           "docId": "fc-4de878cb-01a6-5557-a7a7-78992b743b77",
           "searchIndexId": "sidx-f9413800-94f8-51e0-b3d6-7d1b8187d6f6",
           "sourceId": "fs-4181a831-ef7b-5bb6-8adb-937be72ce275",
           "createdOn": "2024-11-19T13:45:45.914Z",
           "extractionStrategy": "Default Strategy",
           "fileType": "pdf",
           "chunkMeta": {}
       }
    ],
   "hasMore": true,
   "inOffsetPagination": true,
   "nextCursor": "eyJzZWFyY2hBZnRlciI6ImNoay1jMTFjZGMwZi05MmUwLTQzYTgtODc5OS1kZjAwZjA0MzExNDUiLCJza2lwIjoxMCwibGltaXQiOjEwLCJwcmV2Q3Vyc29yIjoiIn0=",
   "prevCursor": null

}

Update Chunks

This API is used to update a given chunk. The parameters provided in the request body are updated. If a parameter is missing, the value of that parameter in the chunk, remains same.

Method POST
Endpoint <host_url>/api/public/bot/:botId/chunk/:chunkId
Content-Type application/json
Authorization auth: <JWT Token>
API Scope Chunk Management

Query Parameters

Parameters Description Mandatory
Bot ID Provide your application ID here. Yes
ChunkID Provide the unique ID of the chunk to be updated. Yes

Request Parameters

It is mandatory to pass the whole of this chunk info in the request body. The field names should match as in the example below.

Sample Request

 "chunkText": "text",
  "chunkTitle": "title1",
  "pageNumber": "1",
  "recordTitle": "recordTitle",
  "recordUrl": "recordUrl",
  "sourceUrl": "sourceUrl",
  "chunkMeta": {}
}

Sample Response

{
    "indexPipelineId": "fip-8e8d41c7-e1c3-5f73-b764-09327de66de7_vector",
    "status_code": 200,
    "status_msg": "Documents updated successfully",
    "updated_documents": 1
}

Delete Chunks by ID API

This API enables targeted deletion of indexed content without requiring a full re-index. You can remove specific chunks from the Search Index by providing a list of chunk IDs, which the system uses to identify and delete the corresponding chunks.

This is useful for incremental cleanup, partial refresh scenarios, and lifecycle management of structured uploads.

Component Value
Method POST
URL /api/public/bot/{AppId}/search/delete-chunks-by-cond
Content-Type application/json
Authentication auth: <JWT Token>
API Scope Chunk Management

Path Parameters

Parameter Type Required Description
AppId string Yes Provide your application ID here. To view your App ID, go to the Dev Tools under App Settings. You can view the AppID under the API scopes.

Request Body Parameters

Field Type Required Description
chunkId string[] No An array of chunk IDs to delete.

Sample Requests

Example: Delete by chunkId

curl --location 'https://<HOST>/api/public/bot/<BOT_ID>/search/delete-chunks-by-cond' \
--header 'auth: <JWT_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
 "chunkId": [
   "chk-xxxx1", "chk-xxxx2"
 ]
}'

Response

Response Fields

Field Description
status Status of the chunk deletion job.
totalRequested Number of chunks requested for deletion.
totalDeleted Number of chunks successfully deleted.
totalNotFound Number of chunks that weren't found.

Sample Response

{
"Status": "success",   //status of the deletion action
"Data":
   { 
     "totalRequested":4,
     "totalDeleted":4, 
     "totalNotFound":0 
   } 
}

Error Messages

Error Code Message When It Occurs Recommended Action
400 One or more chunkIds don't exist. chunkId is not provided in the request body. Provide exactly one of the required fields.
401 Unauthorized Missing, invalid, or expired JWT token. Verify the auth header and regenerate the token.
404 Resource not found Invalid AppId or resource doesn't exist Verify the AppID
500 Internal server error Unexpected server-side failure Retry the request or contact support if the issue persists.