Count business days
Good to know. Religious holidays require official confirmation. An estimate is not confirmation. Weekends: Saturday and Sunday; date ranges are limited to 366 days.
Understand the context
The common public-administration calendar uses Saturday and Sunday as weekends. Religious holidays may await official confirmation: null means unknown, not a guaranteed working day. Business calendars may differ.
Read the response
data: The requested results, as an object or an array.
meta: Dataset sources, license and dates. null means unknown or unavailable.
API v2 is the canonical path. Older /api/v1 paths remain compatibility aliases for the currently published behavior, including pagination; no removal date is scheduled.
Response fields 10
[] means each item in a list. null means unknown or unavailable, never zero. The guide language does not translate source values.
dataobjectRequested result: a single object or a list.
data.fromstringStart of the covered or requested period, inclusive.
data.tostringEnd of the covered or requested period, inclusive.
data.inclusivebooleantrue means both the start and end dates are counted.
Accepted values:
truedata.calendar_daysintegerNumber of calendar days in the interval, including both endpoints.
data.weekend_daysintegerWeekend day names in meta; in data, the number of weekend days in the interval.
data.holiday_weekdaysintegerConfirmed holidays falling outside the weekend, avoiding double counting.
data.business_daysinteger | nullExact working-day count; null while holiday dates remain unconfirmed.
data.business_days_upper_boundintegerMaximum possible working-day count; later confirmations may reduce it.
data.is_exactbooleantrue when the count is certain; false when dates remain unconfirmed.
Data structure
{
"type": "object",
"additionalProperties": false,
"required": [
"data",
"meta"
],
"properties": {
"data": {
"type": "object",
"additionalProperties": false,
"required": [
"from",
"to",
"inclusive",
"calendar_days",
"weekend_days",
"holiday_weekdays",
"business_days",
"business_days_upper_bound",
"is_exact"
],
"properties": {
"from": {
"type": "string",
"pattern": "^\\d{4}-\\d{2}-\\d{2}$",
"format": "date"
},
"to": {
"type": "string",
"pattern": "^\\d{4}-\\d{2}-\\d{2}$",
"format": "date"
},
"inclusive": {
"enum": [
true
]
},
"calendar_days": {
"type": "integer",
"minimum": 0
},
"weekend_days": {
"type": "integer",
"minimum": 0
},
"holiday_weekdays": {
"type": "integer",
"minimum": 0
},
"business_days": {
"anyOf": [
{
"type": "integer",
"minimum": 0
},
{
"type": "string",
"nullable": true,
"enum": [
null
]
}
]
},
"business_days_upper_bound": {
"type": "integer",
"minimum": 0
},
"is_exact": {
"type": "boolean"
}
}
},
"meta": {
"type": "object",
"additionalProperties": false,
"required": [
"dataset",
"total",
"license",
"license_url",
"reviewed_at",
"transformation_version",
"scope",
"weekend_days",
"years",
"calendar_complete",
"pending_holiday_days",
"sources",
"limitations"
],
"properties": {
"dataset": {
"enum": [
"moroccan-public-holidays"
]
},
"total": {
"type": "integer",
"minimum": 0
},
"license": {
"type": "string"
},
"license_url": {
"type": "string"
},
"reviewed_at": {
"type": "string",
"pattern": "^\\d{4}-\\d{2}-\\d{2}$",
"format": "date"
},
"transformation_version": {
"type": "string"
},
"scope": {
"enum": [
"public-administration-common-calendar"
]
},
"weekend_days": {
"type": "array",
"items": {
"type": "string",
"enum": [
"Saturday",
"Sunday"
]
}
},
"years": {
"type": "array",
"items": {
"type": "integer"
}
},
"calendar_complete": {
"type": "boolean"
},
"pending_holiday_days": {
"type": "integer",
"minimum": 0
},
"sources": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"required": [
"producer",
"source_url",
"source_updated_at"
],
"properties": {
"producer": {
"type": "string"
},
"source_url": {
"type": "string"
},
"source_updated_at": {
"anyOf": [
{
"type": "string",
"pattern": "^\\d{4}-\\d{2}-\\d{2}$",
"format": "date"
},
{
"type": "string",
"nullable": true,
"enum": [
null
]
}
]
}
}
}
},
"limitations": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
}Sources and pagination 17
metaobjectResult context: sources, dates, license and pagination where applicable.
meta.datasetstringName of the dataset for this result or source.
Accepted values:
"moroccan-public-holidays"meta.totalintegerNumber of matching records before pagination; not the size of this page.
meta.licensestringReuse license. mixed means licenses differ: inspect each source.
meta.license_urlstringLink to the license terms; null when no URL is supplied.
meta.reviewed_atstringDate the calendar sources were last reviewed.
meta.transformation_versionstringVersion of the dataset conversion rules; separate from the API version.
meta.scopestringScope covered by the dataset; does not imply universal coverage.
Accepted values:
"public-administration-common-calendar"meta.weekend_daysstring[]Weekend day names in meta; in data, the number of weekend days in the interval.
meta.yearsinteger[]Years covered by the calendar.
meta.calendar_completebooleantrue when all required dates in the requested calendar are confirmed.
meta.pending_holiday_daysintegerNumber of holiday days whose dates await official confirmation.
meta.sourcesobject[]Sources used for this result, with their publishers and licenses.
meta.sources[].producerstringOrganization publishing the original data.
meta.sources[].source_urlstringSource publication or dataset landing page.
meta.sources[].source_updated_atstring | nullLast update reported by the source; not the retrieval date.
meta.limitationsstring[]Known source or coverage limitations; read before using the data.
Errors
400: Invalid or missing parameter.
Errors return error.code, error.message and error.request_id.
errorobjectDetails of a failed request; replaces data and meta.
error.codestringStable error code, such as RESOURCE_NOT_FOUND; use it in application logic.
error.messagestringHuman-readable error explanation; use code for application logic.
error.request_idstringIdentifier for this request, useful when reporting a problem.