FBR API

FBR Digital Invoicing API explained: post, validate and reference lookups

FBR’s Digital Invoicing API is the web service that invoicing software uses to send each sales invoice to FBR in real time and get back a valid or invalid result. It has two invoice methods, post and validate, plus a set of reference lookups for codes such as provinces, units and rates. This page explains each part in plain English, based on FBR’s technical documentation for Digital Invoicing (version 1.12, issued by PRAL). Most businesses never call the API themselves, because their software does; this page is for owners who want to understand what is happening, and for developers checking an integration.

Last updated 21 November 2026

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.

Table: Point, postinvoicedata (post), validateinvoicedata (validate)
Pointpostinvoicedata (post)validateinvoicedata (validate)
RequestInvoice header once, then the itemsThe same structure
Response has an overall statusYes: validationResponse with statusCode 00 or 01Yes: the same
Response has a status for each itemYes: invoiceStatusesYes: invoiceStatuses
FBR invoice number in the sample responseYes (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.

Table: Lookup, What it returns, Inputs
LookupWhat it returnsInputs
provincesProvince codes and names, such as Punjab and SindhNone
doctypecodeDocument types: Sale Invoice and Debit NoteNone
itemdesccodeHS codes with their descriptionsNone
sroitemcodeSRO item IDs and descriptionsNone
transtypecodeTransaction types with their IDsNone
uomUnits of measure with their IDsNone
SroScheduleSRO schedulesRate ID, date and an origination supplier value
SaleTypeToRate (v2)Rates for a transaction type: rate ID, description and valueDate, transaction type ID, province ID
HS_UOM (v2)Units of measure for an HS codeHS code and annexure ID
SROItem (v2)SRO items for an SRODate and SRO ID
statlA status for a registration number on a dateRegistration number and date
Get_Reg_TypeRegistered or unregistered, for a registration numberRegistration 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.

FAQ

Common questions

It is the web service FBR provides so that invoicing software can share each sales invoice with FBR in real time. FBR validates the invoice and answers with a status, and for a valid invoice posted through the post method, an FBR invoice number.
Both take the same kind of request and return a validation response. In FBR’s samples only the post response contains an FBR invoice number. The documentation does not explain validate in more detail, so confirm its exact behaviour with FBR.
According to FBR’s documentation, PRAL issues the token and gives it to the business with the API addresses. It is valid for 5 years, and a new token is requested when it expires.
Check the statusCode in the response: 00 means valid and 01 means invalid. Also check the status of each item line, because a rejection can appear at item level while the top-level code reads 00.

Talk to us about your business.

Start your 15-day trial, or message the team on WhatsApp at +92 333 7788853. Billora is an independent private product and is not affiliated with or endorsed by FBR.

Start Your 15-Day Trial