Add a Holiday

Purpose

Every business has its own holidays including the national holidays and the ones specific to the business or the region. Use this API to add holidays to your org.

Request Details

Request URL

{api-domain}/crm/{version}/settings/holidays

Header

Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52
X-CRM-ORG:{your_org_id}

Scope

scope=ZohoCRM.settings.business_hours.ALL
(or)
scope=ZohoCRM.settings.business_hours.CREATE

Sample Request

Copiedcurl "https://www.zohoapis.com/crm/v6/settings/holidays"
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
-H "X-CRM-ORG: {your_org_ID}"
-d "@input.json"
-X POST

Input JSON

  • namestring, mandatory

    The name of the holiday. Note that the special characters ~ , ` , # , % , & , + , = , [ , ] , { , } , | , ; , < , > , ^ are not allowed.

  • datestring, mandatory

    The date in the YYYY-MM-DD format that the holiday falls on.

  • typestring, mandatory

    The type of holiday. The possible values are shift_holiday and business_holiday. The default value is business_holiday.

  • shift_hourstring, mandatory when type=shift_holiday

    The unique ID of the shift hour you want to associate this holiday with. Use the Get Shift Hours API to get the ID.

Input JSON

Copied{
    "holidays": [
        {
            "name": "Founder's Day",
            "date": "2023-08-24",
            "type": "business_holiday"
        }
    ]
}

Possible Errors

  • INVALID_DATAHTTP 400

    Reasons:

    • The holiday name contains one or more of these special characters: ~ , ` , # , % , & , + , = , [ , ] , { , } , | , ; , < , > , ^.
    • The date, shift's ID, holiday type, or name is invalid.

    Resolution:
    Refer to the "details" key in the response for the API name of the field that has the error in the input.

  • MANDATORY_NOT_FOUNDHTTP 400

    One or more of these data is invalid - name, date, type.

    Resolution:
    Refer to the "details" key in the response for the API name of the field that has the error in the input.

  • DEPENDENT_FIELD_MISSINGHTTP 400

    You have not specified one or more of the dependent fields.
    Resolution: When you add holidays to a shift hour, the "type" key is mandatory.

  • API_NOT_SUPPORTEDHTTP 400

    You are trying the API from API version 2 or below.
    Resolution: This API is supported only from API version 2.1 and up.

  • LIMIT_EXCEEDEDHTTP 400

    You are trying to create more than 52 holidays per year.
    Resolution: A year cannot have more than 52 holidays.

  • OAUTH_SCOPE_MISMATCHHTTP 401

    You do not have the right scope to access this API.
    Resolution: Create new token with ZohoCRM.settings.business_hours.ALL or ZohoCRM.settings.business_hours.CREATE scopes.

  • INACTIVE_USERHTTP 403

    You are an inactive user in the org.
    Resolution: Inactive users cannot access this API. Contact the administrator.

  • NO_PERMISSIONHTTP 403

    You are not an admin.
    Resolution: Only admin users can set the holidays for the org.

  • 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 the request URL section above.

Sample Response

Copied{
    "holidays": [
        {
            "code": "SUCCESS",
            "details": {
                "id": "3652397000011199002"
            },
            "message": "Holiday created successfully",
            "status": "success"
        }
    ]
}