Business Days Calculation
Math & Calculations Credits / request: 1Counts business days between dates or adds business days. Country code excludes public holidays.
GET
https://api.apikodu.com/api/v1/math/businessdays
Documentation
Overview
Business-day difference or add. Public holidays excluded when countryCode is set.
Authentication
Every request requires the x-api-key header. Credits used and remaining quota are returned in response headers (x-api-credits-used, x-api-remaining-credits, x-rate-limit-*).
Request
GET
https://api.apikodu.com/api/v1/math/businessdays?mode=diff&fromDate=2026-01-01&toDate=2026-01-31&countryCode=EE
Query string.
Parameters
| Name | Type | Required | Default | Options | Description |
|---|---|---|---|---|---|
mode |
string | Optional | diff |
diff add |
diff or add. |
fromDate |
string | * Required | — | — | Start YYYY-MM-DD. |
toDate |
string | Optional | — | — | End for diff. |
days |
integer | Optional | — | — | Business days for add (may be negative). |
countryCode |
string | Optional | — | — | ISO country (EE, TR, DE ...). |
includeBreakdown |
boolean | Optional | true |
true false |
Holiday breakdown. |
Response
| Name | Type | Description |
|---|---|---|
mode |
string | Applied mode: diff or add. |
days |
integer | diff: business days in the range. add: business days added/subtracted. |
fromDate |
string | Normalized start YYYY-MM-DD. |
toDate |
string | diff: end date. add: may stay equal to fromDate. |
resultDate |
string | add: resulting business date YYYY-MM-DD. diff: null. |
countryCode |
string | ISO country code used. Null if omitted (no holiday exclusion). |
holidays |
array | Excluded public holidays. May be empty without countryCode or when includeBreakdown=false. |
holidays[].date |
string | Holiday date YYYY-MM-DD. |
holidays[].name |
string | Holiday name in English. |
Errors
| HTTP | code | Description |
|---|---|---|
400 |
-242 |
mode is not diff or add. |
400 |
-247 |
fromDate missing/invalid. toDate is also required for diff. |
400 |
-241 |
days is missing in add mode. |
400 |
-243 |
countryCode is not ISO 3166-1 alpha-2 or is unknown. |
401 |
-100 |
x-api-key is missing, empty, malformed, inactive, banned, expired, IP-restricted, or not allowed for this API. |
429 |
-221 |
Per-minute request limit exceeded. Response headers: x-rate-limit-limit, x-rate-limit-remaining, x-rate-limit-reset. |
429 |
— | Package credit quota cannot cover this request. Body may be { error, limit, currentUsage, requestCost } (no code field). |
500 |
-1 |
Unexpected server error. message is a generic error text without technical details. |
Notes
- Success body is { data: { ... } }. Error body is { code, message }. code is an ApiResponseCode enum value (negative integer).
Sample response
{
"data": {
"mode": "diff",
"days": 20,
"fromDate": "2026-01-01",
"toDate": "2026-01-31",
"resultDate": null,
"countryCode": "EE",
"holidays": [
{
"date": "2026-01-01",
"name": "New Year's Day"
}
]
}
}
Code samples
const response = await fetch('https://api.apikodu.com/api/v1/math/businessdays', {
method: 'GET',
headers: {
'x-api-key': 'YOUR_API_KEY'
}
});
const data = await response.json();
console.log(data);
import requests
headers = {
'x-api-key': 'YOUR_API_KEY'
}
response = requests.get('https://api.apikodu.com/api/v1/math/businessdays', headers=headers)
print(response.json())
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("x-api-key", "YOUR_API_KEY");
var response = await client.GetStringAsync("https://api.apikodu.com/api/v1/math/businessdays");
Console.WriteLine(response);
$response = file_get_contents('https://api.apikodu.com/api/v1/math/businessdays', false, stream_context_create([
'http' => [
'header' => "x-api-key: YOUR_API_KEY"
]
]));
print_r(json_decode($response, true));
curl -X GET 'https://api.apikodu.com/api/v1/math/businessdays' \
-H 'x-api-key: YOUR_API_KEY'
Start building in minutes
Create a free account, get your API key and send your first request in minutes.