Skip to content
Business days

calendar.deadline

Calculate a deadline in local business days or hours and trace skipped dates.

POSThttps://api.kanagu.dev/v1/calendar/deadline
Price
$0.001 per successful call
Without a key
10 free calls per IP per UTC day, shared by REST and MCP.
MCP tool
calendar.deadline at https://api.kanagu.dev/mcp
curl https://api.kanagu.dev/v1/calendar/deadline \
  -H "Content-Type: application/json" \
  -d '{"country":"US","subdivision":"US-NY","start":"2026-11-25T21:30:00Z","hours":2,"timezone":"America/New_York","cutoff":"17:00","closures":["2026-11-27"]}'
curl https://api.kanagu.dev/v1/calendar/deadline \
  -H "Authorization: Bearer $KANAGU_KEY" \
  -H "Content-Type: application/json" \
  -d '{"country":"US","subdivision":"US-NY","start":"2026-11-25T21:30:00Z","hours":2,"timezone":"America/New_York","cutoff":"17:00","closures":["2026-11-27"]}'
const res = await fetch("https://api.kanagu.dev/v1/calendar/deadline", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.KANAGU_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "country": "US",
    "subdivision": "US-NY",
    "start": "2026-11-25T21:30:00Z",
    "hours": 2,
    "timezone": "America/New_York",
    "cutoff": "17:00",
    "closures": [
      "2026-11-27"
    ]
  }),
});
if (!res.ok) throw new Error((await res.json()).error.message);
const result = await res.json();
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "calendar.deadline",
    "arguments": {
      "country": "US",
      "subdivision": "US-NY",
      "start": "2026-11-25T21:30:00Z",
      "hours": 2,
      "timezone": "America/New_York",
      "cutoff": "17:00",
      "closures": [
        "2026-11-27"
      ]
    }
  }
}
Request body
{
  "country": "US",
  "subdivision": "US-NY",
  "start": "2026-11-25T21:30:00Z",
  "hours": 2,
  "timezone": "America/New_York",
  "cutoff": "17:00",
  "closures": [
    "2026-11-27"
  ]
}
Response · 200
{
  "due": "2026-11-30T15:30:00Z",
  "skipped": [
    {
      "date": "2026-11-26",
      "reasons": [
        "public_holiday"
      ]
    },
    {
      "date": "2026-11-27",
      "reasons": [
        "custom_closure"
      ]
    },
    {
      "date": "2026-11-28",
      "reasons": [
        "weekend"
      ]
    },
    {
      "date": "2026-11-29",
      "reasons": [
        "weekend"
      ]
    }
  ]
}

Request body

application/json

country"AD" | "AE" | "AG" | "AI" | "AL" | "AM" | … (207 values)required
Country or territory code. GB defaults to England and Wales.
subdivisionstring (max 24 chars)
date-holidays subdivision code, e.g. CA or US-CA, BY or DE-BY, SCT or GB-SCT.
startstring (date-time)required
Start instant with a UTC offset.
timezonestring (max 64 chars)required
IANA time zone, e.g. America/New_York.
cutoffstringrequired
Daily closing time in the selected time zone (HH:mm).
weekendarray of integer (1 to 7)
Closed weekdays, expressed as ISO numbers (1 = Monday).
closuresarray of string (date)
Additional closed dates in the selected time zone.

Then exactly one of these 2 shapes:

1. With days

daysinteger (0 to 4000)required
Business days after the first open day before cutoff. Zero uses that day's cutoff.

2. With hours, opensAt

hoursnumber (0 to 8760)required
Elapsed hours during business windows, rounded to the nearest millisecond.
opensAtstring
Daily opening time (HH:mm), before cutoff.

Response

200 · application/json

duestring (date-time)required
Deadline as a UTC instant.
skippedarray of objectrequired
skipped[].datestring (date)required
skipped[].reasonsarray of "weekend" | "public_holiday" | "custom_closure" | "cutoff_passed"required

Try it

calendar.deadline

$0.001/call

No key needed · 10 free calls per IP per day

Response

Run the request to see the live response here.

Errors

Errors are JSON {"error":{"code","message"}}. An operation may add its own 400 codes; the message says what to fix.

StatusCode and meaning
400invalid_input

The body does not match the request schema. The message names each field.

400invalid_json

The body is missing or is not valid JSON.

400invalid_idempotency_key

Idempotency-Key must be 1–128 visible ASCII characters.

401invalid_api_key

The Bearer key is missing, malformed, invalid or inactive.

402free_allowance_exhausted

This month's free usage is used up and the account has no subscription. Subscribe from the dashboard, or wait for the next UTC month; Retry-After gives the seconds left.

404not_found

No operation at this path.

409idempotency_conflict

The Idempotency-Key was already used with a different body.

413payload_too_large

JSON bodies may be at most 64 KiB.

429trial_limit

The anonymous trial allows 10 calls per IP per UTC day, shared by REST and MCP. Retry-After gives the seconds left.

500internal_error

The call failed on our side. It is not billed; retry with the same Idempotency-Key.

JSON Schema

Request schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "oneOf": [
    {
      "type": "object",
      "properties": {
        "country": {
          "type": "string",
          "enum": [
            "AD",
            "AE",
            "AG",
            "AI",
            "AL",
            "AM",
            "AO",
            "AR",
            "AS",
            "AT",
            "AU",
            "AW",
            "AX",
            "AZ",
            "BA",
            "BB",
            "BD",
            "BE",
            "BF",
            "BG",
            "BH",
            "BI",
            "BJ",
            "BL",
            "BM",
            "BN",
            "BO",
            "BQ",
            "BR",
            "BS",
            "BW",
            "BY",
            "BZ",
            "CA",
            "CC",
            "CD",
            "CF",
            "CG",
            "CH",
            "CI",
            "CK",
            "CL",
            "CM",
            "CN",
            "CO",
            "CR",
            "CU",
            "CV",
            "CW",
            "CX",
            "CY",
            "CZ",
            "DE",
            "DJ",
            "DK",
            "DM",
            "DO",
            "DZ",
            "EC",
            "EE",
            "EG",
            "EH",
            "ER",
            "ES",
            "ET",
            "FI",
            "FJ",
            "FO",
            "FR",
            "GA",
            "GB",
            "GD",
            "GE",
            "GF",
            "GG",
            "GH",
            "GI",
            "GL",
            "GM",
            "GN",
            "GP",
            "GQ",
            "GR",
            "GT",
            "GU",
            "GW",
            "GY",
            "HK",
            "HN",
            "HR",
            "HT",
            "HU",
            "IC",
            "ID",
            "IE",
            "IL",
            "IM",
            "IN",
            "IR",
            "IS",
            "IT",
            "JE",
            "JM",
            "JP",
            "KE",
            "KM",
            "KN",
            "KR",
            "KY",
            "KZ",
            "LC",
            "LI",
            "LK",
            "LR",
            "LS",
            "LT",
            "LU",
            "LV",
            "LY",
            "MA",
            "MC",
            "MD",
            "ME",
            "MF",
            "MG",
            "MK",
            "ML",
            "MQ",
            "MR",
            "MS",
            "MT",
            "MU",
            "MW",
            "MX",
            "MY",
            "MZ",
            "NA",
            "NC",
            "NE",
            "NF",
            "NG",
            "NI",
            "NL",
            "NO",
            "NZ",
            "PA",
            "PE",
            "PF",
            "PH",
            "PK",
            "PL",
            "PM",
            "PR",
            "PT",
            "PY",
            "RE",
            "RO",
            "RS",
            "RU",
            "RW",
            "SA",
            "SC",
            "SD",
            "SE",
            "SG",
            "SH",
            "SI",
            "SJ",
            "SK",
            "SL",
            "SM",
            "SN",
            "SO",
            "SR",
            "SS",
            "ST",
            "SV",
            "SX",
            "SZ",
            "TC",
            "TD",
            "TG",
            "TH",
            "TN",
            "TO",
            "TR",
            "TT",
            "TW",
            "TZ",
            "UA",
            "UG",
            "US",
            "UY",
            "UZ",
            "VA",
            "VC",
            "VE",
            "VG",
            "VI",
            "VN",
            "VU",
            "WF",
            "XK",
            "YT",
            "ZA",
            "ZM",
            "ZW"
          ],
          "description": "Country or territory code. GB defaults to England and Wales."
        },
        "subdivision": {
          "description": "date-holidays subdivision code, e.g. CA or US-CA, BY or DE-BY, SCT or GB-SCT.",
          "type": "string",
          "maxLength": 24,
          "pattern": "^[A-Z0-9]+(?:-[A-Z0-9]+){0,2}$"
        },
        "start": {
          "type": "string",
          "format": "date-time",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
          "description": "Start instant with a UTC offset."
        },
        "timezone": {
          "type": "string",
          "minLength": 1,
          "maxLength": 64,
          "description": "IANA time zone, e.g. America/New_York."
        },
        "cutoff": {
          "type": "string",
          "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
          "description": "Daily closing time in the selected time zone (HH:mm)."
        },
        "weekend": {
          "default": [
            6,
            7
          ],
          "description": "Closed weekdays, expressed as ISO numbers (1 = Monday).",
          "maxItems": 6,
          "type": "array",
          "items": {
            "type": "integer",
            "minimum": 1,
            "maximum": 7
          }
        },
        "closures": {
          "default": [],
          "description": "Additional closed dates in the selected time zone.",
          "maxItems": 366,
          "type": "array",
          "items": {
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
          }
        },
        "days": {
          "type": "integer",
          "minimum": 0,
          "maximum": 4000,
          "description": "Business days after the first open day before cutoff. Zero uses that day's cutoff."
        }
      },
      "required": [
        "country",
        "start",
        "timezone",
        "cutoff",
        "days"
      ],
      "additionalProperties": false
    },
    {
      "type": "object",
      "properties": {
        "country": {
          "type": "string",
          "enum": [
            "AD",
            "AE",
            "AG",
            "AI",
            "AL",
            "AM",
            "AO",
            "AR",
            "AS",
            "AT",
            "AU",
            "AW",
            "AX",
            "AZ",
            "BA",
            "BB",
            "BD",
            "BE",
            "BF",
            "BG",
            "BH",
            "BI",
            "BJ",
            "BL",
            "BM",
            "BN",
            "BO",
            "BQ",
            "BR",
            "BS",
            "BW",
            "BY",
            "BZ",
            "CA",
            "CC",
            "CD",
            "CF",
            "CG",
            "CH",
            "CI",
            "CK",
            "CL",
            "CM",
            "CN",
            "CO",
            "CR",
            "CU",
            "CV",
            "CW",
            "CX",
            "CY",
            "CZ",
            "DE",
            "DJ",
            "DK",
            "DM",
            "DO",
            "DZ",
            "EC",
            "EE",
            "EG",
            "EH",
            "ER",
            "ES",
            "ET",
            "FI",
            "FJ",
            "FO",
            "FR",
            "GA",
            "GB",
            "GD",
            "GE",
            "GF",
            "GG",
            "GH",
            "GI",
            "GL",
            "GM",
            "GN",
            "GP",
            "GQ",
            "GR",
            "GT",
            "GU",
            "GW",
            "GY",
            "HK",
            "HN",
            "HR",
            "HT",
            "HU",
            "IC",
            "ID",
            "IE",
            "IL",
            "IM",
            "IN",
            "IR",
            "IS",
            "IT",
            "JE",
            "JM",
            "JP",
            "KE",
            "KM",
            "KN",
            "KR",
            "KY",
            "KZ",
            "LC",
            "LI",
            "LK",
            "LR",
            "LS",
            "LT",
            "LU",
            "LV",
            "LY",
            "MA",
            "MC",
            "MD",
            "ME",
            "MF",
            "MG",
            "MK",
            "ML",
            "MQ",
            "MR",
            "MS",
            "MT",
            "MU",
            "MW",
            "MX",
            "MY",
            "MZ",
            "NA",
            "NC",
            "NE",
            "NF",
            "NG",
            "NI",
            "NL",
            "NO",
            "NZ",
            "PA",
            "PE",
            "PF",
            "PH",
            "PK",
            "PL",
            "PM",
            "PR",
            "PT",
            "PY",
            "RE",
            "RO",
            "RS",
            "RU",
            "RW",
            "SA",
            "SC",
            "SD",
            "SE",
            "SG",
            "SH",
            "SI",
            "SJ",
            "SK",
            "SL",
            "SM",
            "SN",
            "SO",
            "SR",
            "SS",
            "ST",
            "SV",
            "SX",
            "SZ",
            "TC",
            "TD",
            "TG",
            "TH",
            "TN",
            "TO",
            "TR",
            "TT",
            "TW",
            "TZ",
            "UA",
            "UG",
            "US",
            "UY",
            "UZ",
            "VA",
            "VC",
            "VE",
            "VG",
            "VI",
            "VN",
            "VU",
            "WF",
            "XK",
            "YT",
            "ZA",
            "ZM",
            "ZW"
          ],
          "description": "Country or territory code. GB defaults to England and Wales."
        },
        "subdivision": {
          "description": "date-holidays subdivision code, e.g. CA or US-CA, BY or DE-BY, SCT or GB-SCT.",
          "type": "string",
          "maxLength": 24,
          "pattern": "^[A-Z0-9]+(?:-[A-Z0-9]+){0,2}$"
        },
        "start": {
          "type": "string",
          "format": "date-time",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
          "description": "Start instant with a UTC offset."
        },
        "timezone": {
          "type": "string",
          "minLength": 1,
          "maxLength": 64,
          "description": "IANA time zone, e.g. America/New_York."
        },
        "cutoff": {
          "type": "string",
          "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$",
          "description": "Daily closing time in the selected time zone (HH:mm)."
        },
        "weekend": {
          "default": [
            6,
            7
          ],
          "description": "Closed weekdays, expressed as ISO numbers (1 = Monday).",
          "maxItems": 6,
          "type": "array",
          "items": {
            "type": "integer",
            "minimum": 1,
            "maximum": 7
          }
        },
        "closures": {
          "default": [],
          "description": "Additional closed dates in the selected time zone.",
          "maxItems": 366,
          "type": "array",
          "items": {
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
          }
        },
        "hours": {
          "type": "number",
          "minimum": 0,
          "maximum": 8760,
          "description": "Elapsed hours during business windows, rounded to the nearest millisecond."
        },
        "opensAt": {
          "default": "09:00",
          "description": "Daily opening time (HH:mm), before cutoff.",
          "type": "string",
          "pattern": "^(?:[01]\\d|2[0-3]):[0-5]\\d$"
        }
      },
      "required": [
        "country",
        "start",
        "timezone",
        "cutoff",
        "hours"
      ],
      "additionalProperties": false
    }
  ],
  "examples": [
    {
      "country": "US",
      "subdivision": "US-NY",
      "start": "2026-11-25T21:30:00Z",
      "hours": 2,
      "timezone": "America/New_York",
      "cutoff": "17:00",
      "closures": [
        "2026-11-27"
      ]
    }
  ],
  "type": "object"
}
Response schema
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "due": {
      "type": "string",
      "format": "date-time",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
      "description": "Deadline as a UTC instant."
    },
    "skipped": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "format": "date",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
          },
          "reasons": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "weekend",
                "public_holiday",
                "custom_closure",
                "cutoff_passed"
              ]
            }
          }
        },
        "required": [
          "date",
          "reasons"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "due",
    "skipped"
  ],
  "additionalProperties": false
}