How the API is set up and who issues the security token
The documentation says invoice data is shared with FBR in real time through a web API, and that the API sits on PRAL’s Enterprise Service Platform (ESP). It is secured: every request must carry a security token in its header.
- Who issues the token: PRAL issues it and gives it to the business together with all the URLs needed to reach the API.
- How it is sent: in the Authorization header, with the word Bearer before the key.
- How long it lasts: 5 years. When it expires, a new token is requested and a new one is issued automatically.
- What a token problem looks like: the documentation lists HTTP status 401 (Unauthorized) and, separately, FBR error codes 0401 and 0402, which say the seller’s or buyer’s NTN or CNIC does not have a valid or authorised access token. See FBR error codes explained.
Post and validate: the two invoice methods
The documentation describes two methods that take the same kind of request and are both used on a real-time basis.
| Point | postinvoicedata (post) | validateinvoicedata (validate) |
|---|---|---|
| Request | Invoice header once, then the items | The same structure |
| Response has an overall status | Yes: validationResponse with statusCode 00 or 01 | Yes: the same |
| Response has a status for each item | Yes: invoiceStatuses | Yes: invoiceStatuses |
| FBR invoice number in the sample response | Yes (invoiceNumber) | No |
| Sandbox address ends in | _sb | _sb |
The request is one JSON object. The header appears once (invoice type, date, seller and buyer details, buyer registration type and, for a debit note, the reference invoice number), followed by a list of items. The full field list is on the invoice format page.
Only the post response carries the FBR invoice number in FBR’s samples. The documentation does not explain in words what validate does beyond its name, so confirm with FBR before relying on it to check invoices without posting them.
How to read FBR’s response
Both methods answer with a validationResponse. It has a statusCode (00 for Valid, 01 for Invalid) and an invoiceStatuses list with one entry for every item line. FBR’s samples show two kinds of rejection, so a careful integration checks both levels:
- Whole-invoice rejection: the top-level statusCode is 01 and carries an errorCode and message, for example 0052 (provide a proper HS code). invoiceStatuses is null.
- Item-level rejection: the top-level statusCode can read 00 while the status says invalid, and the item entry has statusCode 01 with its own errorCode, for example 0046 (provide rate).
Software that only reads the first status code could miss the second pattern. The documentation also lists the HTTP status codes 200 (OK), 401 (Unauthorized) and 500 (Internal Server Error, contact the administrator). A valid post response includes the invoiceNumber that FBR issued, which is the number your software keeps with the invoice.
The twelve reference lookups
Besides invoices, FBR provides reference APIs that return the lists an invoice must use. The documentation describes twelve: ten lookups of codes and rates, and two that check a registration number. The names below are as FBR gives them.
| Lookup | What it returns | Inputs |
|---|---|---|
| provinces | Province codes and names, such as Punjab and Sindh | None |
| doctypecode | Document types: Sale Invoice and Debit Note | None |
| itemdesccode | HS codes with their descriptions | None |
| sroitemcode | SRO item IDs and descriptions | None |
| transtypecode | Transaction types with their IDs | None |
| uom | Units of measure with their IDs | None |
| SroSchedule | SRO schedules | Rate ID, date and an origination supplier value |
| SaleTypeToRate (v2) | Rates for a transaction type: rate ID, description and value | Date, transaction type ID, province ID |
| HS_UOM (v2) | Units of measure for an HS code | HS code and annexure ID |
| SROItem (v2) | SRO items for an SRO | Date and SRO ID |
| statl | A status for a registration number on a date | Registration number and date |
| Get_Reg_Type | Registered or unregistered, for a registration number | Registration number |
The documentation’s samples for statl show only In-Active responses and do not explain the status codes, so ask FBR what a normal response looks like before building on it.
Where the lookups feed an invoice
- Province: sellerProvince and buyerProvince take values from the province lookup.
- Rate: the rate field takes the rate description from the SaleTypeToRate lookup.
- Unit: uoM takes its value from the unit lookup, and error 0099 says the unit must be valid for the HS code.
- Invoice type: Sale Invoice or Debit Note, as the document type lookup lists them.
This is why clean product records matter: HS code, unit, rate and sale type are stored once and reused on every sale. See product master data for clean invoices.
Sandbox and live addresses
FBR’s documentation gives an address for each invoice method:
- Production: gw.fbr.gov.pk/di_data/v1/di/postinvoicedata and gw.fbr.gov.pk/di_data/v1/di/validateinvoicedata.
- Sandbox: the same addresses with _sb at the end.
A scenarioId such as SN001 is required in sandbox requests only. The same document also says the addresses stay the same for sandbox and production and that routing follows the security token being used. The two statements are not reconciled in the text, so a developer should confirm with FBR which applies to their token. The sandbox testing guide covers the test process itself.
Do you need to use this API yourself?
Most businesses will not. They use software that is integrated with FBR, and the software handles the token, the requests and the responses. You need this page only if you are building or auditing an integration.
If your accounting system cannot connect to FBR directly, Billora’s own Invoicing API is a separate service: your system sends invoices to Billora, which posts them to FBR Digital Invoicing and returns the result. It is for businesses that take Billora software. A one-time FBR integration fee of Rs. 15,000 per account applies only if you want Billora to integrate your FBR profile with FBR; it covers any module, and if you are already integrated with FBR there is no integration fee; see the pricing page.
This page summarises version 1.12 of FBR’s documentation, whose change log ends on 24 July 2025. FBR may publish newer versions, so check FBR’s website for the current one. Billora is an independent private product and is not affiliated with or endorsed by FBR. This page is not legal or tax advice.