Upload Files to Zoho File System (ZFS)
Purpose
ZFS is the central storage system to all your files and attachments. This API allows you to upload files to ZFS. When using this API, ensure that the file is uploaded with the content type set to multipart/form-data. Upon successful upload, the API returns an encrypted file ID along with the file name. You can utilize this encrypted ID to attach the file to a file/image upload field or a record image field in Zoho CRM through the Create or Update Records API.
Endpoints
- POST /files
Request Details
Request URL
{api-domain}/crm/{version}/files
Header
Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52
Scope
scope=ZohoCRM.Files.{operation_type}
Possible operation types
CREATE - To add files to ZFS
Parameters
- typestring, optional
To upload inline images.
Possible value: inline
Sample Request
Copiedcurl "https://www.zohoapis.com/crm/v8/files"
-X POST
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
-F "file=@connections.txt"
-F "file=@enable-signals.png"
CopiedfileVariable = invokeurl
[
url: "https://file-examples-com.github.io/uploads/2017/10/file-sample_150kB.pdf"
type: GET
];
fileVariable.setParamName("file");
response = invokeurl
[
url :"https://www.zohoapis.com/crm/v8/files"
type :POST
files: fileVariable
connection:"crm_oauth_connection"
];
info response;
Note
- The maximum size of each attachment is 20MB.
Possible Errors
- Failure_in_attachment_handling HTTP 400
invalid oauth scope to access this URL
Resolution: Problem in uploading attachment. Kindly upload the file properly. - INVALID_REQUEST_METHODHTTP 400
The request method is incorrect.
Resolution: Use the HTTP POST method to make this API call. Any other request method will result in this error. - AUTHORIZATION_FAILEDHTTP 400
User does not have sufficient privilege to create.
Resolution: Contact your system administrator. - VIRUS_DETECTEDHTTP 400
Unable to process your request. Virus has been detected.
Resolution: Upload a file without any viruses. - OAUTH_SCOPE_MISMATCHHTTP 401
The access token you have used to make this API call does not have the required scope.
Resolution: Generate a new access token with the required scopes for this API. Refer to the Scope section at the beginning of this page for the list of required scopes. - NO_PERMISSIONHTTP 403
Permission denied to create
Resolution: Contact your system administrator. - INVALID_URL_PATTERNHTTP 404
The request URL is incorrect.
Resolution: Specify a valid request URL. Refer to the Request URL section at the beginning of this page for more details. - FILE_SIZE_MORE_THAN_ALLOWED_SIZEHTTP 415
You are trying to upload a file that exceeds the maximum size limit.
Resolution: Upload files with a maximum size of 20 MB. - INTERNAL_ERRORHTTP 500
Unexpected and unhandled exception in the server.
Resolution: Contact the support team at support@zohocrm.com.
Sample Response
Copied{
"data": [
{
"code": "SUCCESS",
"details": {
"name": "connections.txt",
"id": "2cceafaxxxxxxxc065186"
},
"message": "connections.txt uploaded Succeessfully",
"status": "success"
},
{
"code": "SUCCESS",
"details": {
"name": "enable-signals.png",
"id": "2ccxxxxxxxxxxxb89e051a"
},
"message": "enable-signals.png uploaded Succeessfully",
"status": "success"
}
]
}