Skip to main content
Drives

Delete a File or Directory

Delete a specified file or directory in Drive.

Drive is currently in Beta. API definitions, response structures, and behavior may change. Follow documentation updates and verify compatibility before production use.
DELETE /api/v1/forward/drives/entries

Request Headers

HeaderRequiredDescription
AuthorizationYesBearer <PAT or SAT>
Content-TypeYesapplication/json

Query Parameters

ParameterTypeRequiredDescription
identity_idstringYesIdentity ID within the current authentication scope; supply exactly once. An Identity-level SAT can select only its bound Identity.

Request Body Parameters

ParameterTypeRequiredDescription
pathstringYesRelative path of the target file or directory; cannot be the root.
recursivebooleanNoDefaults to false. Must be true to delete a nonempty directory. When true, deletes any file at the same path and all objects under the directory.

Path Rules

  • Use a valid UTF-8 relative path such as projects/reports. Absolute paths such as /projects/reports or C:/projects/reports are not accepted.
  • Separate directories with /. Leading, trailing, or consecutive slashes, backslashes, and . or .. path segments are not allowed.
  • Leading or trailing whitespace, control characters, and % are not allowed, including escaped text such as projects%2Freports.

Example Request

curl --silent --show-error --fail-with-body -X DELETE \
  "https://api.qoder.com/api/v1/forward/drives/entries?identity_id=idn_xxx" \
  -H "Authorization: Bearer $QODER_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "path": "projects/demo",
    "recursive": true
  }'

Example Response

HTTP 200 OK
{
  "deleted_count": 3
}

Response Fields

FieldTypeDescription
deleted_countintegerNumber of storage objects confirmed deleted in this request; 0 if the target does not exist.

Errors

HTTPCodeCondition
400invalid_drive_pathThe path is invalid, deletion of the root was attempted, or the Identity identifier format is invalid.
400—The request body is not valid JSON, contains incorrect field types, or includes unknown fields.
400invalid_identity_ididentity_id is missing, empty, or supplied more than once.
401—Credentials are missing or invalid. Exchange a Service Account Key for a SAT first.
403identity_mismatchAn Identity-level SAT selected another Identity.
404identity_not_foundThe Identity was not found within the current authentication scope.
409drive_directory_not_emptyThe directory is not empty and recursive is not true.
413—The request body exceeds the service limit.
500—Internal server error.
503drive_delete_partialDeletion is incomplete. error.deleted_count gives the number confirmed deleted in this request. Retry the original request.
503drive_unavailableDrive storage, signing, or a dependency is temporarily unavailable.

HTTP Error Response

{
  "type": "error",
  "request_id": "req_xxx",
  "error": {
    "type": "invalid_request_error",
    "code": "invalid_drive_path",
    "message": "Invalid Drive path."
  }
}

Response Fields

FieldTypeDescription
typestringAlways error.
request_idstringRequest trace ID, returned when available.
error.typestringError category, such as invalid_request_error, authentication_error, permission_error, not_found_error, conflict_error, or api_error.
error.codestringBusiness error code; omitted for some common errors.
error.messagestringError description.
error.deleted_countintegerReturned only for drive_delete_partial: the number of objects confirmed deleted in this request, which may be 0.
drive_delete_partial means deletion is incomplete. Deleted files are not restored; retries process only the remaining files. Gateway authentication errors may use a different response structure.