Update Business Hours

Purpose

To update the details of the business hours of your org.

Request Details

Request URL

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

Header

Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52

Scope

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

Sample Request

Copiedcurl "https://www.zohoapis.com/crm/v6/settings/business_hours"
-X PUT
-d "@update.json"
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
-H "X-CRM-ORG:{your_org_id}"

Input JSON

  • idstring, mandatory

    The unique ID of the business hour you want to update. Use the Get Business Hours API to get this ID.

  • typestring, mandatory

    Represents whether you want to set the business hours for five or seven days a week, or a custom value. The possible values are 24*7, 24*5, and custom.

  • week_starts_onstring, mandatory

    The day of the week your business starts. The possible values include Sunday through Saturday.

  • business_daysJSON array, mandatory when you set type=24*5 or custom

    The days of the week your business operates on. This key is mandatory when type=24*5 or custom.

  • same_as_everydayboolean, optional

    Represents whether the business hours are the same everyday. When this value is false, the JSON array custom_timing becomes mandatory. When this value is true, the JSON array daily_timing becomes mandatory.

  • daily_timingJSON array, mandatory when same_as_everyday is true

    Represents the business timing for the week in the HH:mm format. For example: "daily_timing":["10:00","17:00"].

  • custom_timingJSON array, mandatory when same_as_everyday is false

    Contains the following keys in every JSON object of the array:

    • _delete - To delete a particular custom timing on a business day. The value for this key is null.
    • days - string, mandatory - The day of the week that has a custom time for business.Example: "days":"Monday".
    • business_timing - JSON array, mandatory - The business timing on that day in the HH:MM format. For example: "business_timing":["10:00","17:00"].

Input JSON

Copied{
    "business_hours": {
        "id":"3652397000001438001",
        "business_days": [
            "Monday",
            "Tuesday",
            "Wednesday",
            "Thursday"
        ],
        "week_starts_on": "Monday",
        "custom_timing": [
            {
                "days": "Monday",
                "business_timing": [
                    "10:00",
                    "17:00"
                ]
            },
            {
                "days": "Tuesday",
                "business_timing": [
                    "10:30",
                    "17:00"
                ]
            },
            {
                "days": "Wednesday",
                "business_timing": [
                    "11:00",
                    "17:00"
                ]
            },
            {
                "days": "Thursday",
                "business_timing": [
                    "09:00",
                    "18:30"
                ]
            },
            {
                "days": "Friday",
                "business_timing": [
                    "11:30",
                    "18:30"
                ],
                "_delete":null
            }
        ],
        "same_as_everyday": false,
        "type": "custom"
    }
}

Possible Errors

  • MANDATORY_NOT_FOUNDHTTP 400

    You have not specified either type or week_starts_on keys in the input.
    Resolution:type and week_starts_on keys are mandatory in the input. Refer to the details key in the response to find out the missing key.

  • DEPENDENT_FIELD_MISSINGHTTP 400

    You have not specified one or more of the dependent fields.
    Resolution:

    • For type=24*5 or custom, business_days is mandatory.
    • For type=custom, same_as_everyday is mandatory.
    • When same_as_everyday=true, daily_timing is mandatory.
    • When same_as_everyday=false, custom_timing is mandatory.

    Refer to the sample input for the structure of each of these keys.

  • INVALID_DATAHTTP 400

    Reasons and Resolutions:

    • For type=24*5, you have specified more or less than five business days. You must input exactly five business days.
    • The value for type is invalid. The possible values are 24*7, 24*5, and custom.
    • You have specified invalid values for business_days. The possible values are Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, and Saturday.
    • You have specified an invalid value for week_starts_on. The possible values are Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, or Saturday.
    • You have specified an invalid value for business_timing or daily_timing. The format is HH:mm.
    • Either custom_timing or daily_timing falls outside the business hours of your org. If the business hours of your org is from 10AM to 5PM, then the business timing on any particular day must fall within this time period.
    • The business_days key has more than seven values in the input. The maximum number of values in this array can only be seven. Check your input for any duplicate or invalid values.
  • 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.

  • 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.UPDATE scopes.

Sample Response

Copied{
    "business_hours": {
        "code": "SUCCESS",
        "details": {
            "id": "3652397000001438001"
        },
        "message": "Business Hours saved successfully",
        "status": "success"
    }
}