API Service Interface Specs
API Service Interface Specs
Version Control
Version History
Table of Contents
1. Introduction .................................................................................................................. 4
2. Registration at API Portal ............................................................................................. 4
3. API Services ................................................................................................................ 5
3.1 AIS for Employment Income API Service ................................................................. 5
3.1.1 JSON Request for AIS for Employment Income API Service .................................. 7
3.1.2 JSON Responses for AIS for Employment Income API Service ........................... 11
3.1.2.1 Success Response .............................................................................. 13
3.1.2.2 Error Response: Content Validation...................................................... 14
3.1.2.3 Error Response: Header or Trailer ........................................................ 16
3.1.2.4 Error Response: Exceed Max Records ................................................. 17
3.1.2.5 Error Response: Server Error ............................................................... 18
4. Status Codes for API Response.................................................................................. 19
5. Sample Code (C#) ..................................................................................................... 20
1. Introduction
The Inland Revenue Authority of Singapore (IRAS) provides application programming interface
(API) services to allow application developers to submit and retrieve tax related matters using
HTTP requests. Most of the APIs will be in the form of a RESTFUL web service which reduces
client/server coupling and thus enabling easier integration between IRAS’s service with external
developers.
There will be a variety of services available in due time, while some services require a simple
GET, others may be secured and require credentials that can be passed via HTTP header
parameters, as follows :
Client-Id String containing the client ID of the application invoking IRAS’ API. This
value will be provided to the application vendor by IRAS.
E.g. a1234b5c-1234-abcd-efgh-a1234b5cdef
Client-Secret String containing the client secret of the application invoking IRAS’ API. This
value will be provided to the application vendor by IRAS.
E.g. a12345bC67e8fG9a12345bC67e8fG9a12345bC67e8fG9
This document serves to help developers consume the API services provided by IRAS.
A computer-generated email will be sent to the subscriber’s email account for activation.
3. API Services
IRAS will provide several API services for public consumption. The following sections describe
the request and response for each of the services.
The table below shows the list of API services currently available in IRAS.
This service allows employers to submit employee’s employment income (IR8A, IR8S, Appendix
8A and Appendix 8B). Each submission allows up to 800 records and cannot be more than 8 Mb
in data size.
Submission Guideline
- If an employee has excess CPF contribution, Benefits-in-Kind and/or Stock Options Gains,
submit all the relevant form types (IR8A / IR8S / Appendix 8A / Appendix 8B) of this employee
within the same request.
- Ensure the amounts reflected in the IR8A and the supporting forms (IR8S / Appendix 8A /
Appendix 8B) tally.
- Original data (i.e. Batch Indicator = O) must be submitted before Amendment data.
- When submitting Amendment data, only prepare the affected employees' records and provide
the difference in amounts. Leave other numeric fields not affected by the error blank.
If the amendment for the supporting forms (IR8S/ Appendix 8A/ Appendix 8B) affects the
amounts submitted for Form IR8A, an IR8A amendment data has to be submitted within the
same request as well.
Sandbox Testing
This service in the sandbox environment is designed to mimic the actual Production
environment so developers can test the API integration before submitting to the Production
environment. Test scenarios and entities will be published in the API portal for developers to use.
With effect from YA 2021, this service is no longer available for subscription for new software
developers.
After a successful sandbox submission, a reference number will be provided within the API
response.
Submit the reference number(s) for the test scenario applicable to [email protected].
IRAS will review the submitted data and respond within 10 working days.
Production
Approval is required to use this service.
Before approval can be granted, developers must participate in the Sandbox Testing.
After approval is granted, client application can POST a JSON request object to the production
URL.
Client-Id String containing the client ID of the application invoking IRAS’ API. This value
will be provided to the application vendor by IRAS.
Client-Secret String containing the client secret of the application invoking IRAS’ API. This
value will be provided to the application vendor by IRAS.
3.1.1 JSON Request for AIS for Employment Income API Service
Client invoking this service will be expected to submit the following JSON request object with the
following fields in the HTTP request. Note that the field names are case sensitive.
bypass Boolean Indicator to indicate whether to bypass warning message thrown and
proceed with submission.
If bypass = true, hit warning and proceed with submission.
If bypass = false, respond as error with no submission.
userID String containing the ID Number of the person doing the submission. ID
Number must be valid.
userIDType String containing the type of User ID Number. Acceptable type are “1” is for
NRIC, “2” is for FIN , “4” is for WP , “A” is for ASGD and “11” is for MIC
inputType String to indicate if the content is a XML or TEXT format. Expected value
includes “XML” and “TEXT”.
clientID String containing the ID of the application invoking IRAS’ API. This value will
be provided to the application vendor by IRAS. This value will be the same as
the Client-Id in the HTTP header parameter.
# At least one of the form inputs must be filled. All inputs must be of the same input type (TEXT /
XML).
xmlns=\"http://www.iras.gov.sg/A8A2015\"/>\r\n<TaxableValueHotelAccommodation
xmlns=\"http://www.iras.gov.sg/A8A2015\">2500.00</TaxableValueHotelAccommodation>\r\n<C
ostOfLeavePassageAndIncidentalBenefits
xmlns=\"http://www.iras.gov.sg/A8A2015\"/>\r\n<NoOfLeavePassageSelf
xmlns=\"http://www.iras.gov.sg/A8A2015\"/>\r\n<NoOfLeavePassageSpouse
xmlns=\"http://www.iras.gov.sg/A8A2015\"/>\r\n<NoOfLeavePassageChildren
xmlns=\"http://www.iras.gov.sg/A8A2015\"/>\r\n<OHQStatus
xmlns=\"http://www.iras.gov.sg/A8A2015\"/>\r\n<InterestPaidByEmployer
xmlns=\"http://www.iras.gov.sg/A8A2015\"/>\r\n<LifeInsurancePremiumsPaidByEmployer
xmlns=\"http://www.iras.gov.sg/A8A2015\"/>\r\n<FreeOrSubsidisedHoliday
xmlns=\"http://www.iras.gov.sg/A8A2015\"/>\r\n<EducationalExpenses
xmlns=\"http://www.iras.gov.sg/A8A2015\"/>\r\n<NonMonetaryAwardsForLongService
xmlns=\"http://www.iras.gov.sg/A8A2015\"/>\r\n<EntranceOrTransferFeesToSocialClubs
xmlns=\"http://www.iras.gov.sg/A8A2015\"/>\r\n<GainsFromAssets
xmlns=\"http://www.iras.gov.sg/A8A2015\"/>\r\n<FullCostOfMotorVehicle
xmlns=\"http://www.iras.gov.sg/A8A2015\"/>\r\n<CarBenefit
xmlns=\"http://www.iras.gov.sg/A8A2015\"/>\r\n<OthersBenefits
xmlns=\"http://www.iras.gov.sg/A8A2015\"/>\r\n<TotalBenefitsInKind
xmlns=\"http://www.iras.gov.sg/A8A2015\">9347.25</TotalBenefitsInKind>\r\n<Filler
xmlns=\"http://www.iras.gov.sg/A8A2015\"/>\r\n<FieldReserved
xmlns=\"http://www.iras.gov.sg/A8A2015\"/>\r\n</A8A2015ST>\r\n</ESubmissionSDSC>\r\n</A8
ARecord>\r\n</Details>\r\n</A8A2015>",
"a8bInput": null,
"inputType": "XML",
"clientID": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
3.1.2 JSON Responses for AIS for Employment Income API Service
For API services that process or persist data, a JSON response object will be returned to the
client after service is invoked in the HTTP response. Clients invoking these API services will be
required to consume this JSON response object to retrieve the status and output. The schema of
the response object varies across services and will be covered in detail in each specific service
in the later sections.
Depending on the request to this service, the following different responses can be expected from
the service based on the input provided to it from the request.
statusCode A string representing the status of the service output returned to the client. The
default value is 200 (OK). For a listing of valid status codes, see Status Codes
section below.
ir8a An array containing the output, warning, error related to the ir8a form submitted.
ir8s An array containing the output, warning, error related to the ir8s form submitted.
a8a An array containing the output, warning, error related to the a8a form submitted.
a8b An array containing the output, warning, error related to the a8b form submitted.
Detailed description of the output, warning and error are listed the table below.
output An array containing pipe delimited string/s containing the Submission Reference
Number and the processed information of the submission, as shown in sample
below. Client is expected to store the Submission Reference Number for future
reference.
A successful call to the service means that the AIS submission is accepted. A JSON response
object that contains the following fields will be returned in the HTTP response.
msgError Empty
ir8a An array containing the output, warning, error related to the ir8a form submitted.
ir8s An array containing the output, warning, error related to the ir8s form submitted.
a8a An array containing the output, warning, error related to the a8a form submitted.
a8b An array containing the output, warning, error related to the a8b form submitted.
OR
When the records in the content has failed validations, the call to the service is unsuccessful. A
JSON response object that contains the following fields will be returned in the HTTP response.
msgError String which may contain a simplified error message or an error number.
ir8a An array containing the output, warning, error related to the ir8a form submitted.
ir8s An array containing the output, warning, error related to the ir8s form submitted.
a8a An array containing the output, warning, error related to the a8a form submitted.
a8b An array containing the output, warning, error related to the a8b form submitted.
LTD.|200312345A|2016|O|0102161600|200312345A|30|99999|999",
"warnings":[ ],
"errors":[ ]
},
"ir8s": {
"output":"",
"warnings":[ ],
"errors":[ ]
},
"a8a": {
"output":"",
"warnings":[ ],
"errors":[ ]
},
"a8b": {
"output":"",
"warnings":[ ],
"errors":[ ]
}
}
If bypass=false, warning message will be shown and submission will not be allowed.
{
"statusCode": “400”,
"msgError": “”,
"ir8a": {
"output":"ES12345678ir8a1234567890|SAMPLE PTE.
LTD.|200312345A|2016|O|0102161600|200312345A|30|99999|999",
"warnings":[{
"recordType": 1,
"recordField": "IDNo",
"recordIdentifier": "S1234567A",
"error": "ir8s is required"
}],
"errors":[ ]
},
"ir8s": {
"output":"",
"warnings":[ ],
"errors":[ ]
},
"a8a": {
"output":"",
"warnings":[ ],
"errors":[ ]
},
"a8b": {
"output":"",
"warnings":[ ],
"errors":[ ]
}
}
When the Header or Trailer in the content has failed validations, the call to the service is
unsuccessful. A JSON response object that contains the following fields will be returned in the
HTTP response.
msgError String which may contain a simplified error message or an error number.
ir8a An array containing the output, warning, error related to the ir8a form submitted.
ir8s An array containing the output, warning, error related to the ir8s form submitted.
a8a An array containing the output, warning, error related to the a8a form submitted.
a8b An array containing the output, warning, error related to the a8b form submitted.
When the number of records submitted is more than 800, the call to the sevice is unsuccessful. A
JSON response object that contains the following fields will be returned in the HTTP response.
There will be only one error record in an error array, as shown in sample below.
msgError String which may contain a simplified error message or an error number.
ir8a An array containing the output, warning, error related to the ir8a form submitted.
ir8s An array containing the output, warning, error related to the ir8s form submitted.
a8a An array containing the output, warning, error related to the a8a form submitted.
a8b An array containing the output, warning, error related to the a8b form submitted.
When an exception occurs during the processing of the request, a JSON response object that
contains the following fields will be returned in the HTTP response.
msgError String which may contain a simplified error message or an error number.
The statusCode field will always contain an integer representing the processed state of the
request. The list of possible status codes and what they represent are listed below.
using System;
using System.Net;
using System.IO;
using System.Text;
try
{
var httpWebRequest = (HttpWebRequest)WebRequest.Create(url);
httpWebRequest.ContentType = "application/json;";
httpWebRequest.Method = "POST";
if (e.Response != null)
{
// Step 4c: Print Output response exception
Stream receiveStream = e.Response.GetResponseStream();
StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8);
// print the error received from Server
Console.WriteLine("Response error received - ");
Console.WriteLine(readStream.ReadToEnd());
}
}
}
The information provided is intended for better general understanding and is not intended to comprehensively address
all possible issues that may arise. The contents are correct as at 3 Nov 2020 and are provided on an “as is” basis
without warranties of any kind. IRAS shall not be liable for any damages, expenses, costs or loss of any kind however
caused as a result of, or in connection with your use of this document.
While every effort has been made to ensure that the above information is consistent with existing policies and practice,
should there be any changes, IRAS reserves the right to vary our position accordingly.