{"uid":"cap_Z9ViaZOc-eC88sPSvi5Jn","slug":"date-math-sla-live-clock-b2a025d7","name":"Date Math SLA Live Clock","description":"Date Math: Live SLA clock for a support ticket: business minutes elapsed and remaining, breached or not, and the deadline. The clock pauses outside working hours, on weekends and holidays, and during manual pauses (e.g. waiting on customer). Custom hours, workdays, country holidays, DST-aware. Use for support-agent SLA tracking and escalation.","url":"https://date-math.datemath.workers.dev/v1/sla?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"now":{"type":"string","description":"Current time (default: now), same formats as start"},"start":{"type":"string","description":"When the SLA clock started: ISO 8601 with offset, or local YYYY-MM-DDTHH:MM in timezone"},"pauses":{"type":"array","items":{"type":"object","required":["start"],"properties":{"end":{"type":"string","description":"ISO 8601 with offset; omit while the pause is ongoing"},"start":{"type":"string","description":"ISO 8601 with offset"}}},"maxItems":100,"description":"Manual pauses (e.g. waiting on customer), up to 100"},"country":{"type":"string","example":"US","pattern":"^[A-Za-z]{2}$","description":"ISO 3166-1 alpha-2 country code (207 countries); its public holidays (2000–2050) are excluded from business days"},"holidays":{"type":"array","items":{"type":"string","example":"2026-11-07","pattern":"^\\d{4}-\\d{2}-\\d{2}$"},"maxItems":1000,"description":"Extra dates excluded from business-day counts (rest days from workdays are always excluded)"},"timezone":{"type":"string","example":"Asia/Manila","description":"IANA time zone of the support team's working hours"},"work_end":{"type":"string","pattern":"^([01]\\d|2[0-4]):[0-5]\\d$","description":"End of working hours, default 17:00"},"workdays":{"type":"array","items":{"type":"integer","maximum":6,"minimum":0},"example":[1,2,3,4,5],"maxItems":7,"minItems":1,"description":"Working days of the week, 0 = Sunday. Default [1,2,3,4,5] (Mon–Fri); e.g. [0,1,2,3,4] for Sun–Thu or [1,2,3,4,5,6] for Mon–Sat"},"sla_hours":{"type":"number","description":"SLA target in business hours (combine with sla_minutes)"},"work_start":{"type":"string","pattern":"^([01]\\d|2[0-4]):[0-5]\\d$","description":"Start of working hours, default 09:00"},"sla_minutes":{"type":"number","description":"SLA target in business minutes"}}},"responseSchema":{"type":"json","example":{"now":"2026-11-09T10:30:00+08:00","start":"2026-11-06T16:00:00+08:00","status":"running","breached":false,"deadline":"2026-11-09T12:30:00+08:00","timezone":"Asia/Manila","resumes_at":null,"sla_minutes":240,"deadline_utc":"2026-11-09T04:30:00Z","percent_used":50,"deadline_weekday":"Monday","elapsed_business_minutes":120,"remaining_business_minutes":120,"breached_by_business_minutes":0}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.001","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.001/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_pXrUmnrgyPx3z8qb1sCCC","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.001","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Calculates live SLA status for a support ticket: business minutes elapsed and remaining, breach status, and deadline — pausing outside working hours, on weekends, holidays, and during manual pauses.","exampleAgentPrompt":"Check the live SLA status for a ticket that opened on 2026-11-06 at 16:00 Manila time — the SLA target is 4 business hours, working hours are 09:00–17:00 Monday through Friday, and we're in the Philippines so use the PH holiday calendar. The customer replied at 2026-11-07T09:00+08:00 so pause the clock from then until 2026-11-09T09:00+08:00. Tell me how many business minutes are left, whether it's breached, and when the deadline is.","exampleUseCases":[{"title":"Escalation alert before SLA breach","prompt":"A ticket came in on Monday at 3pm UTC in our London office — 09:00–17:00 Mon–Fri, UK holidays. Our SLA is 8 business hours. It's now Tuesday 10am UTC. Is the ticket about to breach? How many business minutes are left and when exactly is the deadline?"},{"title":"SLA clock paused waiting on customer","prompt":"We opened a ticket on 2026-11-03 at 09:00 Eastern time, SLA is 240 business minutes, 09:00–17:00 Mon–Fri US holidays. We paused the clock waiting on the customer from 2026-11-03T14:00-05:00 and they just replied now at 2026-11-04T10:00-05:00 so the pause ended then. What's the current SLA status — elapsed, remaining, and have we breached?"},{"title":"SLA tracking for Middle East support team","prompt":"Our Dubai support team works Sunday through Thursday 08:00–17:00 Gulf Standard Time, using UAE public holidays. A ticket started on 2026-11-09 at 08:30+04:00 and our SLA is 6 business hours. What's the deadline, how many business minutes have elapsed as of 2026-11-10 at 10:00+04:00, and are we still within SLA?"}],"resultDescription":"Returns a JSON object with: current status (running/paused/breached), breach flag, SLA deadline in local and UTC, elapsed business minutes, remaining business minutes, percent of SLA used, breached-by minutes (0 if not breached), when the clock resumes if currently paused, and contextual info like deadline weekday and timezone.","failureModes":["Invalid or missing 'start' timestamp returns a 400 error","Unrecognized IANA timezone string causes a validation error","Country code not in the supported 207-country list returns an error","Pause entries with end before start produce a validation error","SLA target of zero or negative minutes causes a computation error","Malformed ISO 8601 timestamps in pauses array return a 400"],"whenToPreferThis":"Use this endpoint when you need a live, real-time SLA status check that accounts for business hours, weekends, country-specific public holidays, DST transitions, and manual pause periods — particularly for support ticketing workflows. Prefer this over a simple date-difference calculation when SLA compliance must respect working hours rather than wall-clock time, or when tickets can be paused (e.g. waiting on customer). It is ideal for escalation engines and dashboards that need to know breach status, percent consumed, and exact deadline in a single call.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-11-21T12:36:47.459Z","isFirstParty":false,"canonicalSlug":"date-math-sla-live-clock-b2a025d7"}