Skip to content

Move uploaded file ​

Interface Description ​

Rename an uploaded Markdown file or move it to an existing uploaded directory.

Endpoint ​

FieldValue
MethodPATCH
Path/openapi/v2/knowledge-bases/{knowledgeBaseId}/source-files/{sourceFileId}
Operation IDmoveSourceFile
AuthenticationBearer OpenAPI key

Parameters ​

NameLocationRequiredTypeExampleDescription
knowledgeBaseIdpathYesstringknowledge-base-11111111-1111-4111-8111-111111111111Knowledge-base identifier returned by knowledge-base APIs.
sourceFileIdpathYesstringsource-file-11111111-1111-4111-8111-111111111111Uploaded-file identifier returned by upload or uploaded-file list APIs.
Idempotency-KeyheaderYesstringmutation-2026-07-10-001Client-generated key for safely retrying the same request. Reuse the same value for retries so duplicate work is not created.
If-MatchheaderYesstring"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 ​

application/json ​

FieldRequiredTypeExampleDescription
relativePathYesstringhandbook/setup/install.mdTarget Markdown path inside the knowledge base. Its parent directory must already exist, except when moving the file to the root directory.

Request Example ​

bash
curl -X PATCH "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\"" \
  -H "Content-Type: application/json" \
  --data '{
  "relativePath": "handbook/setup/install.md"
}'

Successful Responses ​

202 ​

File move or rename request accepted for background processing.

FieldRequiredTypeDescription
operationYesobjectFile or directory change record returned by the request.

Success Response Example ​

json
{
  "operation": {
    "operationId": "source-move-11111111-1111-4111-8111-111111111111",
    "knowledgeBaseId": "knowledge-base-11111111-1111-4111-8111-111111111111",
    "kind": "source_file_move",
    "state": "processing",
    "expectedResourceRevision": 1,
    "targetKind": "source_file",
    "targetId": "source-file-11111111-1111-4111-8111-111111111111",
    "candidateRelativePath": "handbook/setup/install.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/source-move-11111111-1111-4111-8111-111111111111"
    },
    "createdAt": "2026-06-17T00:00:00.000Z",
    "updatedAt": "2026-06-17T00:00:00.000Z",
    "completedAt": null
  }
}

Error Codes ​

The table below lists every error response documented for this operation.

HTTP StatusError CodeExplanation
401UNAUTHORIZEDThe Bearer API key is missing, malformed, unknown, revoked, or deleted.
404NOT_FOUNDThe requested resource was not found.
409CONFLICTThe request conflicts with the resource's current state.
413PAYLOAD_TOO_LARGEThe request body or requested file exceeds the size limit for this operation.
422VALIDATION_ERRORThe request failed validation.
429RATE_LIMITEDThe request exceeded the configured rate limits.
500INTERNAL_ERRORThe API encountered an internal error.
503DATABASE_REPOSITORY_UNAVAILABLEThe data required by this operation is temporarily unavailable.

Next Steps ​