Delete Related Records Using External ID

Purpose

To delete the related list records using external IDs.

Endpoints

  • DELETE /{module_API_name}/{external_field_value}/{related_list_API_name}/{external_field_value}

Request Details

Request URL

{api-domain}/crm/{version}/{module_API_name}/{external_field_value}/{related_list_API_name}/{external_field_value}

Header

Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52

X-EXTERNAL: {module_API_name}.{external_field_API_name}

Scope

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

Possible module names

leads, deals, contacts, accounts, products, campaigns, appointments, services, and pricebooks

Possible operation types

ALL - Full access to the related records
WRITE - Edit related records
DELETE - Delete related records from the module

De-linking a Contact and a Deal using their external IDs
  • In this example, extcontact3 and extdeal3 are the values of the external fields External_Contact_ID and External_Deal_ID in the Contacts and Deals modules, respectively. we will reference these values to delink the deal from the contact.

Sample Request

Copiedcurl "https://www.zohoapis.com/crm/v8/Contacts/extcontact3/Deals/extdeal3"
-X DELETE
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
-H "X-EXTERNAL: Contacts.External_Contact_ID"

Possible Errors

  • INVALID_DATAHTTP 400

    You have specified either an incorrect external ID of the related record or the base module's record. The details key in the response gives you the name of the external field whose ID is incorrect.
    Resolution: Specify the correct external ID of the related record.

  • AUTHORIZATION_FAILEDHTTP 400

    You do not have sufficient permission to delete related records.
    Resolution: Contact your system administrator.

  • 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 scope mentioned in the Scope section.

  • NO_PERMISSIONHTTP 403

    You do not have permission to delete related records.
    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 for the right URL.

  • 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": {
                "id": "111111000000094040"
            },
            "message": "relation removed",
            "status": "success"
        }
    ]
}