GET /v1/business-days
GET /v1/business-days?country=&from=&to= counts business days between two dates for one country. Both ends of the range count.
Parameters
| Parameter | Notes |
|---|---|
country | Sets both the holiday list and the weekend rule. |
from, to | YYYY-MM-DD, inside 2026. to must be on or after from. |
How the count works, with the January numbers
January 2026 in the US has 31 calendar days. 9 of them are weekend days. New Year's Day and Martin Luther King Jr. Day fall on weekdays. 31 minus 9 minus 2 gives 20, and 20 is what the endpoint returns. Run it in the try-it panel and check the arithmetic yourself.
For Saudi Arabia and Israel the weekend is Friday and Saturday, so a Sunday in Riyadh counts and a Friday does not. The business-day rules guide works through the edge cases.
Response fields
| Field | Meaning |
|---|---|
business_days | Count for the range, both endpoints included. |
total_days | Calendar days in the same range. |
weekend_days | Days excluded as weekend days. |
holidays_in_range | Weekday holidays inside the range, with dates and names. |
Examples you can run
curl:
curl -s "https://api.kingai.work/v1/business-days?country=US&from=2026-01-01&to=2026-01-31"Python:
import requests
j = requests.get('https://api.kingai.work/v1/business-days',
params={'country':'US','from':'2026-01-01','to':'2026-01-31'}).json()
print(j['business_days']) # 20Error codes
| HTTP | Code | Meaning |
|---|---|---|
| 400 | invalid_parameter | A parameter is missing or malformed, for example a date that is not YYYY-MM-DD. |
| 404 | country_not_found | The country code is not in the covered set of 12. |
| 404 | year_not_covered | Only 2026 is in the dataset. Other years return this error instead of a guess. |
Errors use one shape: {"error": {"code": "...", "message": "..."}}. Try the bad-country button in the console to see one.