Individuals Disclosures (MTD) API
Date | Amount |
---|---|
Version and status | |
Available in Sandbox | Yes |
Sandbox base URL | https://test-api.service.hmrc.gov.uk |
Available in Production | Yes |
Production base URL | https://api.service.hmrc.gov.uk |
Overview
This API allows developers to create, amend, retrieve and delete data relating to:
- Marriage Allowance
- Individuals Disclosures
For information on how to connect to this API see the Income Tax MTD end-to-end service guide.
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.
Single errors will be returned in the following format:
{
"code": "FORMAT_FIELD_NAME",
"message": "The provided FieldName is invalid"
}
Where possible, multiple errors will be returned with INVALID_REQUEST
in the following format:
{
"code": "INVALID_REQUEST",
"message": "Invalid request",
"errors": [
{
"code": "RULE_FIELD_NAME",
"message": "The provided FieldName is not allowed"
},
{
"code": "FORMAT_FIELD_NAME",
"message": "The provided FieldName is invalid"
}
]
}
Where it is possible for the same error to be returned multiple times, message
will describe the expected format and paths
will show the fields which are invalid.
Where arrays are submitted a number indicates the object in the array sequence, for example, /arrayName/1/fieldName
An example with single error:
{
"code": "FORMAT_STRING_NAME",
"message": "The provided field is not valid",
"paths": [ "/arrayName/0/fieldName" ]
}
An example with multiple errors:
{
"code": "INVALID_REQUEST",
"message": "Invalid request",
"errors": [
{
"code": "FORMAT_VALUE",
"message": "The field should be between 0 and 99999999999.99",
"paths": [ "/objectName/fieldName1", "/arrayName/0/fieldName2" ]
},
{
"code": "FORMAT_STRING_NAME",
"message": "The provided field is not valid",
"paths": [ "/arrayName/0/fieldName3", "/arrayName/1/fieldName3" ]
}
]
}
Changelog
You can find the changelog in the income-tax-mtd-changelog GitHub wiki.
Support
- Raise non-technical or platform-related issues with the Software Development Support Team (SDST).
- Raise technical issues on the income-tax-mtd-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
Marriage Allowance
Resources relating to an individual's marriage allowance.
Marriage Allowance resources
/individuals/disclosures/marriage-allowance/{nino}
Create Marriage Allowance
POST
This endpoint allows the customer to transfer up to £1,260 of their personal allowance to their spouse or civil partner. A National Insurance Number must be provided.
Path parameters
Name | Description |
---|---|
nino
string
required
|
National Insurance number, in the format AA999999A.
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
|
Content-Type
required
|
Specifies the format of the request body, which must be JSON. application/json
|
Gov-Test-Scenario
optional
|
Only in sandbox environment. See Test Data table for all header values. -
|
Authorization
required
|
An
OAuth 2.0 Bearer Token
with the write:self-assessment scope.
For example: Bearer bb7fed3fe10dd235a2ccda3d50fb
|
See also fraud prevention.
Request
{ "spouseOrCivilPartnerNino": "TC663795B", "spouseOrCivilPartnerFirstName": "John", "spouseOrCivilPartnerSurname": "Smith", "spouseOrCivilPartnerDateOfBirth": "1987-10-18" }
Name | Description |
---|---|
spouseOrCivilPartnerNino
string
required
|
Your spouse or civil partner's National Insurance number.
For example: |
spouseOrCivilPartnerFirstName
string
optional
|
Your spouse or civil partner's first name.
For example: |
spouseOrCivilPartnerSurname
string
required
|
Your spouse or civil partner's surname.
For example: |
spouseOrCivilPartnerDateOfBirth
string
optional
|
The date of birth of your spouse or civil partner in the format YYYY-MM-DD.
For example: |
Responses
HTTP status 201 (Created)
Response headers
Name | Description |
---|---|
X-CorrelationId
required
|
Unique ID for operation tracking c75f40a6-a3df-4429-a697-471eeec46435
|
See also fraud prevention.
Error scenarios
Scenario | HTTP status | Code |
---|---|---|
The format of the supplied NINO field is not valid. |
400 (Bad Request) |
FORMAT_NINO |
The format of your spouse or civil partner's first name is not valid. |
400 (Bad Request) |
FORMAT_SPOUSE_OR_CIVIL_PARTNERS_FIRST_NAME |
The format of your spouse or civil partner's surname name is not valid. |
400 (Bad Request) |
FORMAT_SPOUSE_OR_CIVIL_PARTNERS_SURNAME |
The format of your spouse or civil partner's National Insurance Number is not valid. |
400 (Bad Request) |
FORMAT_SPOUSE_OR_CIVIL_PARTNERS_NINO |
The format of the supplied spouse or civil partner's date of birth is not valid. |
400 (Bad Request) |
FORMAT_SPOUSE_OR_CIVIL_PARTNERS_DATE_OF_BIRTH |
An empty or non-matching body was submitted. |
400 (Bad Request) |
RULE_INCORRECT_OR_EMPTY_BODY_SUBMITTED |
The supplied spouse or civil partner is invalid because they are deceased. |
403 (Forbidden) |
RULE_DECEASED_RECIPIENT |
The request cannot be made as there is an existing Marriage Allowance claim. |
403 (Forbidden) |
RULE_ACTIVE_MARRIAGE_ALLOWANCE_CLAIM |
The client or agent is not authorised. This is 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 |
The request cannot be made as the current NINO supplied is invalid. |
403 (Forbidden) |
RULE_INVALID_REQUEST |
For error scenarios that are common across all APIs, and for error formats, see our reference guide.
Test data
Scenario simulations using Gov-Test-Scenario headers is only available in the sandbox environment.
Header Value (Gov-Test-Scenario) | Scenario |
---|---|
N/A - DEFAULT |
Simulates success response. |
DECEASED_RECIPIENT |
Simulates the scenario in which the supplied spouse or civil partner has been flagged as deceased. |
CLAIM_ALREADY_EXISTS |
Simulates the scenario in which a Marriage Allowance claim already exists for the supplied NINO. |
INVALID_REQUEST |
Simulates the scenario in which a request cannot be made as the current NINO supplied is invalid. |
Close Section
Disclosures
Resources relating to an individual's disclosures
Disclosures resources
/individuals/disclosures/{nino}/{taxYear}
Retrieve Disclosures
GET
This endpoint allows a developer to retrieve data related to disclosures, for a given tax year. A National Insurance number and tax year must be provided.
Path parameters
Name | Description |
---|---|
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. The minimum tax year is 2021-22. No gaps are allowed, for example, 2020-22 is not valid. (The minimum tax year in Sandbox is 2019-20.)
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
|
Gov-Test-Scenario
optional
|
Only in sandbox environment. See Test Data table for all header values. -
|
Authorization
required
|
An
OAuth 2.0 Bearer Token
with the read:self-assessment 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.
{ "submittedOn": "2020-07-06T09:37:17Z", "taxAvoidance": [ { "srn": "14211123", "taxYear": "2020-21" } ], "class2Nics": { "class2VoluntaryContributions": true }, "links":[ { "href":"/individuals/disclosures/TC663795B/2021-22", "rel":"create-and-amend-disclosures", "method":"PUT" }, { "href":"/individuals/disclosures/TC663795B/2021-22", "rel":"self", "method":"GET" }, { "href":"/individuals/disclosures/TC663795B/2021-22", "rel":"delete-disclosures", "method":"DELETE" } ] }
Name | Description |
---|---|
submittedOn
string
required
|
The date the disclosures information was added. It must be provided in the format YYYY-MM-DDThh:mm:ssZ
For example: |
taxAvoidance
array
optional
|
Details of tax avoidance scheme |
srn
string
required
|
Scheme Reference Number (SRN) of the tax avoidance scheme.
Must conform to the regular expression
For example: |
taxYear
string
required
|
The tax year in which the expected advantage arises. Date in the format YYYY-YY
Must conform to the regular expression
For example: |
class2Nics
object
optional
|
Object containing the Voluntary Class 2 National Insurance Contributions toggle |
class2VoluntaryContributions
boolean
optional
|
Indicates whether Voluntary Class 2 contributions have been captured. The value must be true if this is the case.
For example: |
links
array
optional
|
A list of endpoint links that indicate possible actions related to the current resource. |
href
string
required
|
The relative URL of the endpoint.
For example: |
rel
string
required
|
A label for the endpoint, which describes how it is related to the current resource. The ‘rel’ will be ‘self’ where the action is retrieval of the same resource. Limited to the following possible values: self
create-and-amend-disclosures
delete-disclosures
|
method
string
required
|
The HTTP method type for the endpoint. Limited to the following possible values: PUT
GET
DELETE
|
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 tax year field is not valid. |
400 (Bad Request) |
FORMAT_TAX_YEAR |
The specified tax year is not supported. That is, the tax year specified is before the minimum tax year value. |
400 (Bad Request) |
RULE_TAX_YEAR_NOT_SUPPORTED |
Tax year range invalid. A tax year range of one year is required. |
400 (Bad Request) |
RULE_TAX_YEAR_RANGE_INVALID |
The client or agent is not authorised. This is 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 |
The supplied income source could not be found. |
404 (Not Found) |
MATCHING_RESOURCE_NOT_FOUND |
For error scenarios that are common across all APIs, and for error formats, see our reference guide.
Test data
Scenario simulations using Gov-Test-Scenario headers is only available in the sandbox environment.
Header Value (Gov-Test-Scenario) | Scenario |
---|---|
N/A - DEFAULT |
Simulates success response. |
NOT_FOUND |
Simulates the scenario where no data is found. |
Close Section
/individuals/disclosures/{nino}/{taxYear}
Create and Amend Disclosures
PUT
This endpoint allows a developer to create and amend data related to disclosures, for a given tax year. A National Insurance number and tax year must be provided.
Path parameters
Name | Description |
---|---|
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. The minimum tax year is 2021-22. No gaps are allowed, for example, 2020-22 is not valid. (The minimum tax year in Sandbox is 2019-20.)
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
|
Content-Type
required
|
Specifies the format of the request body, which must be JSON. application/json
|
Gov-Test-Scenario
optional
|
Only in sandbox environment. See Test Data table for all header values. -
|
Authorization
required
|
An
OAuth 2.0 Bearer Token
with the write:self-assessment scope.
For example: Bearer bb7fed3fe10dd235a2ccda3d50fb
|
See also fraud prevention.
Request
Scenario: Full Disclosures Amendment
{ "taxAvoidance": [ { "srn": "14211123", "taxYear": "2020-21" } ], "class2Nics": { "class2VoluntaryContributions": true } }
Name | Description |
---|---|
taxAvoidance
array
optional
|
Details of tax avoidance scheme |
srn
string
required
|
Scheme Reference Number (SRN) of the tax avoidance scheme.
Must conform to the regular expression
For example: |
taxYear
string
required
|
The tax year in which the expected advantage arises. Date in the format YYYY-YY
Must conform to the regular expression
For example: |
class2Nics
object
optional
|
Object containing the Voluntary Class 2 National Insurance Contributions toggle |
class2VoluntaryContributions
boolean
optional
|
Indicates whether Voluntary Class 2 contributions are to be captured. The value can only be set to true.
For example: |
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.
{ "links":[ { "href":"/individuals/disclosures/TC663795B/2021-22", "rel":"create-and-amend-disclosures", "method":"PUT" }, { "href":"/individuals/disclosures/TC663795B/2021-22", "rel":"self", "method":"GET" }, { "href":"/individuals/disclosures/TC663795B/2021-22", "rel":"delete-disclosures", "method":"DELETE" } ] }
Name | Description |
---|---|
links
array
optional
|
A list of endpoint links that indicate possible actions related to the current resource. |
href
string
required
|
The relative URL of the endpoint.
For example: |
rel
string
required
|
A label for the endpoint, which describes how it is related to the current resource. The ‘rel’ will be ‘self’ where the action is retrieval of the same resource. Limited to the following possible values: self
create-and-amend-disclosures
delete-disclosures
|
method
string
required
|
The HTTP method type for the endpoint. Limited to the following possible values: PUT
GET
DELETE
|
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 tax year field is not valid. |
400 (Bad Request) |
FORMAT_TAX_YEAR |
The specified tax year is not supported. That is, the tax year specified is before the minimum tax year value. |
400 (Bad Request) |
RULE_TAX_YEAR_NOT_SUPPORTED |
Tax year range invalid. A tax year range of one year is required. |
400 (Bad Request) |
RULE_TAX_YEAR_RANGE_INVALID |
The format of the supplied scheme reference number is not valid. |
400 (Bad Request) |
FORMAT_SRN_INVALID |
An empty or non-matching body was submitted. |
400 (Bad Request) |
RULE_INCORRECT_OR_EMPTY_BODY_SUBMITTED |
Voluntary Class 2 Contributions can only be set to true. |
400 (Bad Request) |
RULE_VOLUNTARY_CLASS2_VALUE_INVALID |
The client or agent is not authorised. This is 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 |
Voluntary Class 2 NICs cannot be changed after 31st Jan following the year of submission. |
403 (Forbidden) |
RULE_VOLUNTARY_CLASS2_CANNOT_BE_CHANGED |
The supplied income source could not be found. |
404 (Not Found) |
MATCHING_RESOURCE_NOT_FOUND |
For error scenarios that are common across all APIs, and for error formats, see our reference guide.
Test data
Scenario simulations using Gov-Test-Scenario headers is only available in the sandbox environment.
Header Value (Gov-Test-Scenario) | Scenario |
---|---|
N/A - DEFAULT |
Simulates success response. |
VOLUNTARY_CLASS2_CANNOT_BE_CHANGED |
Simulates the scenario where Voluntary Class 2 NICs cannot be changed. |
NOT_FOUND |
Simulates the scenario where no data is found. |
Close Section
Delete Disclosures
DELETE
This endpoint allows a developer to delete data related to disclosures, for a given tax year. A National Insurance number and tax year must be provided.
Path parameters
Name | Description |
---|---|
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. The minimum tax year is 2021-22. No gaps are allowed, for example, 2020-22 is not valid. (The minimum tax year in Sandbox is 2019-20.)
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
|
Gov-Test-Scenario
optional
|
Only in sandbox environment. See Test Data table for all header values. -
|
Authorization
required
|
An
OAuth 2.0 Bearer Token
with the write:self-assessment scope.
For example: Bearer bb7fed3fe10dd235a2ccda3d50fb
|
See also fraud prevention.
Responses
HTTP status 204 (No Content)
Response headers
Name | Description |
---|---|
X-CorrelationId
required
|
Unique ID for operation tracking a1e8057e-fbbc-47a8-a8b4-78d9f015c253
|
See also fraud prevention.
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 tax year field is not valid. |
400 (Bad Request) |
FORMAT_TAX_YEAR |
The specified tax year is not supported. That is, the tax year specified is before the minimum tax year value. |
400 (Bad Request) |
RULE_TAX_YEAR_NOT_SUPPORTED |
Tax year range invalid. A tax year range of one year is required. |
400 (Bad Request) |
RULE_TAX_YEAR_RANGE_INVALID |
The client or agent is not authorised. This is 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 |
Voluntary Class 2 NICs cannot be changed after 31st Jan following the year of submission. |
403 (Forbidden) |
RULE_VOLUNTARY_CLASS2_CANNOT_BE_CHANGED |
The supplied income source could not be found. |
404 (Not Found) |
MATCHING_RESOURCE_NOT_FOUND |
For error scenarios that are common across all APIs, and for error formats, see our reference guide.
Test data
Scenario simulations using Gov-Test-Scenario headers is only available in the sandbox environment.
Header Value (Gov-Test-Scenario) | Scenario |
---|---|
N/A - DEFAULT |
Simulates success response. |
VOLUNTARY_CLASS2_CANNOT_BE_CHANGED |
Simulates the scenario where Voluntary Class 2 NICs cannot be changed. |
NOT_FOUND |
Simulates the scenario where no data is found. |
Close Section