Home » Our Blog » Uploading a file into Zoho via API using CURL
January 13, 2014

Uploading a file into Zoho via API using CURL

Uploading a file into Zoho via API using CURL

The file upload via API into Zoho can be a problem for PHP developers. In this post we introduce a simple file uploading system. Before uploading a file via API, review the request parameters and their value type.

Request Parameters

Parameter Data Type Description
authtoken* String Encrypted alphanumeric string to authenticate your Zoho credentials.
scope* String Specify the value as crmapi
id* String Specify unique ID of the record to which the file has to be attached.
content* FileInputStream Pass the File Input Stream of the file

* – Mandatory parameter

Important Note:

  • The total file size should not exceed 20 MB.
  • Your program can request only 15 uploadFile calls per 5 min. If API User requests more than 15 calls, system will block the API access for 15 minutes.
  • If the size exceeds 20 MB, you will receive the following error message: “File size should not exceed 20 MB”.
  • The attached file will be available under the Attachments section in the Record Details Page.
  • Files can be attached to records in all modules except Reports, Dashboards and Forecasts.

Some analysis regarding the parameter:

authtoken: Always send this parameter appending with the request url irrespective with your request method whether get or post (e.g.: REQUEST_URL?AUTHTOKEN=**********). Otherwise you will get 4834 => Invalid Ticket Error.

scope: Like the authtoken, also send this parameter appending with your request url irrespective with your request method.

id: This parameter should go as one of the fields of CURL postfields. Remember one thing, when providing this parameter value please exclude “zcrm_” prefix from your Zoho ID. For example, if your Zoho record id is zcrm_807524000000244811 then just provide 807524000000244811 as the value of this parameter.

content: This is the most important part. DO NOT READ THE FILE CONTENT USING PHP FUNCTIONS (LIKE: file_get_contents() / stream_get_contents() / fread() ). INSTEAD, STORE THE FILE INTO YOUR FILE SYSTEM AND PROVIDE THE FILE URL AS A STRING PREPENDING AN ‘@’ SIGN BEFORE THE URL AND USE THIS PARAMETER AS ONE OF THE CURL POSTFIELDS PARAMETER (E.G.: ‘@/PATH/TO/YOUR/FILE’). This ‘@’ sign will tell the curl not to send the url but to send the file stream instead.

Sample Code for Zoho for this file upload.

For more help with CURL upload zoho API please visit:

The web development experts at Digital Firefly Marketing can help you with CURL upload Zoho API issues and an array of other development matters. Contact us to learn more about getting your site assessed and what we can do for you.

Complete the form to download

Don’t you wish you could pay for your morning coffee with just an email address?

    Congrats on the new ebook
    Thanks for downloading it.

    Digital Firefly Marketing is excited about our collection of eBooks.

    That’s because they are conceptualized, planned and written by us drawing from our expertise and experience. That means you get information that doesn’t just sound good, but has been used to actually help our clients.

    Be sure to check out all of our eBooks and contact us if you’d like help developing your website or building your marketing strategy.

    For now, pour yourself a beverage and tuck into our user-friendly eBooks to learn how you can improve your website’s visibility.

    Visit Our Blog

    No, Thanks. I’ll Check out Later.