Upload a Attachment in ZOHO crm by API

Upload a Attachment in ZOHO crm by API

Tips of the Day


We can Upload the Attachment inside the Zoho CRM in a record using API.


File Type:- Any file type like (mp3,jpg,png).


First Get the file and make it a file


  1. resvp  = zoho.crm.getRecordById("Leads", lid);
  2. attachment_Id = resvp.get("MP3_File").getJSON("attachment_Id");
  3. downloaddata = invokeurl
  4. [
  5. url: "https://www.zohoapis.in/crm/v4/Leads/"+lid+"/actions/download_fields_attachment?fields_attachment_id="+attachment_Id
  6. type: GET
  7. connection : "zohocrm"
  8. ];
  9. downloaddata.setFileType("mp3");

  10. For check it’s file or not

  11. FileType = downloaddata.isFile()

  12. if(FileType == true)
  13. {
  14. Info “it’s a file;
  15. resvp1 = zoho.crm.attachFile("Leads", lid, downloaddata);
  16. Info resvp1;
  17. }
  18. else
  19. {
  20. Info “Not as a file”;
  21. }



Thanks & Regards
Piyush Goyal
Zoho Developer || 3+ years Experience
+91-8619164837