Self Assessment Assist (MTD) API
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.
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
- Raise non-technical or platform-related issues with the Software Development Support Team (SDST).
- Raise technical issues on the self-assessment-assist-changelog GitHub page.
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.
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.
Path parameters
Name | Description |
---|---|
nino
string
required
|
National Insurance number, in the format AA999999A.
For example: |
calculationId
string
required
|
The unique identifier for the calculation. Must conform the regular expression:
For example: |
Request headers
Name | Description |
---|---|
Accept
required
|
Specifies the response format and the version of the API to be used. 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
Name | Description |
---|---|
X-CorrelationId
required
|
Unique ID for operation tracking 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" }
Name | Description |
---|---|
reportId
string
required
|
The unique ID (UUID) of the report.
Must conform to the regular expression
For example: |
messages
array
optional
|
The body contains the message for the customer.
For example: |
title
string
required
|
Title of message
For example: |
body
string
required
|
The body contains the message for the customer.
For example: |
action
string
optional
|
The recommend action the customer should take.
For example: |
links
array
optional
|
A list of help or support 'links' associated with the message body.
For example: |
title
string
optional
|
The title text that appears before the links.
For example: |
url
string
optional
|
The URL of support or help link.
For example: |
path
string
required
|
The HTTP path to guidance provided by HMRC.
For example: |
nino
string
required
|
National Insurance number, in the format AA999999A.
For example: |
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: |
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: |
correlationId
string
required
|
The correlationId of the report.
For example: |
Error scenarios
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.
Path parameters
Name | Description |
---|---|
nino
string
required
|
National Insurance number, in the format AA999999A.
For example: |
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: |
correlationId
string
required
|
The alphanumeric correlation ID of the report.
For example: |
Request headers
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
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