Upload a Photo

Purpose

To attach a photo to a record in Zoho CRM. You must include the photo in the request with content type as multipart/form data.

Endpoints

  • POST /{module_api_name}/{record_ID}/photo

Request Details

Request URL

{api-domain}/crm/{version}/{module_api_name}/{record_ID}/photo

Supported modules

Leads, Contacts, Accounts, Products, Deals, Vendors, and custom modules

Header

Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52

Scope

ZohoCRM.modules.ALL
(or)
ZohoCRM.modules.{module_name}.{operation_type}

Possible module names

leads, contacts, accounts, products, deals, vendors and custom modules

Possible operation types

ALL - Full access to images
WRITE - Edit photo data
CREATE - Create photo data

Parameters

  • restrict_triggersstring, optional

    Use this parameter to prevent the system from triggering associated workflows. 
    Possible value : workflow

Input

  • filefile, mandatory

    Choose the photo you want to upload. The allowed image formats are: PNG, JPEG, JPG, GIF, and BMP.

Note

  • The maximum allowed size for the photo is 10 MB.
  • The resolution of the photo must not exceed 10 MP.
  • You cannot upload a photo to a record that is in LOCKED state.

Sample Request

Copiedcurl "https://www.zohoapis.com/crm/v8/Leads/3000000038009/photo?restrict_triggers=workflow"
-X POST
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
-F "file=@img1.png"

In the request, "file=@img1.png" contains the sample input image.

Possible Errors

  • INVALID_REQUEST_METHODHTTP 400

    The request method is incorrect.
    Resolution: Use the HTTP PUT 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 upload photo.
    Resolution: Contact your system administrator.

  • INVALID_DATAHTTP 400

    You have specified an invalid record ID.
    Resolution: Specify a valid record ID.

  • RECORD_LOCKEDHTTP 400

    You cannot perform this operation as the record is locked.
    Resolution: Please wait until the record is unlocked.

  • INVALID_MODULEHTTP 400
    • The module name given seems to be invalid.
      Resolution: Specify a valid module.
    • The given module is not supported in API.
      Resolution: The modules such as Documents and Projects are not supported in the current API. Specify a supported module API name. Refer to the Supported Modules section at the beginning of this page.
  • OAUTH_SCOPE_MISMATCHHTTP 401

    Unauthorized
    Resolution: Client does not have ZohoCRM.modules.{module_name}.CREATE scope. Generate a new access token with valid scope. Refer to Scope section at the beginning of this page.

  • NO_PERMISSIONHTTP 403

    Permission denied to upload photo
    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

    Please check if the file size is in the correct range.
    Resolution: The photo you are trying to upload either exceeds the allowed size (10 MB) or the allowed resolution (10 MP). Ensure that the photo size and resolution are within the allowed range.

  • INTERNAL_ERRORHTTP 500

    Unexpected and unhandled exception in the server. 
    Resolution: Contact the support team at support@zohocrm.com.

Sample Response

Copied{
    "code": "SUCCESS",
    "details": {},
    "message": "photo uploaded successfully",
    "status": "success"
}