Building HMRC Making Tax Digital Integrations with Node.js and TypeScript

A minimalist metallic ledger on a dark blue surface with a single glowing node above it

Integrating financial systems with HM Revenue & Customs (HMRC) Making Tax Digital (MTD) APIs requires software developers to navigate unique state rules, header requirements, and asynchronous workflows. A detailed engineering walk-through published by TapTax founder Solomon Amos outlines how to manage quarterly income and expense submissions for UK sole traders using Node.js and TypeScript.

Cumulative Payloads and Expense Rules

HMRC's Self Employment Business API v5.0 requires quarterly updates to be cumulative rather than isolated to individual three-month periods. Each update sent to the cumulative PUT endpoint covers total income and expenses from the beginning of the tax year (6 April) up to the period end date, invalidating previous submissions for that year. Developers must maintain full year-to-date totals or prefill forms from recorded state to avoid overwriting earlier data with incomplete figures.

Payloads support either a single consolidated expenses figure or an itemized breakdown, but the two formats cannot be mixed. HMRC enforces a policy where businesses with annual turnover of £90,000 or more must submit itemized records. Submissions must explicitly set zero values for periods with no activity, and APIs reject payloads sent more than 10 days before a period closes.

Handling Headers and API Authentication

Requests to HMRC services require OAuth 2.0 access tokens signed for specific scopes, alongside strict header configurations. Each API pinned via the Accept header uses distinct version numbers—such as v2.0 for Business Details, v3.0 for Obligations, and v8.0 for production Individual Calculations. Incorrect versioning returns 406 Not Acceptable status codes, while un-subscribed APIs respond with 403 Forbidden.

Developers must pass mandatory fraud prevention headers containing client connection metadata on every API call. Additionally, bodyless HTTP GET requests must omit the Content-Type header to avoid edge rejection by HMRC gateways.

Asynchronous Calculations and Obligations

Retrieving tax estimates involves an asynchronous process using the Individual Calculations API. Developers trigger an in-year calculation by posting an empty JSON object to the endpoint, which returns a calculation ID with a 202 Accepted status. Fetching the actual result requires polling a separate GET route after a delay of at least five seconds to account for 404 Not Found responses returned while processing.

When querying open duties via the Obligations API v3.0, applications should rely on returned due dates rather than hardcoded logic. Following a successful cumulative PUT request, HMRC may take up to an hour to update an obligation's status from open to fulfilled, requiring integrations to track local submission records to accurately reflect status to end-users.

AI-generated editorial illustration; not a documentary photograph.

Source:
How to Submit a Quarterly Update to HMRC's Making Tax Digital API

Share this article
FacebookThreadsLinkedInX

Leave a Reply

Your email address will not be published. Required fields are marked *