Add Business Hours
Purpose
Business hours define the working hours of an organization, and is typically based on the company's location.
Use this API to set the business hours for your organization. You can set the business hours for 24 hours five days a week, seven days a week, or set custom timings on each day of the week through this API.
Endpoints
- POST /settings/business_hours
Request Details
Request URL
{api-domain}/crm/{version}/settings/business_hours
Header
Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52
X-CRM-ORG:{your_org_id}
Scope
ZohoCRM.settings.business_hours.ALL
(or)
ZohoCRM.settings.business_hours.CREATE
Sample Request
Copiedcurl "https://www.zohoapis.com/crm/v8/settings/business_hours"
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
-d "@input.json"
-X POST
Input JSON
- 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:
- 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"].
Sample Input
Copied{
"business_hours": {
"business_days": [
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday"
],
"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"
]
}
],
"same_as_everyday": false,
"type": "custom"
}
}
Show full
Show less
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. - One or more mandatory keys are missing
Resolution: Specify all mandatory keys. Check the Input JSON to identify the required keys.
- You have not specified either type or week_starts_on keys in the input.
- DEPENDENT_FIELD_MISSINGHTTP 400
You have not specified one or more of the dependent fields.
Resolutions:- 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 Input JSON section 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.
- The values given in the "business_days" key exceed the value specified in the "type" key. Specify values within the allowed limits.
- Invalid data given in the input body. Specify valid values. Refer to the Input JSON for details on how to provide the correct values, or review the error cases mentioned above along with their respective resolutions. If these do not address your issue, please let us know your expectations by emailing us at support@zohocrm.com.
- NOT_ALLOWEDHTTP 400
You are trying to set business hours before creating your org.
Resolution: You can add business hours only after you create an organization. - 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 for details. - 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. - MINIMUM_DATA_NOT_FOUNDHTTP 400
The given values are less than the required value specified in the "type" key
Resolution: Specify values corresponding to the value given in the "type" field. Refer to the Input JSON for more details. - DEPENDENT_MISMATCHHTTP 400
The "End time" is incorrectly placed before the "Start time"
Resolution: Ensure that the "End time" is specified after the "Start time". - ALREADY_USEDHTTP 400
Duplicate days are provided in the "business_days" JSON array
Resolution: The "business_days" array must not contain duplicate values. For example, "Monday" should not appear more than once.
Sample Response
Copied{
"business_hours": {
"code": "SUCCESS",
"details": {
"id": "3652397000001438001"
},
"message": "Business Hours saved successfully",
"status": "success"
}
}