Skip to main content
Back to API List

Get Chunks By Condition

This API returns the complete list of chunks that satisfy the given condition in the request body.
FieldValue
MethodPOST
Endpoint<host_url>/api/public/bot/:botId/chunk/list
Content-Typeapplication/json
Authorizationauth: <JWT Token>
API ScopeChunk Management

Query Parameters

ParameterDescriptionMandatory
Bot IDProvide your application ID here.Yes

Request Parameters

ParameterDescriptionMandatory
filtersUsed to set filters for selecting chunks. filters contains: Conditions — an array of conditions where each condition is a set of operands applied on the conditions; and Operand — the operand applied on all conditions in the array. For example, a logical OR on sourceName, another OR on recordTitle, and an AND combining both results. See the example below.No. If no filters are provided, all chunks are returned.
enableFiltersSet to true to apply the filter field to chunks in the response.No
nextCursorUsed for cursor-based pagination. Omit on first request; use the cursor value from the previous response to fetch the next set of results.No
prevCursorUsed for cursor-based pagination. Use the cursor value from the previous request.No
Example filter:
{
  "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"
}

Sample Response

{
  "count": 888,
  "chunks": [
    {
      "_id": "chk-fffb8f28-29c2-4afe-8d2c-9379dad4446c",
      "chunkTitle": "",
      "chunkText": "191 agreement of trial balance...",
      "sourceType": "file",
      "sourceName": "Default Directory",
      "extractionMethod": "text",
      "chunkType": "Text",
      "chunkContent": "chunkText : 191 agreement of trial balance...",
      "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 updates a given chunk. Only parameters included in the request body are updated; omitted parameters retain their existing values.
FieldValue
MethodPOST
Endpoint<host_url>/api/public/bot/:botId/chunk/:chunkId
Content-Typeapplication/json
Authorizationauth: <JWT Token>
API ScopeChunk Management

Query Parameters

ParameterDescriptionMandatory
Bot IDProvide your application ID here.Yes
ChunkIDUnique ID of the chunk to be updated.Yes

Request Parameters

Pass the full chunk info in the request body. Field names must match 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

This API enables targeted deletion of indexed content without a full re-index. Provide a list of chunk IDs to identify and delete the corresponding chunks from the Search Index. Useful for incremental cleanup, partial refresh scenarios, and lifecycle management of structured uploads.
FieldValue
MethodPOST
URL/api/public/bot/{AppId}/search/delete-chunks-by-cond
Content-Typeapplication/json
Authenticationauth: <JWT Token>
API ScopeChunk Management

Path Parameters

ParameterTypeRequiredDescription
AppIdstringYesYour application ID. To view it, go to Dev Tools under App Settings and check the API scopes.

Request Body Parameters

FieldTypeRequiredDescription
chunkIdstring[]NoAn array of chunk IDs to delete.

Sample Request

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
FieldDescription
statusStatus of the chunk deletion job.
totalRequestedNumber of chunks requested for deletion.
totalDeletedNumber of chunks successfully deleted.
totalNotFoundNumber of chunks that were not found.

Sample Response

{
  "Status": "success",
  "Data": {
    "totalRequested": 4,
    "totalDeleted": 4,
    "totalNotFound": 0
  }
}

Error Messages

Error CodeMessageWhen It OccursRecommended Action
400One or more chunkIds don’t exist.chunkId is not provided in the request body.Provide exactly one of the required fields.
401UnauthorizedMissing, invalid, or expired JWT token.Verify the auth header and regenerate the token.
404Resource not foundInvalid AppId or resource doesn’t exist.Verify the AppID.
500Internal server errorUnexpected server-side failure.Retry the request or contact support if the issue persists.