AnvilJSON utilities

Anvil › Docs › /v1/workdays

Working days calculator API: count or add business days

Two questions every invoice, contract and delivery estimate runs into: how many working days are there between these dates, and what date is 10 working days from now? Weekends are skipped, and if you give a region its bank holidays are too.

In one line: GET /v1/workdays?from=2026-12-01&to=2026-12-31&region=ca-on&set=statutory returns JSON. No key, CORS on, 60 requests a minute.
GET

/v1/workdays

Count working days between two dates, or add working days to a date. Change the values and press Send request to call the live API.

Parameters

NameTypeWhat it doesDefault
from requiredstringStart date, YYYY-MM-DD—
tostringEnd date (inclusive) for counting—
addintegerInstead of 'to': add this many working days (negative goes back)—
regionstringAlso skip this region's holidays
Allowed: gb-eng, gb-wls, gb-sct, gb-nir, ie, us, de, de-bw, de-by, de-be, de-bb, de-hb, de-hh, de-he, de-mv, de-ni, de-nw, de-rp, de-sl, de-sn, de-st, de-sh, de-th, ca, ca-ab, ca-bc, ca-mb, ca-nb, ca-nl, ca-ns, ca-nt, ca-nu, ca-on, ca-pe, ca-qc, ca-sk, ca-yt, au, au-act, au-nsw, au-nt, au-qld, au-sa, au-tas, au-vic, au-wa, nz, fr, nl
—
setstringFor Canada: observed or statutory (only used with region)—

Example

Request:

GET https://api.oddlathe.com/v1/workdays?from=2026-12-01&to=2026-12-31&region=ca-on&set=statutory

Response (generated by the real code when these docs were last built; random or time-based values will differ for you):

{
 "from": "2026-12-01",
 "to": "2026-12-31",
 "region": "ca-on",
 "set": "statutory",
 "calendar_days": 31,
 "working_days": 21,
 "holidays_skipped": [
  "2026-12-25",
  "2026-12-28"
 ]
}

Code examples

curl
curl 'https://api.oddlathe.com/v1/workdays?from=2026-12-01&to=2026-12-31&region=ca-on&set=statutory'
JavaScript (browser or Node 18+)
const params = new URLSearchParams({
  from: "2026-12-01",
  to: "2026-12-31",
  region: "ca-on",
  set: "statutory"
});
const res = await fetch(`https://api.oddlathe.com/v1/workdays?${params}`);
if (!res.ok) throw new Error((await res.json()).error.message);
const data = await res.json();
console.log(data);
Python (standard library only)
import json, urllib.parse, urllib.request

params = urllib.parse.urlencode({"from": "2026-12-01", "to": "2026-12-31", "region": "ca-on", "set": "statutory"})
url = "https://api.oddlathe.com/v1/workdays?" + params
# Send a User-Agent: the edge network refuses Python's default one.
req = urllib.request.Request(url, headers={"User-Agent": "my-script/1.0"})
with urllib.request.urlopen(req, timeout=10) as r:
    data = json.load(r)
print(data)

When it's useful

  • Payment terms like "due in 30 working days"
  • Delivery or support SLA dates
  • Counting leave days in a date range

Good to know

  • Counting includes both ends of the range. The response also lists which holidays were skipped.
  • Adding works backwards with a negative number. Day 0 is the start date itself, and adding starts counting from the next working day.
  • Ranges up to about 10 years; add up to ±2,500 days.
  • With a Canadian region, set=statutory skips that province's employment-standards holidays rather than the broader observed list.

Working days are Monday to Friday, minus the region's public holidays when a region is given. Both ends of a range are included.

Errors

Errors are JSON like {"error": {"code": "…", "message": "…"}}. The ones this endpoint can return:

  • missing_param (400): a required parameter is missing or empty
  • bad_param (400): a value is the wrong type or out of range (the message says which)
  • rate_limited (429): over 60 requests a minute; wait for Retry-After seconds

Questions

Does it handle regional holidays like St Andrew's Day?

Yes, with region=gb-sct. Use gb-eng, gb-nir, ie, us, de, de-by, fr, nl, ca, ca-on, au, au-nsw or nz for the others.

Can I use a different working week, like Sunday to Thursday?

Not yet: Monday to Friday is fixed.

Related endpoints

Published , updated · OpenAPI 3.1 spec · Limits and privacy