Technical Documentation For DI API
Technical Documentation For DI API
Confidential Information:
The information provided in this document is intended solely for the DI API from PRAL. The contents of this
document may not be reproduced or divulged outside the intended organizations without the express
written permission of PRAL.
Document Information
Category Information
Document Technical Specifications Document
Project-Module Technical Specification for DI API
Title
Version 1.0
Author Muhammad Umair Siddique
Status Draft
Reviewer(s) Mehboob Ur Rehman, Sohail Anjum
Review Date 7-April-2025
Updated By
Updated Date 14-Apr-2025
Approver
Issue Date
Distribution SD Wing
Document Internal External
Category
Privacy Level Public PRAL Confidential Customer Confidential
Disclaimer This document contains confidential information. Do not distribute this
document without prior approval from PRAL.
Review History
Sr. # Reviewer R/V Date Remarks
1.
2.
3.
4.
2
Document Version :1.0 PRAL © 2025 – All rights reserved Page 2 of 28
DI API Technical Specification
Contents
1. Purpose ................................................................................................................................................. 4
2. Data Sharing Mode ............................................................................................................................... 5
3. Web API................................................................................................................................................. 5
3.1. Web API Security........................................................................................................................... 5
3.2. Web Methods Details ................................................................................................................... 5
4. Digital Invoicing API............................................................................................................................... 6
4.1. Web method for Digital Invoicing - Post ....................................................................................... 6
4.2. Web method for Digital Invoicing - Validate............................................................................... 11
5. Digital Invoicing Reference APIs.......................................................................................................... 18
5.1. Web method for Digital Invoicing – Province Code .................................................................... 18
5.2. Web method for Digital Invoicing – Document Type ID ............................................................. 19
5.3. Web method for Digital Invoicing – Item Code .......................................................................... 20
5.4. Web method for Digital Invoicing – SRO Item ID ........................................................................ 21
5.5. Web method for Digital Invoicing – Transaction Type ID ........................................................... 22
5.6. Web method for Digital Invoicing – ID of the UOM .................................................................... 22
5.7. Web method for Digital Invoicing – ID of the SRO...................................................................... 24
5.8. Web method for Digital Invoicing – ID of The Rate .................................................................... 25
5.9. Web method for Digital Invoicing – HS Code.............................................................................. 26
5.10. Web method for Digital Invoicing – Item ID ........................................................................... 27
6. Digital Invoicing Logo & QR Code........................................................................................................ 28
3
Document Version :1.0 PRAL © 2025 – All rights reserved Page 3 of 28
DI API Technical Specification
1. Purpose
The purpose of this document is to facilitate Supply Chain Operators to understand the
methods for Digital Invoice Data sharing with FBR.
ERP or equivalent software will be integrated with FBR as per the following steps:
• Each ERP or equivalent software will register in the FBR system from which it wants to
upload the invoice data.
• Taxpayers will integrate their ERP/System with FBR Digital Invoicing System as per
provided details in the Section (3) Integration Steps with FBR.
4
Document Version :1.0 PRAL © 2025 – All rights reserved Page 4 of 28
DI API Technical Specification
3. Web API
This Web API resides on PRAL ESP (Enterprise Service Platform) and is exposed with
methods to facilitate Digital Invoicing sharing between Supply Chain Operators and FBR.
Figure 1 below illustrates how to pass this token in the header of each request using
Postman.
Figure 2 Security Key added with the word "Bearer" will be passed on in Value of parameter
Authorization
5
Document Version :1.0 PRAL © 2025 – All rights reserved Page 5 of 28
DI API Technical Specification
"invoiceDate": "2024-05-16",
"sellerAddress": "Rawalpindi",
"sellerProvince": "Punjab",
"buyerNTNCNIC": "1234567890123",
"buyerProvince": "Sindh",
"buyerAddress": "Karachi",
"invoiceRefNo": "",
6
Document Version :1.0 PRAL © 2025 – All rights reserved Page 6 of 28
DI API Technical Specification
"items": [
"hsCode": "99260000",
"productDescription": "OTHER",
"rate": “17%”,
"uoM": "KG",
"quantity": 100,
"totalValues": 1170.00,
"valueSalesExcludingST": "1000",
"salesTaxApplicable": 170,
"salesTaxWithheldAtSource": 50.00,
"extraTax": 75.00,
"furtherTax": 90.00,
"sroScheduleNo": "SRO123",
"fedPayable": 0,
"discount": 0,
"saleType": "Services",
"sroItemSerialNo": "1"
} ,
7
Document Version :1.0 PRAL © 2025 – All rights reserved Page 7 of 28
DI API Technical Specification
"hsCode": "99260001",
"productDescription": "OTHER",
"rate": “18%”,
"uoM": "KG",
"quantity": 10,
"totalValues": 1170.00,
"valueSalesExcludingST": "1000",
"salesTaxApplicable": "170",
"salesTaxWithheldAtSource": 50.00,
"extraTax": 75.00,
"furtherTax": 90.00,
"sroScheduleNo": "SRO123",
"fedPayable": 0,
"discount": 0,
"sroItemSerialNo": "2"
]}
8
Document Version :1.0 PRAL © 2025 – All rights reserved Page 8 of 28
DI API Technical Specification
Json
JSON Field required sample data Description
DataType
Date and time when the invoice
invoiceDate datetime Required "2024-05-16"
was issued.
sellerBusinessName string Required "General business" Seller Business Name
sellerAddress string Required "Rawalpindi" Seller business Address
sellerProvince string Required "Punjab" Seller province
buyerNTNCNIC string Required 1234567890123 Buyer Registration No
buyerBusinessName string Required "John Doe" Buyer Name
Total number of items in the
buyerProvince string Required "Sindh"
invoice.
Total discount applied to the
buyerAddress string Required "Karachi"
invoice.
• Sales Invoice
InvoiceType Int Required 1 • Purchase Invoice
• Debit Note
Required
only in case
7327556DI1744111990654 Reference Invoice no for the
invoiceRefNo String of
debit/credit note
debit/credit
note
Json
JSON Field required sample data Description
DataType
HS Code is applicable to
hsCode string Required "99260000" manufacturer-cum-retailer issuing
electronic invoices
productDescription string Required "OTHER" Product detail
Tax Rate (ratE_DESC from
rate string Required 17%
reference API 5.8)
uoM string Required "KG" Unit of Measurement
quantity int Required 100 Item Quantity
totalValues double Required 1170.00 Total Sales Value
valueSalesExcludingST double Required 1000 Sales Value Excluding sales tax
Amount of Sales Tax/ FED in sales
salesTaxApplicable int Required 170
tax mode
salesTaxWithheldAtSource double Required 150.00 Sales Tax Withheld at source
sroScheduleNo string Optional "SRO123" SRO Schedule No
9
Document Version :1.0 PRAL © 2025 – All rights reserved Page 9 of 28
DI API Technical Specification
{
"invoiceNumber": "8885801DI1740728862069",
"validationResponse": {
"statuscode": "00",
"status": "valid",
"errors": "",
"invoiceStatuses": [
{
"itemSNo": "1"
"statuscode": "00",
"status": "Valid",
"invoiceNo": "8885801DI1740728862069",
"remarks": "",
},
10
Document Version :1.0 PRAL © 2025 – All rights reserved Page 10 of 28
DI API Technical Specification
"itemSNo": "2"
"statuscode": "00",
"status": "Valid",
"invoiceNo": "8885801DI1740728862069",
"remarks": "",
},
]
}
}
S. No Field Message
1. Invoice Number Invoice Number issued by FBR System
2. Status Code 00 - Valid
01 – Invalid
3. Exception Details of the errors
4. Invoice Status Item Serial Number
Statuscode (00 valid, 01 Invalid)
Status (“Valid or invalid)
Invoice Number (Invoice Number Issued by FBR
System)
Remarks:
11
Document Version :1.0 PRAL © 2025 – All rights reserved Page 11 of 28
DI API Technical Specification
"invoiceDate": "2024-05-16",
"sellerAddress": "Rawalpindi",
"sellerProvince": "Punjab",
"buyerNTNCNIC": "1234567890123",
"buyerProvince": "Sindh",
"buyerAddress": "Karachi",
"invoiceRefNo": "",
"items": [
"hsCode": "99260000",
"productDescription": "OTHER",
"rate": “17%”,
"uoM": "KG",
12
Document Version :1.0 PRAL © 2025 – All rights reserved Page 12 of 28
DI API Technical Specification
"quantity": 100,
"totalValues": 1170.00,
"valueSalesExcludingST": "1000",
"salesTaxApplicable": 170,
"salesTaxWithheldAtSource": 50.00,
"extraTax": 75.00,
"furtherTax": 90.00,
"sroScheduleNo": "SRO123",
"fedPayable": 0,
"discount": 0,
"saleType": "Services",
"sroItemSerialNo": "1"
} ,
"hsCode": "99260001",
"productDescription": "OTHER",
"rate": “18%”,
"uoM": "KG",
"quantity": 10,
"totalValues": 1170.00,
13
Document Version :1.0 PRAL © 2025 – All rights reserved Page 13 of 28
DI API Technical Specification
"valueSalesExcludingST": "1000",
"salesTaxApplicable": "170",
"salesTaxWithheldAtSource": 50.00,
"extraTax": 75.00,
"furtherTax": 90.00,
"sroScheduleNo": "SRO123",
"fedPayable": 0,
"discount": 0,
"sroItemSerialNo": "2"
]}
Json
JSON Field required sample data Description
DataType
Date and time when the invoice was
invoiceDate datetime Required "2024-05-16"
issued.
sellerBusinessName string Required "General business" Seller Business Name
sellerAddress string Required "Rawalpindi" Seller Business Address
sellerProvince string Required "Punjab" Seller Province
buyerNTNCNIC string Required 1234567890123 Buyer NTN Registration no
buyerBusinessName string Required "John Doe" Buyer Name
buyerProvince string Required "Sindh" Total number of items in the invoice.
Total discount applied to the
buyerAddress string Required "Karachi"
invoice.
14
Document Version :1.0 PRAL © 2025 – All rights reserved Page 14 of 28
DI API Technical Specification
• Sales Invoice
• Purchase Invoice
InvoiceType Int Required 1
• Debit Note
• Credit Note
Required
only in case
7327556DI1744111990654 Reference Invoice no for the
invoiceRefNo String of
debit/credit note
debit/credit
note
Json
JSON Field required sample data Description
DataType
HS Code is applicable to
hsCode string Required "99260000" manufacturer-cum-retailer issuing
electronic invoices
productDescription string Required "OTHER" Product detail
Tax Rate (ratE_DESC from
rate string Required 17%
reference API 5.8)
uoM string Required "KG" Unit of Measurement
quantity int Required 100 Item Quantity
totalValues double Required 1170.00 Buyer NTN Registration no
valueSalesExcludingST double Required 1000 Sales Value Excluding sales tax
salesTaxApplicable int Required 170 Amount of Sales Tax
salesTaxWithheldAtSource double Required 150.00 Sales tax withheld at source
sroScheduleNo string Optional "SRO123" SRO Schedule No.
furtherTax double Optional 70.00 Further Tax
discount double Optional 70.00 Discount
Federal excise duty payable in
fedPayable double Optional 70.00
sales tax mode
sroItemSerialNo string Optional "1" SRO Item Serial Number
saleType string Required "Services" Sale Type
extraTax double Optional 0.00 Extra Tax
"validationResponse": {
"status": "Valid",
"statuscode": "00",
"errors": "",
"invoiceStatuses": [
{
"itemSNo": "1"
"statuscode": "00",
"status": "Valid",
"invoiceNo": "null",
"remarks": "",
},
{
"itemSNo": "2"
"statuscode": "00",
"status": "Valid",
"invoiceNo": "null",
"remarks": "",
}
16
Document Version :1.0 PRAL © 2025 – All rights reserved Page 16 of 28
DI API Technical Specification
S. No Field Message
1. Status Code 00 - Valid
01 – Invalid
2. Exception Details of the errors
3. Invoice Status Item Serial Number
Statuscode (00 valid, 01 Invalid)
Status (“Valid or invalid)
Invoice Number (Invoice Number Issued by FBR
System)
Remarks:
17
Document Version :1.0 PRAL © 2025 – All rights reserved Page 17 of 28
DI API Technical Specification
This Web method (provinces) HTTP meth Get will be used on a real time basis. API
consumer will have to send object model mentioned below. This method will take
following parameters and will return Json response as shown in example below.
URL: https://gw.fbr.gov.pk/pdi/v1/provinces
[ {
"stateProvinceCode": 7,
"stateProvinceDesc": "PUNJAB"
},
{
"stateProvinceCode": 8,
"stateProvinceDesc": "SINDH"
}
]
18
Document Version :1.0 PRAL © 2025 – All rights reserved Page 18 of 28
DI API Technical Specification
S. No Field Description
1. StateprovinceCode Province code
2. stateprovinceDesc Description on the province
5.1.3. Http Status Codes:
[{
"docTypeId": 4,
"docDescription": "Sale Invoice"
},
{
"docTypeId": 9,
"docDescription": "Debit Note"
}]
S. No Field Description
1. docTypeId Id for the document type
2. docDescription Description of the document type
19
Document Version :1.0 PRAL © 2025 – All rights reserved Page 19 of 28
DI API Technical Specification
[{
"hS_CODE": "8432.1010",
"description": "NUCLEAR REACTOR, BOILERS, MACHINERY AND
MECHANICAL APPLIANCES; PARTS THEREOF. - AGRICULTURAL,
HORTICULTURAL OR FORESTRY MACHINERY FOR SOIL PREPARATION OR
CULTI- VATION; LAWN OR SPORTS GROUND ROLLERS. - CHISEL
PLOUGHS"
},
{
"hS_CODE": "0304.7400",
"description": "FISH AND CRUSTACEANS, MOLLUSCS AND OTHER
AQUATIC INVERTEBRATES - FISH FILLETS AND OTHER FISH MEAT
(WHETHER OR NOT MINCED), FRESH, CHILLED OR FROZEN. - HAKE
(MERLUCCIUS SPP., UROPHYCIS SPP.)"
}]
S. No Field Description
1. Hs_Code HS Code
2. description Description of the HSCode
20
Document Version :1.0 PRAL © 2025 – All rights reserved Page 20 of 28
DI API Technical Specification
[
{
"srO_ITEM_ID": 724,
"srO_ITEM_DESC": "9"
},
{
"srO_ITEM_ID": 728,
"srO_ITEM_DESC": "1"
}
]
S. No Field Description
1. Sro_ITEM_ID SRO item id
2. srO_ITEM_DESC SRO Item Description
21
Document Version :1.0 PRAL © 2025 – All rights reserved Page 21 of 28
DI API Technical Specification
[
{
"transactioN_TYPE_ID": 82,
"transactioN_DESC": "DTRE goods"
},
{
"transactioN_TYPE_ID": 87,
"transactioN_DESC": "Special procedure cottonseed"
},
{
"transactioN_TYPE_ID": 111,
"transactioN_DESC": "Electricity Supplied to marble/granite
industry"
}
]
S. No Field Description
1. transactioN_TYPE_ID Transaction type id
2. transaction_DESC Description of the transaction type
5.5.3. Http Status Codes:
URL: https://gw.fbr.gov.pk/pdi/v1/uom
[
{
"uoM_ID": 77,
"description": "Square Metre"
},
{
"uoM_ID": 13,
"description": "KG"
}
]
S. No Field Description
1. UOM_ID ID of the UOM
2. Description Description of the UOM
5.6.3. Http Status Codes:
23
Document Version :1.0 PRAL © 2025 – All rights reserved Page 23 of 28
DI API Technical Specification
[
{
"srO_ID": 7,
"srO_DESC": "Zero Rated Gas"
},
{
"srO_ID": 8,
"srO_DESC": "5th Schedule"
}
]
S. No Field Description
1. SRO_ID ID of the SRO
2. srO_DESC Description of the SRO
5.7.3. Http Status Codes:
S. No Status Code Message
1. 200 Ok
2. 401 Unauthorized
3. 500 Internal Server Error (Contact Administrator)
24
Document Version :1.0 PRAL © 2025 – All rights reserved Page 24 of 28
DI API Technical Specification
[
{
"ratE_ID": 734,
"ratE_DESC": "18% along with rupees 60 per kilogram",
"ratE_VALUE": 18
}
,
{
"ratE_ID": 280,
"ratE_DESC": "0%",
"ratE_VALUE": 0
}
]
S. No Field Description
1. Rate_ID ID of the rate
2. rate_DESC Description of the rate
3. Rate_VALUE Value of the rate
5.8.3. Http Status Codes:
25
Document Version :1.0 PRAL © 2025 – All rights reserved Page 25 of 28
DI API Technical Specification
[
{
"uoM_ID": 77,
"description": "Square Meter"
}
]
]
S. No Field Description
1. uoM_ID ID of the unit of measure
2. description Description of the unit of measure
5.9.3. Http Status Codes:
26
Document Version :1.0 PRAL © 2025 – All rights reserved Page 26 of 28
DI API Technical Specification
[
{
"srO_ITEM_ID": 17853,
"srO_ITEM_DESC": "50"
},
{
"srO_ITEM_ID": 17854,
"srO_ITEM_DESC": "51"
}
]
S. No Field Description
1. Sro_ITEM_ID Item id
2. Sro_ITEM_DESC Description of the Item
5.10.3. Http Status Codes:
27
Document Version :1.0 PRAL © 2025 – All rights reserved Page 27 of 28
DI API Technical Specification
28
Document Version :1.0 PRAL © 2025 – All rights reserved Page 28 of 28