Obligations (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:
- retrieve obligations for a customer’s business income sources
- retrieve the final declaration obligations for a customer’s Income Tax account
- retrieve the End of Period Statement obligations for a customer’s business income sources
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"
}
]
}
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
/obligations/details/{nino}/income-and-expenditure
Retrieve Income Tax (Self Assessment) Income and Expenditure Obligations
GET
This endpoint allows a developer to retrieve obligations for a customer’s business income sources. The account identifier (National Insurance number) must be provided.
Path parameters
Name | Description |
---|---|
nino
string
required
|
National Insurance number, in the format AA999999A.
For example: |
Query parameters
Name | Description |
---|---|
typeOfBusiness
string
optional
|
The type of business whose obligations are to be returned, must be one of:
|
businessId
string
optional
|
The unique identifier for the business whose obligations are to be returned. Must conform to the regular expression
For example: |
fromDate
string
optional
|
The start date of the range to filter obligations in the format YYYY-MM-DD. Mandatory if the “to” query parameter is supplied. If the “from” and “to” date parameters are not supplied, the date range will default to a year from today unless the status parameter is set to “Open”.
For example: |
toDate
string
optional
|
The end date of the range to filter obligations in the format YYYY-MM-DD. Mandatory if the “from” query parameter is supplied. If the “from” and “to” date parameters are not supplied, the date range will default to a year from today unless the status parameter is set to “Open”.
For example: |
status
string
optional
|
Obligation status to return: Open or Fulfilled only. To retrieve all obligations omit the status.
|
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.
Example response
{ "obligations": [ { "typeOfBusiness": "self-employment", "businessId": "XAIS12345678910", "obligationDetails": [ { "periodStartDate": "2019-04-06", "periodEndDate": "2019-07-05", "dueDate": "2019-08-05", "receivedDate": "2019-08-01", "status": "Fulfilled" }, { "periodStartDate": "2019-07-06", "periodEndDate": "2019-10-05", "dueDate": "2019-11-05", "receivedDate": "2019-11-01", "status": "Fulfilled" }, { "periodStartDate": "2019-10-06", "periodEndDate": "2020-01-05", "dueDate": "2020-02-05", "receivedDate": "2020-02-01", "status": "Fulfilled" }, { "periodStartDate": "2020-01-06", "periodEndDate": "2020-04-05", "dueDate": "2020-05-05", "status": "Open" } ] } ] }
Name | Description |
---|---|
obligations
array
required
|
An array to return one or more businesses and their obligations details. |
typeOfBusiness
string
required
|
Identifies the type of business income source. One of "self-employment", "uk-property" or "foreign-property".
For example: |
businessId
string
required
|
The unique identifier for this business income source.
Must conform to the regular expression
For example: |
obligationDetails
array
required
|
An array holding the obligations for the business income source. |
periodStartDate
string
required
|
The start date of this obligation period in the format YYYY-MM-DD.
For example: |
periodEndDate
string
required
|
The end date of this obligation period in the format YYYY-MM-DD.
For example: |
dueDate
string
required
|
The due date for this obligation period in the format YYYY-MM-DD.
For example: |
status
string
required
|
The status of the obligation, one of: "Open" or "Fulfilled".
For example: |
receivedDate
string
optional
|
The date this obligation period was fulfilled in the format YYYY-MM-DD.
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 type of business field is not valid. |
400 (Bad Request) |
FORMAT_TYPE_OF_BUSINESS |
The format of the business ID field is not valid. |
400 (Bad Request) |
FORMAT_BUSINESS_ID |
The format of the From date field is not valid. |
400 (Bad Request) |
FORMAT_FROM_DATE |
The format of the To date field is not valid. |
400 (Bad Request) |
FORMAT_TO_DATE |
The format of the status field is not valid. |
400 (Bad Request) |
FORMAT_STATUS |
The From date parameter is missing. |
400 (Bad Request) |
MISSING_FROM_DATE |
The To date parameter is missing. |
400 (Bad Request) |
MISSING_TO_DATE |
The To date is before the From date. |
400 (Bad Request) |
RANGE_TO_DATE_BEFORE_FROM_DATE |
The Type of Business parameter is missing. |
400 (Bad Request) |
MISSING_TYPE_OF_BUSINESS |
The date range is longer than 366 days. |
400 (Bad Request) |
RULE_DATE_RANGE_INVALID |
The From date specified is before 2018-04-06. |
400 (Bad Request) |
RULE_FROM_DATE_NOT_SUPPORTED |
The request was not completed as it relates to an insolvent trader that is not supported by this API. |
400 (Bad Request) |
RULE_INSOLVENT_TRADER |
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 matching resource is not found. |
404 (Not Found) |
MATCHING_RESOURCE_NOT_FOUND |
No obligations found using this filter. |
404 (Not Found) |
NO_OBLIGATIONS_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 |
Simulate a successful response. |
OPEN |
Simulate a success response with an open obligation. |
FULFILLED |
Simulate a success response with a fulfilled obligation. |
INSOLVENT_TRADER |
Simulate a scenario where the remote endpoint indicates that the Trader is insolvent. |
NOT_FOUND |
Simulate a scenario where no data is found. |
NO_OBLIGATIONS_FOUND |
Simulate a scenario where no obligations are found. |
Close Section
/obligations/details/{nino}/crystallisation
Retrieve Income Tax (Self Assessment) Final Declaration Obligations
GET
This endpoint allows a developer to retrieve the final declaration (previously known as crystallisation) obligations for a customer’s Income Tax account. The account identifier (National Insurance number) must be provided.
Path parameters
Name | Description |
---|---|
nino
string
required
|
National Insurance number, in the format AA999999A.
For example: |
Query parameters
Name | Description |
---|---|
taxYear
string
optional
|
The tax year the data applies to. If not supplied it will default to the last completed tax year. The earliest permitted tax year is 2017-18.
|
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.
Default
{ "periodStartDate": "2018-04-06", "periodEndDate": "2019-04-05", "dueDate": "2020-01-31", "status": "Fulfilled", "receivedDate": "2020-01-25" }
Name | Description |
---|---|
periodStartDate
string
required
|
The start date of this obligation period. Date in the format YYYY-MM-DD.
For example: |
periodEndDate
string
required
|
The end date of this obligation period. Date in the format YYYY-MM-DD.
For example: |
dueDate
string
required
|
The due date for this obligation period. Date in the format YYYY-MM-DD.
For example: |
status
string
required
|
The status of the obligation, one of: `Open` or `Fulfilled`.
For example: |
receivedDate
string
optional
|
The date this obligation period was fulfilled. Date in the format YYYY-MM-DD.
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 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 |
The tax year provided is more than one year in length. |
400 (Bad Request) |
RULE_TAX_YEAR_TOO_LONG |
The format of the loss ID is not valid. |
400 (Bad Request) |
FORMAT_LOSS_ID |
The request was not completed as it relates to an insolvent trader that is not supported by this API. |
400 (Bad Request) |
RULE_INSOLVENT_TRADER |
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 remote endpoint has indicated that no data can be found for the given loss ID. |
404 (Not Found) |
MATCHING_RESOURCE_NOT_FOUND |
No obligations found using this filter. |
404 (Not Found) |
NO_OBLIGATIONS_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 |
Simulate a success response with an open obligation. |
FULFILLED |
Simulate a success response with a fulfilled obligation. |
OPEN |
Simulate a success response with an open obligation. |
INSOLVENT_TRADER |
Simulate a scenario where the remote endpoint indicates that the Trader is insolvent. |
NOT_FOUND |
Simulate a scenario where no data is found. |
Close Section
/obligations/details/{nino}/end-of-period-statement
Retrieve Income Tax (Self Assessment) End of Period Statement Obligations
GET
This endpoint allows a developer to retrieve the End of Period Statement obligations for a customer’s business income sources. The account identifier (National Insurance number) must be provided.
Path parameters
Name | Description |
---|---|
nino
string
required
|
National Insurance number, in the format AA999999A.
For example: |
Query parameters
Name | Description |
---|---|
typeOfBusiness
string
optional
|
The type of business whose obligations are to be returned, must be one of:
|
businessId
string
optional
|
The unique identifier for the business whose obligations are to be returned. Must conform to the regular expression
For example: |
fromDate
string
optional
|
The start date of the range to filter obligations in the format YYYY-MM-DD. Mandatory if the “to” query parameter is supplied. If the “from” and “to” date parameters are not supplied, the date range will default to a year from today unless the status parameter is set to “Open”.
For example: |
toDate
string
optional
|
The end date of the range to filter obligations in the format YYYY-MM-DD. Mandatory if the “from” query parameter is supplied. If the “from” and “to” date parameters are not supplied, the date range will default to a year from today unless the status parameter is set to “Open”.
For example: |
status
string
optional
|
Obligation status to return: Open or Fulfilled only. To retrieve all obligations omit the status.
|
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.
Example response
{ "obligations": [ { "typeOfBusiness": "self-employment", "businessId": "XAIS12345678910", "obligationDetails": [ { "periodStartDate": "2018-01-01", "periodEndDate": "2018-12-31", "dueDate": "2020-01-31", "receivedDate": "2019-05-13", "status": "Fulfilled" }, { "periodStartDate": "2019-01-01", "periodEndDate": "2019-12-31", "dueDate": "2021-01-31", "status": "Open" } ] } ] }
Name | Description |
---|---|
obligations
array
required
|
An array to return one or more businesses and their obligations details. |
typeOfBusiness
string
required
|
Identifies the type of business income source. One of "self-employment", "uk-property" or "foreign-property". If the type is not specified the default is to return obligations for all businesses. The type must be provided if businessId is provided.
For example: |
businessId
string
required
|
The unique identifier for this business income source.
Must conform to the regular expression
For example: |
obligationDetails
array
required
|
An array holding the obligations for the business income source. |
periodStartDate
string
required
|
The start date of this obligation period in the format YYYY-MM-DD.
For example: |
periodEndDate
string
required
|
The end date of this obligation period in the format YYYY-MM-DD.
For example: |
dueDate
string
required
|
The due date for this obligation period in the format YYYY-MM-DD.
For example: |
status
string
required
|
The status of the obligation, one of: "Open" or "Fulfilled".
For example: |
receivedDate
string
optional
|
The date this obligation period was fulfilled in the format YYYY-MM-DD.
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 type of business field is not valid. |
400 (Bad Request) |
FORMAT_TYPE_OF_BUSINESS |
The format of the business ID field is not valid. |
400 (Bad Request) |
FORMAT_BUSINESS_ID |
The format of the From date field is not valid. |
400 (Bad Request) |
FORMAT_FROM_DATE |
The format of the To date field is not valid. |
400 (Bad Request) |
FORMAT_TO_DATE |
The format of the status field is not valid. |
400 (Bad Request) |
FORMAT_STATUS |
The From date parameter is missing. |
400 (Bad Request) |
MISSING_FROM_DATE |
The To date parameter is missing. |
400 (Bad Request) |
MISSING_TO_DATE |
The To date is before the From date. |
400 (Bad Request) |
RANGE_TO_DATE_BEFORE_FROM_DATE |
The Type of Business parameter is missing. |
400 (Bad Request) |
MISSING_TYPE_OF_BUSINESS |
The date range is longer than 366 days. |
400 (Bad Request) |
RULE_DATE_RANGE_INVALID |
The From date specified is before 2018-04-06. |
400 (Bad Request) |
RULE_FROM_DATE_NOT_SUPPORTED |
The request was not completed as it relates to an insolvent trader that is not supported by this API. |
400 (Bad Request) |
RULE_INSOLVENT_TRADER |
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 matching resource is not found. |
404 (Not Found) |
MATCHING_RESOURCE_NOT_FOUND |
No obligations found using this filter. |
404 (Not Found) |
NO_OBLIGATIONS_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 |
Simulate a success response. |
OPEN |
Simulate a success response with an open obligation. |
FULFILLED |
Simulate a success response with a fulfilled obligation. |
INSOLVENT_TRADER |
Simulate a scenario where the remote endpoint indicates that the Trader is insolvent. |
NOT_FOUND |
Simulate a scenario where no data is found. |
Close Section