Delete an Agent API source file in the current workspace.
Endpoint
DELETE /agents/file/{file_id}
Returns 200 and a delete envelope. Repeated deletion returns 404, and writing this source file to an environment fails.
Path parametersfile_idstring (required)Source file IDThis endpoint has no request body or query parameters.Deleting a source file does not delete copies already written to an environment or published artifacts.If an environment template references the deleted source file, creating an environment from that template fails with 404 File not found. | Request example |
Response fieldsidstringDeleted source file IDobject stringSource file deletion result object type, fixed as file.deleteddeleted booleanWhether deletion succeeded, true when deletion succeeds | Response example |
Error codes
| HTTP status | Error type / code | Solution |
|---|---|---|
401 | authentication_error / invalid_api_key | Send a valid Authorization: Bearer $DASHSCOPE_API_KEY header |
404 | not_found_error / not_found_error | Use a source file ID that exists in the current workspace |
500 | server_error / server_error | Retry later. If it keeps failing, submit a ticket with x-request-id |