Delete uploaded file
Interface Description
Delete one uploaded Markdown file and remove its readable page from the readable knowledge base.
Endpoint
| Field | Value |
|---|---|
| Method | DELETE |
| Path | /openapi/v2/knowledge-bases/{knowledgeBaseId}/source-files/{sourceFileId} |
| Operation ID | deleteSourceFile |
| Authentication | Bearer OpenAPI key |
Parameters
| Name | Location | Required | Type | Example | Description |
|---|---|---|---|---|---|
knowledgeBaseId | path | Yes | string | knowledge-base-11111111-1111-4111-8111-111111111111 | Knowledge-base identifier returned by knowledge-base APIs. |
sourceFileId | path | Yes | string | source-file-11111111-1111-4111-8111-111111111111 | Uploaded-file identifier returned by upload or uploaded-file list APIs. |
Idempotency-Key | header | Yes | string | mutation-2026-07-10-001 | Client-generated key for safely retrying the same request. Reuse the same value for retries so duplicate work is not created. |
If-Match | header | Yes | string | "1" | Current resourceRevision returned by the API. If the resource changed after it was read, the request returns a conflict instead of overwriting the newer change. |
Request Body
This operation has no request body.
Request Example
bash
curl -X DELETE "https://openapi.example.com/openapi/v2/knowledge-bases/knowledge-base-11111111-1111-4111-8111-111111111111/source-files/source-file-11111111-1111-4111-8111-111111111111" \
-H "Authorization: Bearer <openapi-key>" \
-H "Idempotency-Key: mutation-2026-07-10-001" \
-H "If-Match: \"1\""Successful Responses
202
File deletion accepted for background processing.
| Field | Required | Type | Description |
|---|---|---|---|
operation | Yes | object | File or directory change record returned by the request. |
deletion | Yes | object | Accepted deletion details. |
Success Response Example
json
{
"operation": {
"operationId": "deletion-33333333-3333-4333-8333-333333333333",
"knowledgeBaseId": "knowledge-base-11111111-1111-4111-8111-111111111111",
"kind": "source_file_delete",
"state": "processing",
"expectedResourceRevision": 1,
"targetKind": "source_file",
"targetId": "source-file-11111111-1111-4111-8111-111111111111",
"candidateRelativePath": "handbook/guide.md",
"result": null,
"errorCode": null,
"retryGuidance": "Check this change again after a short delay.",
"actions": {
"self": "/openapi/v2/knowledge-bases/knowledge-base-11111111-1111-4111-8111-111111111111/operations/deletion-33333333-3333-4333-8333-333333333333"
},
"createdAt": "2026-06-17T00:00:00.000Z",
"updatedAt": "2026-06-17T00:00:00.000Z",
"completedAt": null
},
"deletion": {
"sourceFileId": "source-file-11111111-1111-4111-8111-111111111111"
}
}Error Codes
The table below lists every error response documented for this operation.
| HTTP Status | Error Code | Explanation |
|---|---|---|
| 401 | UNAUTHORIZED | The Bearer API key is missing, malformed, unknown, revoked, or deleted. |
| 404 | NOT_FOUND | The requested resource was not found. |
| 409 | CONFLICT | The request conflicts with the resource's current state. |
| 422 | VALIDATION_ERROR | The request failed validation. |
| 429 | RATE_LIMITED | The request exceeded the configured rate limits. |
| 500 | INTERNAL_ERROR | The API encountered an internal error. |
| 503 | DATABASE_REPOSITORY_UNAVAILABLE | The data required by this operation is temporarily unavailable. |