Upload File

Purpose

To upload a CSV file in ZIP format for bulk write API. The response contains the file_id. Use this ID while making the bulk write request.

 

Endpoints

Request Details

Request URL

https://content.zohoapis.com/crm/v5/upload

Header

Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52

feature: bulk-write - To indicate this is a bulk write job

X-CRM-ORG: zgid - The unique ID (zgid) of your organization obtained through the Organization API

Scope

scope=ZohoFiles.files.ALL

Input form-data

  • filefile, mandatory

    Choose the zip file you want to upload. 

    For modules such as Leads and Contacts, you can ZIP one CSV file in it, with a maximum of 25,000 records. If there are more records, make a separate API call by with a ZIP file containing the next 25,000 records in the module.

    Please note that the Subform and multi-module lookup (MxN linking module) fields are treated as separate modules in Zoho CRM. This is a parent-child modulecase, for example, the Contacts module is the parent module, and the subform within it is the child module. So, prepare separate CSV files for parent and child modules, then ZIP them together into a ZIP file and upload.

    For more details on preparing the input file for parent-child record imports, refer to Kaizen #131 - Bulk Write for parent-child records using Scala SDK. 

Note

  • To import parent-child module data in a single Bulk Write request:
    • Add multiple CSV files in one ZIP file.
    • Field mapping is mandatory.
  • To import subform or linking module records, specify their respective API names in the input request. Refer to the Create Bulk Write Job API for more details.

Sample Request

Copiedcurl "https://content.zohoapis.com/crm/v5/upload"
-X POST
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
-H "X-CRM-ORG: 56xxxx47"
-H "feature: bulk-write"
-F "file=@file.csv.zip"

Possible Errors

  • INVALID_FILE_FORMATHTTP 400

    The file you uploaded is not in the zip format.
    Resolution: Upload the file only in the zip format.

  • FILE_TOO_LARGEHTTP 413

    The file size is too large to process.
    Resolution: The maximum file size is 25MB.

  • INVALID_URL_PATTERNHTTP 404

    Please check if the URL trying to access is a correct one
    Resolution: The request URL specified is incorrect. Specify a valid request URL. Refer to request URL section above.

  • OAUTH_SCOPE_MISMATCHHTTP 401

    Unauthorized
    Resolution: Client does not have ZohoFiles.files.ALL. Create a new client with valid scope. Refer to scope section above.

  • NO_PERMISSIONHTTP 403

    Permission denied to create
    Resolution: The user does not have permission to upload files. Contact your system administrator.

  • INTERNAL_ERRORHTTP 500

    Internal Server Error
    Resolution: Unexpected and unhandled exception in Server. Contact support team.

  • INVALID_REQUEST_METHODHTTP 400

    The http request method type is not a valid one
    Resolution: You have specified an invalid HTTP method to access the API URL. Specify a valid request method. Refer to endpoints section above.

  • AUTHORIZATION_FAILEDHTTP 400

    User does not have sufficient privilege to create.
    Resolution: The user does not have the permission to upload file. Contact your system administrator.

Note

Refer to the Limitations page to learn more about the CSV file limits.

Sample Response

Copied{
    "status": "success",
    "code": "FILE_UPLOAD_SUCCESS",
    "message": "file uploaded.",
    "details": {
        "file_id": "111111000001492610",
        "created_time": "2018-12-31T12:00:00-12:00"
    }
    }