MoroccoAPIDocumentation
API reference

Choose a resource. Set the parameters. Try it.

No API keyJSON responsesOpen CORS

Count business days

GET/api/v2/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.

Parameters

02
stringRequired · Query

Start of the range, inclusive.

date
Pattern^\d{4}-\d{2}-\d{2}$
stringRequired · Query

End of the range, inclusive.

date
Pattern^\d{4}-\d{2}-\d{2}$
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.

dataobject

Requested result: a single object or a list.

data.fromstring

Start of the covered or requested period, inclusive.

data.tostring

End of the covered or requested period, inclusive.

data.inclusiveboolean

true means both the start and end dates are counted.

Accepted values: true

data.calendar_daysinteger

Number of calendar days in the interval, including both endpoints.

data.weekend_daysinteger

Weekend day names in meta; in data, the number of weekend days in the interval.

data.holiday_weekdaysinteger

Confirmed holidays falling outside the weekend, avoiding double counting.

data.business_daysinteger | null

Exact working-day count; null while holiday dates remain unconfirmed.

data.business_days_upper_boundinteger

Maximum possible working-day count; later confirmations may reduce it.

data.is_exactboolean

true 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
metaobject

Result context: sources, dates, license and pagination where applicable.

meta.datasetstring

Name of the dataset for this result or source.

Accepted values: "moroccan-public-holidays"

meta.totalinteger

Number of matching records before pagination; not the size of this page.

meta.licensestring

Reuse license. mixed means licenses differ: inspect each source.

meta.license_urlstring

Link to the license terms; null when no URL is supplied.

meta.reviewed_atstring

Date the calendar sources were last reviewed.

meta.transformation_versionstring

Version of the dataset conversion rules; separate from the API version.

meta.scopestring

Scope 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_completeboolean

true when all required dates in the requested calendar are confirmed.

meta.pending_holiday_daysinteger

Number of holiday days whose dates await official confirmation.

meta.sourcesobject[]

Sources used for this result, with their publishers and licenses.

meta.sources[].producerstring

Organization publishing the original data.

meta.sources[].source_urlstring

Source publication or dataset landing page.

meta.sources[].source_updated_atstring | null

Last 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.

errorobject

Details of a failed request; replaces data and meta.

error.codestring

Stable error code, such as RESOURCE_NOT_FOUND; use it in application logic.

error.messagestring

Human-readable error explanation; use code for application logic.

error.request_idstring

Identifier for this request, useful when reporting a problem.

Your request

GET · JSON

Base URL

Response

The live response will appear here.

Language changes the guide, not JSON keys or source values.