This version is in beta - expect some breaking changes.

Self Assessment Assist (MTD) 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

The HMRC Assist report is based on the customers’ National Insurance number (nino) and Calculation ID. The report contains a list of ‘Errors’, ‘Warnings’, and ‘Info’ for the given National Insurance number (nino) and Calculation ID.

This API allows developers to:

  • retrieve a HMRC Assist report for a given customer with a list of warnings and possible errors
  • securely generate a report that is sent to or displayed after it has been generated
  • allow the client to acknowledge the report

Send fraud prevention data

HMRC monitors transactions to help protect your customers' confidential data from criminals and fraudsters.

Warning You are required by law to submit header data for this API. This includes all associated APIs and endpoints.

Check the data you need to send. You can also use the Test API during initial development and as part of your quality assurance checks.

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.

Changelog

You can find the changelog in the self-assessement-assist-changelog GitHub wiki.

Support

Testing

You can use the sandbox environment to test this API. You can use the Create Test User API or it's frontend service to create test users.

It may not be possible to test all scenarios in the sandbox. You can test some scenarios by passing the Gov-Test-Scenario header. Documentation for each endpoint includes a Test data section, which explains the scenarios that you can simulate using the Gov-Test-Scenario header.

If you have a specific testing need that is not supported in the sandbox, contact our support team.

Some APIs may be marked [test only]. This means that they are not available for use in production and may change.

Skip to main content

Endpoints

Self Assessment Assist

Here a developer can:

  • request a HMRC Assist report to be generated for a customer or their advisors
  • Allow the client to acknowledge the report

Self Assessment Assist resources

/individuals/self-assessment/assist/reports/{nino}/{calculationId}

Produce a HMRC Self Assessment Assist Report
POST

This endpoint allows a developer to generate and return a HMRC Assist report for a tax calculation and taxpayer.

Authorisation

This endpoint is user-restricted and requires an Authorization header containing an OAuth 2.0 Bearer Token with the read:self-assessment-assist scope.

Path parameters

Path parameters table
Name Description
nino
string
required

National Insurance number, in the format AA999999A.

For example: TC663795B

calculationId
string
required

The unique identifier for the calculation. Must conform the regular expression: ^[0-9]{8}|[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$

For example: f2fb30e5-4ab6-4a29-b3c1-c7264259ff1c

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
Authorization
required
An OAuth 2.0 Bearer Token with the read:self-assessment-assist scope.

For example: Bearer bb7fed3fe10dd235a2ccda3d50fb

See also fraud prevention.

Responses

HTTP status 200 (OK)

Response headers

Response headers Table
Name Description
X-CorrelationId
required

Unique ID for operation tracking
String, 36 characters.

For example: c75f40a6-a3df-4429-a697-471eeec46435

See also fraud prevention.

{
  "reportId": "f2fb30e5-4ab6-4a29-b3c1-c7264259ff1c",
  "messages": [
    {
      "title": "Turnover and Cost of Sales",
      "body": "Your cost of sales (12000) is greater than your actual income (4000). This may be an error.",
      "action": "Please read our guidance and consider amending Box 10 of your submission.",
      "links": [
        {
          "title": "Our guidance on Turnover and Expenses can be read here.",
          "url": "https://www.gov.uk/expenses-if-youre-self-employed"
        }
      ],
      "path": "general/total_declared_turnover"
    }
  ],
  "nino": "TC663795B",
  "taxYear": "2017-18",
  "calculationId": "f2fb30e5-4ab6-4a29-b3c1-c7264259ff1c",
  "correlationId": "7X57CKG72JVNSSS9SALT"
}

Response table
Name Description
reportId
string
required

The unique ID (UUID) of the report.

Must conform to the regular expression ^[0-9]{8}|[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$

For example: f2fb30e5-4ab6-4a29-b3c1-c7264259ff1c

messages
array
optional

The body contains the message for the customer.

For example: [ { ",Turnover and Cost of Sales", "Your cost of sales (12000) is greater than your actual income (4000). This may be an error." }, .. etc]]

title
string
required

Title of message

For example: Turnover and Cost of Sales

body
string
required

The body contains the message for the customer.

For example: Your cost of sales (12000) is greater than your actual income (4000). This may be an error.

action
string
optional

The recommend action the customer should take.

For example: Please read our guidance and consider amending Box 10 of your submission.

links
array
optional

A list of help or support 'links' associated with the message body.

For example: [ { ",Turnover and Cost of Sales", "Your cost of sales (12000) is greater than your actual income (4000). This may be an error." }, .. etc]]

title
string
optional

The title text that appears before the links.

For example: Our guidance on Turnover and Expenses can be read here.

url
string
optional

The URL of support or help link.

For example: https://www.gov.uk/expenses-if-youre-self-employed

path
string
required

The HTTP path to guidance provided by HMRC.

For example: general/total_declared_turnover

nino
string
required

National Insurance number, in the format AA999999A.

For example: TC663795B

taxYear
string
required

The tax year the data applies to, for example, 2021-22. The start year and end year must not span two tax years. No gaps are allowed, for example, 2020-22 is not valid.

For example: 2017-18

calculationId
string
required

The unique identifier for the calculation. Must conform the regular expression: `^[0-9]{8}|[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$`

For example: f2fb30e5-4ab6-4a29-b3c1-c7264259ff1c

correlationId
string
required

The correlationId of the report.

For example: 7X57CKG72JVNSSS9SALT

Error scenarios

Error scenarios table
Scenario HTTP status Code

The format of the supplied NINO field is not valid

400 (Bad Request)

FORMAT_NINO

The format of the supplied CalculationID is not valid

400 (Bad Request)

FORMAT_CALC_ID

Calculation ID was not found

404 (Not Found)

MATCHING_RESOURCE_NOT_FOUND

The client and/or agent is not authorised. This is normally because: the client is not subscribed to MTD, the agent is not subscribed to Agent Services, or the client has not authorised the agent to act on their behalf

403 (Forbidden)

CLIENT_OR_AGENT_NOT_AUTHORISED

Invalid Authentication information provided

401 (Unauthorized)

INVALID_CREDENTIALS

For error scenarios that are common across all APIs, and for error formats, see our reference guide.


Close Section
/individuals/self-assessment/assist/reports/acknowledge/{nino}/{reportId}/{correlationId}

Acknowledge a HMRC Self Assessment Assist Report
POST

This endpoint allows a developer to acknowledge that the given report has been read by the customer or agent.

Authorisation

This endpoint is user-restricted and requires an Authorization header containing an OAuth 2.0 Bearer Token with the write:self-assessment-assist scope.

Path parameters

Path parameters table
Name Description
nino
string
required

National Insurance number, in the format AA999999A.

For example: TC663795B

reportId
string
required

The unique identifier for the report. Must conform to the regular expression: ^[0-9]{8}|[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$

For example: f2fb30e5-4ab6-4a29-b3c1-c7264259ff1c

correlationId
string
required

The alphanumeric correlation ID of the report.

For example: 7X57CKG72JVNSSS9SALT

Request headers

Request headers Table
Name Description
Authorization
required
An OAuth 2.0 Bearer Token with the write:self-assessment-assist scope.

For example: Bearer bb7fed3fe10dd235a2ccda3d50fb

See also fraud prevention.

Responses

HTTP status 204 (No Content)

Error scenarios

Error scenarios table
Scenario HTTP status Code

The format of the supplied NINO field is not valid

400 (Bad Request)

FORMAT_NINO

The format of the supplied reportID is not valid.

400 (Bad Request)

FORMAT_REPORT_ID

Calculation ID was not found

404 (Not Found)

MATCHING_RESOURCE_NOT_FOUND

The client and/or agent is not authorised. This is normally because: the client is not subscribed to MTD, the agent is not subscribed to Agent Services, or the client has not authorised the agent to act on their behalf

403 (Forbidden)

CLIENT_OR_AGENT_NOT_AUTHORISED

For error scenarios that are common across all APIs, and for error formats, see our reference guide.


Close Section

Skip to main content