This version is in beta - expect some breaking changes.

National Insurance Test Support API

Dates and amounts
Date Amount
Version and status
Available in Sandbox Yes
Sandbox base URL https://test-api.service.hmrc.gov.uk
Available in Production No

Overview

Lets you set up test data for the National Insurance API.

Versioning

When an API changes in a way that is backwards-incompatible, we increase the version number of the API. See our reference guide for more on versioning.

Errors

We use standard HTTP status codes to show whether an API request succeeded or not. They are usually in the range:

  • 200 to 299 if it succeeded, including code 202 if it was accepted by an API that needs to wait for further action
  • 400 to 499 if it failed because of a client error by your application
  • 500 to 599 if it failed because of an error on our server

Errors specific to each API are shown in the Endpoints section, under Response. See our reference guide for more on errors.

Skip to main content

Endpoints

/national-insurance-test-support/sa/{utr}/annual-summary/{taxYear}

Create National Insurance summary test data
POST

Lets you create National Insurance contributions test data

Authorisation

This endpoint is application-restricted and requires an Authorization header containing an OAuth 2.0 Bearer Token.

Path parameters

Path parameters table
Name Description
utr
string
required

The 10 digit self-assessment UTR for the individual.

For example: 2234567890

taxYear
string
required

The tax year for the National Insurance contribution being created.

Tax year in the format YYYY-YY

For example: 2016-17

Request headers

Request headers Table
Name Description
Accept
required

Specifies the response format and the version of the API to be used.

For example: application/vnd.hmrc.1.0+json
Content-Type
required

Specifies the format of the request body, which must be JSON.

For example: application/json
Authorization
required
An OAuth 2.0 Bearer Token.

For example: Bearer 59fc92c1cdf0b8ef1f138a702effdbd2

See also fraud prevention.

Request

{
  "scenario": "HAPPY_PATH_1"
}

Request table
Name Description
scenario
string
optional

The scenario to create test data for

Limited to the following possible values:

HAPPY_PATH_1 - Standard happy path test scenario (default)
HAPPY_PATH_2 - Happy path test scenario with different values

Response

HTTP status: 201 (Created)

Example response for scenario HAPPY_PATH_1

{
  "class1": {
    "totalNICableEarnings": 10
  },
  "class2": {
    "totalDue": 20
  },
  "maxNICsReached": false
}

Example response for scenario HAPPY_PATH_2

{
  "class1": {
    "totalNICableEarnings": 17
  },
  "class2": {
    "totalDue": 319.57
  },
  "maxNICsReached": true
}

Response table
Name Description
class1
object
required
totalNICableEarnings
number
required

Total Class 1 earnings subject to National Insurance contributions between the Primary Threshold and the Upper Earnings Limit

For example: 10

class2
object
required
totalDue
number
required

Total Class 2 National Insurance contributions due

For example: 10

maxNICsReached
boolean
required

A flag indicating whether the maximum National Insurance contributions has been reached

For example: false


Close Section

Skip to main content