---
title: "POST /knowledgebases/{knowledgeBaseId}/datasources/{dataSourceId}/documents/deleteDocuments"
method: POST
path: "/knowledgebases/{knowledgeBaseId}/datasources/{dataSourceId}/documents/deleteDocuments"
---

# POST /knowledgebases/{knowledgeBaseId}/datasources/{dataSourceId}/documents/deleteDocuments

`POST /knowledgebases/{knowledgeBaseId}/datasources/{dataSourceId}/documents/deleteDocuments`

Deletes documents from a data source and syncs the changes to the knowledge base that is connected to it. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/kb-direct-ingestion.html">Ingest changes directly into a knowledge base</a> in the Amazon Bedrock User Guide.

## Path parameters

- `knowledgeBaseId` string, required
- `dataSourceId` string, required

## Request body

- object
  - `clientToken` string — A unique, case-sensitive identifier to ensure that the API request completes no more than one time. If this token matches a previous request, Amazon Bedrock ignores the request, but does not return an error. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html">Ensuring idempotency</a>.
  - `documentIdentifiers` DocumentIdentifier[], required — A list of objects, each of which contains information to identify a document to delete.
    - `dataSourceType` 'CUSTOM' | 'S3', required — The type of data source connected to the knowledge base that contains the document.
    - `s3` object — Contains information that identifies the document in an S3 data source.
      - `uri` string, required — The location's URI. For example, <code>s3://my-bucket/chunk-processor/</code>.
    - `custom` object — Contains information that identifies the document in a custom data source.
      - `id` string, required — The identifier of the document to ingest into a custom data source.

## Response `202`

Success

- DeleteKnowledgeBaseDocumentsResponse
  - `documentDetails` KnowledgeBaseDocumentDetail[] — A list of objects, each of which contains information about the documents that were deleted.
    - `knowledgeBaseId` string, required — The identifier of the knowledge base that the document was ingested into or deleted from.
    - `dataSourceId` string, required — The identifier of the data source connected to the knowledge base that the document was ingested into or deleted from.
    - `status` 'INDEXED' | 'PARTIALLY_INDEXED' | 'PENDING' | 'FAILED' | 'METADATA_PARTIALLY_INDEXED' | 'METADATA_UPDATE_FAILED' | 'IGNORED' | 'NOT_FOUND' | 'STARTING' | 'IN_PROGRESS' | 'DELETING' | 'DELETE_IN_PROGRESS', required — <p>The ingestion status of the document. The following statuses are possible:</p> <ul> <li> <p>STARTING – You submitted the ingestion job containing the document.</p> </li> <li> <p>PENDING – The document is waiting to be ingested.</p> </li> <li> <p>IN_PROGRESS – The document is being ingested.</p> </li> <li> <p>INDEXED – The document was successfully indexed.</p> </li> <li> <p>PARTIALLY_INDEXED – The document was partially indexed.</p> </li> <li> <p>METADATA_PARTIALLY_INDEXED – You submitted metadata for an existing document and it was partially indexed.</p> </li> <li> <p>METADATA_UPDATE_FAILED – You submitted a metadata update for an existing document but it failed.</p> </li> <li> <p>FAILED – The document failed to be ingested.</p> </li> <li> <p>NOT_FOUND – The document wasn't found.</p> </li> <li> <p>IGNORED – The document was ignored during ingestion.</p> </li> <li> <p>DELETING – You submitted the delete job containing the document.</p> </li> <li> <p>DELETE_IN_PROGRESS – The document is being deleted.</p> </li> </ul>
    - `identifier` object, required — Contains information that identifies the document.
      - `dataSourceType` 'CUSTOM' | 'S3', required — The type of data source connected to the knowledge base that contains the document.
      - `s3` object — Contains information that identifies the document in an S3 data source.
        - `uri` string, required — The location's URI. For example, <code>s3://my-bucket/chunk-processor/</code>.
      - `custom` object — Contains information that identifies the document in a custom data source.
        - `id` string, required — The identifier of the document to ingest into a custom data source.
    - `statusReason` string — The reason for the status. Appears alongside the status <code>IGNORED</code>.
    - `updatedAt` string, date-time — The date and time at which the document was last updated.

## Other responses

- `480` — ThrottlingException
- `481` — AccessDeniedException
- `482` — ValidationException
- `483` — InternalServerException
- `484` — ResourceNotFoundException
- `485` — ServiceQuotaExceededException

---

[API](https://skmtc.net/aws/apis/bedrock-agent.md) · [All operations](https://skmtc.net/aws/apis/bedrock-agent/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/aws/bedrock-agent/versions/a3b2356f17da/schema)
