Delete an Attachment

Purpose

To delete a file attached to a record.

Request URL

https://www.zohoapis.com/crm/v2/{module_api_name}/{record_id}/Attachments/{attachment_id}

module_api_name - The API name of the module

record_id - The unique ID of the record

attachment_id - The unique ID of the attachment

Modules supported in Get List of Attachments are supported here.

Request Method

DELETE

Scope

scope=ZohoCRM.modules.all
(or)
scope=ZohoCRM.modules.{module_name}.{operation_type}
(and) scope=ZohoCRM.modules.attachments.all

 
Possible module namesPossible operation types
leads, accounts, contacts, deals, campaigns, tasks, cases, events, calls, solutions, products, vendors, pricebooks, quotes, salesorders, purchaseorders, invoices, custom, and notesALL - Full access to attachments
DELETE - Delete attachment data

Sample Request


				curl "https://www.zohoapis.com/crm/v2/Leads/2883756000000261075/Attachments/2883756000000261017"
-X DELETE
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"			

Sample Response


				{
    "data": [
       {
            "code": "SUCCESS",
            "details": {
                "id": "2883756000000261017"
            },
            "message": "record deleted",
            "status": "success"
        }
    ]
}			

Sample Request


				ZCRMRecord recordIns = ZCRMRecord.getInstance("Leads", 3719520000000329001L); //module api name with record id
APIResponse response = recordIns.deleteAttachment(3719520000000484004L); //attachmentID
JSONObject attachment = response.getResponseJSON(); 			

Sample Response


				{
    "data": [
       {
            "code": "SUCCESS",
            "details": {
                "id": "3719520000000484004"
            },
            "message": "record deleted",
            "status": "success"
        }
    ]
}			

Sample Request


				def delete_attachment(self):
        try:
            record = ZCRMRecord.get_instance('Leads', 3719520000000326007)
            resp = record.delete_attachment(3719520000000518001)
            print(resp.status_code)
            print(resp.code)
            print(resp.details)
            print(resp.message)
            print(resp.status)
        except ZCRMException as ex:
            print(ex.status_code)
            print(ex.error_message)
            print(ex.error_code)
            print(ex.error_details)
            print(ex.error_content)			

Sample Response


				{
    "data": [
       {
            "code": "SUCCESS",
            "details": {
                "id": "2883756000000261017"
            },
            "message": "record deleted",
            "status": "success"
        }
    ]
}			

Sample Request


				ZCRMRecord recordIns = ZCRMRecord.GetInstance("Leads", 3372164000000614001); //module api name with record id
APIResponse response = recordIns.DeleteAttachment(3372164000001374374); //attachmentID
JObject attachment = response.ResponseJSON; //attachment is JArray			

Sample Response


				{
    "data": [
       {
            "code": "SUCCESS",
            "details": {
                "id": "2883756000000261017"
            },
            "message": "record deleted",
            "status": "success"
        }
    ]
}