Issue TRA-fiscalised receipts from your own software. You send an invoice; PowerVFD validates it, gives it a receipt number, Z number and verification code, and submits it to TRA.
The PowerVFD web dashboard and mobile app issue receipts through this same endpoint, so a POS, an ERP, Tally or any custom system gets exactly the same behaviour. These docs describe how the server behaves today, quirks included.
Licence check. Every device referenced in the request must hold a valid PowerVFD licence. If one doesn't, the request stops with 402 before anything else is looked at. See Device licence check.
Interface and invoice checks. The fcode and fcodetoken in the body must match an authorised interface, and every invoice must pass the validation rules. Any failure returns an error and nothing is written.
Receipt issued. The invoice is saved with its receipt number, Z number and verification code, and those come back in the response.
Sent to TRA. PowerVFD submits the receipt to TRA. If TRA can't be reached, the invoice stays pending and is sent later.
What you need
A PowerVFD server your system can reach. Its address is the base URL for every request. Set it in the sidebar and the code samples on this site will use it.
Interface credentials: an fcode and fcodetoken for your system. See Authentication.
A device number such as DV03 for the TRA registration you're issuing against, unless the server has a default device.
Conventions
Topic
Rule
Format
JSON request and response bodies. Send Content-Type: application/json.
Amounts
Tanzanian shillings, VAT-inclusive, sent as numbers such as 5000.00.
Dates and times
idate as YYYY-MM-DD, itime as 24-hour HH:MM:SS.
Codes
taxcode, custidtype and paytype are accepted as numbers or numeric strings: 1 and "1" are the same.
Errors
Always { status, message, statusCode }, with statusCode matching the HTTP status.
Quickstart
Send one invoice and read back the receipt details.
1. Point the samples at your server
Enter the address of your PowerVFD server. It's saved in this browser only, and every code sample on the site uses it.
Include the scheme, and the port if your server uses one, for example http://192.168.1.20:<port>. API paths start with /service/v1.
2. Get interface credentials
An interface is one system that's allowed to submit invoices. Each interface has two values:
Field
What it is
fcode
The interface code, for example F-9CJ21A.
fcodetoken
The interface's secret token, issued together with the code.
For a POS, ERP or Tally, an administrator configures the interface in the PowerVFD web dashboard. The mobile app claims its own interface by scanning the interface's QR code.
The token is the only thing that authenticates an invoice. Keep it on your server, never in browser code or anywhere a customer can read it.
3. Find your device number
Each VFD registration with TRA is a device in PowerVFD, with a number like DV03. The invoice is fiscalised against that device's TIN and certificate. Send it as devicenumber. You can leave it out only if the server has a default device configured.
4. Send the invoice
This sends a cash sale to a walk-in customer (custidtype 6, no ID). The samples fill in today's date and the current time, because future dates are always rejected and past dates usually are.
Store vfdinvoicenum, znumber, rctvcode and rctvnum against your own invoice and print them on the receipt. rctvnum is the TRA verification URL that the receipt's QR code encodes. Every field is described in Responses.
6. Handle errors
Errors share one envelope, { "status": "error", "message": "…", "statusCode": 400 }. The status tells you what kind of problem it is:
Status
Meaning
400
Something in the invoice failed validation. Fix the request; don't resend it unchanged.
402
The device can't fiscalise right now because of a licence problem. The invoice itself is fine.
403
The user named in username isn't allowed to create invoices.
404
The interface credentials weren't accepted.
500
Unexpected server error. Safe to retry with the same custinvoiceno.
The invoice endpoint is authenticated by credentials inside the request body, not by a header.
Other PowerVFD routes require a signed-in user's access token. Invoice submission deliberately doesn't. Instead it checks the fcode and fcodetoken in the body against the interfaces registered in PowerVFD. That's what lets a POS, Tally or another system submit invoices without ever logging in as a dashboard user.
Interface credentials
Field
Where it comes from
fcode
The interface code. Claimed by scanning the interface's QR code (mobile app) or configured in the dashboard (web and integrations).
fcodetoken
The interface's secret token, issued with the fcode when the interface is claimed. This is the actual authentication for the endpoint.
Before the credentials are even looked at, PowerVFD checks the licence of every device referenced in the request. If a licence is missing, expired, revoked or tied to another machine, the request is rejected with 402. Nothing about the invoice is wrong in that case: the device just can't fiscalise right now.
An expired licence gets one automatic online renewal attempt first. You only see the 402 if that renewal fails or the licence server can't be reached. The messages are listed under Errors.
When credentials are rejected
If the fcode and fcodetoken don't match an authorised interface, the response is:
{
"status": "error",
"message": "Interface: This request is not authorized to access the system, please contact system Administrator to authorize",
"statusCode": 404
}
This is a 404, not a 403. It comes back as HTTP 404 with statusCode: 404 even though it's an authorisation failure. That's how the server behaves today. Treat a 404 from this endpoint as "credentials not accepted".
Keeping credentials safe
Submit from your server or back office, not from browser JavaScript, where anyone can read the token.
Give each system its own interface. If one is retired or exposed, an administrator can switch it off without affecting the others.
Keep full request bodies out of shared logs. They contain the token.
Submit invoices
POST/service/v1/invoices
POST/service/v1/invoices/tallySame handler, wrapped for Tally XML integrations
Creates one or more invoices, issues their receipts and returns the verification details. The web dashboard, the mobile app and third-party integrations all use it.
Headers
Header
Required
Value
Content-Type
Yes
application/json
Authentication travels in the body as fcode and fcodetoken. See Authentication.
invoice is always an array. The same shape submits one invoice or a batch, with one device and customer per entry. The mobile app always sends a single-element array; the dashboard uses batches for imported and migrated invoices. See Batch submission.
Invoice fields
Field
Type
Required
Description
idate
string YYYY-MM-DD
Yes
Invoice date, as a strict YYYY-MM-DD date. Future dates are always rejected. Past dates are rejected unless the device's timeserver setting is lastinv, and even then only if no later-dated invoice already exists for that device.
itime
string HH:MM:SS
Yes
Invoice time in 24-hour format.
custinvoiceno
string
Recommended
Your own invoice or reference number. If present, it must be unique per device across every send status, so resubmitting a number that was already sent is rejected as a duplicate. Required when paytype is 5.
Customer ID. For a TIN (type 1), spaces and dashes are stripped before the 9-digit check. For type 6 it must be omitted, empty or "null"; sending a value is a validation error.
Line total including VAT. Must be numeric, not negative and not empty. Don't split net and tax yourself; the server does it from taxcode.
prodid
number
No
Links the line to a product. Required, with qty capped at 1, when the device has unique item mode on. A product already marked sold can't be sold again.
Transactions
The whole request runs in a single database transaction. If any invoice in the array fails validation, the entire batch is rolled back and none of it is saved. The response shape for one invoice and for several is described in Responses.
The Tally route
/service/v1/invoices/tally runs the same handler, wrapped for Tally XML integrations. The fields, validation, responses and errors on this site apply to it unchanged. See Tally integration.
Responses
A success returns the receipt's verification details. An error returns one consistent envelope.
The full TRA receipt-verification URL. This is what the printed QR code encodes.
rctvcode
The receipt verification code: the device's receipt code plus its fiscal global counter (gc).
znumber
The Z report date/number this invoice was rolled into.
custinvoiceno
Your invoice number, echoed back.
vfdinvoicenum
The TRA-assigned running receipt number (rctnum).
idate, itime
The invoice date and time as stored.
senttime
The time recorded with the submission.
qrpath
Server path of the generated QR image. Filled only when the device's generate_qrcode setting is on; otherwise an empty string.
qrcode_uri
The QR image as a data URI, ready to embed. Same condition as qrpath.
Success: several invoices
When the array holds more than one invoice, each result is wrapped inside invoices instead of being spread onto the top level. Each entry has the same fields as a single result.
Customer Invoice number is required when the payment type is 5.
Payments on invoice (paytype 5) need a custinvoiceno.
400
One of the items was not specified a taxcode
A line in invoiceDetails has no taxcode.
400
Unrecognized tax code 9
taxcode isn't 1–5 (for example 0, 6, non-numeric or missing). See Tax codes.
400
Duplicated invoice number INV-20260905-0001, for selected or default device
This custinvoiceno already exists on the device, whatever its send status. If you're retrying after a timeout, the first attempt was saved; see Retries and duplicates. Otherwise use a new number.
400
3 pending invoices are not submitted to TRA for more than 4 days. Please resolve before creating new invoices.
The device has invoices that haven't reached TRA for over four days, and new invoices are blocked until they're cleared. Resolve the pending invoices from the PowerVFD dashboard, then resubmit.
400
Invoice amount (TZS 500000.00) exceeds your per-invoice limit of TZS 200000.00.
The invoice total is over the per-invoice limit of the user in username. An administrator can raise the limit, or a user with a higher limit can issue the invoice.
400
Invoice date (2026-09-01) is out of sequence — invoice INV-0098 already exists for 2026-09-03. Please post missing dates in order before posting this date.
A back-dated invoice would land before one that already exists for the device. Post invoices in date order. See Dates and order.
400
custname: <detail>
The customer name contains a character on the blocklist. The message names it; remove or replace that character.
400
description: <detail>
A line description contains a blocked character. The message names it.
400
Branch or department not found
branch or department doesn't match a configured name. Check the spelling, or leave it out to use the defaults. The exact wording of this message isn't documented yet.
403
User shakil is not authorised to create invoices (per-invoice access is disabled).
The user in username isn't allowed to create invoices. An administrator needs to enable it for that user.
404
Interface: This request is not authorized to access the system, please contact system Administrator to authorize
fcode and fcodetoken don't match an authorised interface. Check both values and that the interface is still active. Returned as 404 even though it's an authorisation error.
402
Device DV03 not found
devicenumber doesn't match a device on this server. Check the number, or configure a default device.
402
Device DV03 has no license token. Please install a license.
No licence is installed for the device. Contact your administrator or Power Computers.
402
License for device DV03 is activated on a different machine. Please contact your administrator to obtain a new license for this server.
The licence is bound to another server. This server needs its own licence.
402
License for device DV03 was rejected by the license server. Please contact your administrator.
The licence server refused the licence. Contact your administrator or Power Computers.
402
License for device DV03 has expired and no renewal was found. Please contact your administrator.
The automatic renewal ran but found no renewal. The licence needs renewing.
402
License for device DV03 has expired and the renewal server is unreachable. Please contact your administrator.
The renewal couldn't reach the licence server. Check the server's internet connection; the next request will try the renewal again.
402
License for device DV03 has been revoked. Please contact your administrator.
The licence was revoked. Contact your administrator or Power Computers.
402
License for device DV03 is invalid. Please contact your administrator.
The installed licence isn't valid. Contact your administrator or Power Computers.
500
Failed to process invoice
Unexpected server-side failure, such as a lost database connection. Retry with the same custinvoiceno and back off between attempts.
No messages match. Try fewer words, or .
Validation rules
Everything the server checks before it writes an invoice. A failure returns 400 (or 403 for user permissions) and nothing is saved.
Dates and order
idate must be a strict YYYY-MM-DD date and itime a 24-hour HH:MM:SS time.
Future dates are always rejected.
Past dates are rejected unless the device's timeserver setting is lastinv.
Even with lastinv, a past date is only accepted if no later-dated invoice already exists for the device. Invoices stay in date order.
Posting historical invoices? The device's timeserver must be lastinv, and you have to submit them oldest first.
Invoice numbers
custinvoiceno is optional but recommended.
When present, it must be unique per device across every send status. A number that was already sent is rejected as a duplicate, not just pending ones.
For a TIN (type 1), custid must have exactly 9 digits once non-digit characters are removed, so 123-456-789 passes.
For NIL (type 6), custid must be omitted, blank or "null". Any other value is an error.
Lines and amounts
invoiceDetails must contain at least one line.
Every line needs a taxcode of 1–5.
qty must be numeric.
amt must be numeric, not negative and not empty. It's the VAT-inclusive line total.
discount, if sent, must be numeric.
Special characters
custname and every line's description are checked against a blocklist of disallowed characters. The check is intentionally strict and won't be relaxed. A hit returns 400 with a message that names the field and the rejected character, such as description: <detail>.
Test with real data. The blocklist isn't reproduced here. Before going live, send your actual product descriptions and customer names through a test environment so rejected characters show up early.
Cashier limits and approvals
When username is present, the invoice is checked against that user's settings:
Setting
Effect
invoice_limit_amount
The most a single invoice from this user can total.
perday_amount_limit
The most this user's invoices can total in a day.
approval_per_invoice
Approval gate applied per invoice.
approval_per_day
Approval gate applied per day.
Going over a limit returns 400. A user whose per-invoice access is disabled gets 403.
Branches and departments
If branch is omitted, the device's default branch is used; if department is omitted, the branch's default department is used. A name that doesn't match an existing branch or department returns 400.
Unique item mode
When a device has unique_item_mode on, each product can be sold once. Every line must carry a prodid, qty is capped at 1, and a product already marked sold can't be used again.
Pending invoices
If a device has invoices that haven't been submitted to TRA for more than four days, new invoices are refused until those are resolved. The message gives the count:
{ "status": "error", "message": "3 pending invoices are not submitted to TRA for more than 4 days. Please resolve before creating new invoices.", "statusCode": 400 }
Batch submission
Send several invoices in one call when they must succeed or fail together.
Shape
Put more than one object in the invoice array. Each entry is a complete invoice with its own device and customer.
The whole array is processed inside a single database transaction. If any one invoice fails validation, the entire batch is rolled back and none of it is committed. You get a single error response back.
Reading the response
A batch response wraps each result in an invoices array (see Responses). Match each result to your invoice by custinvoiceno, so always send one in a batch.
When to batch
Situation
Approach
Importing or migrating historical invoices
Batch them, oldest first, on a device whose timeserver is lastinv. The dashboard does the same for imports.
Invoices that must be issued together
Batch them. Either all are issued or none are.
Live sales at a till
One invoice per call, so a single bad invoice doesn't hold up the rest.
Retries and duplicates
custinvoiceno is what stops a retry from creating a second receipt.
A duplicate custinvoiceno is a hard 400, not a silent no-op. That makes it a reliable guard against double receipts, as long as every invoice carries a number. Don't resend a failed submission with the same number unless you're prepared for the duplicate error that tells you the first attempt actually saved.
Should I retry?
Result
Retry?
What to do
200
—
Store the receipt details.
Timeout or no response
Yes
Resend the same request with the same custinvoiceno.
500
Yes, with backoff
Same request, same custinvoiceno. Each request runs in one transaction, so the retry either succeeds or returns a duplicate error if the first attempt did commit.
400 duplicate, after a retry
No
An earlier attempt saved. Treat the invoice as issued and get its receipt details from the PowerVFD dashboard.
400 anything else
No
Fix the request. Resending it unchanged fails the same way.
402
No
Device licence problem; contact your administrator. The exception is "renewal server is unreachable", which can succeed later once the server is back online.
403 / 404
No
User permissions or interface credentials. These need an administrator.
Example: submit with retries
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
// invoice must include a custinvoiceno, or retries can create duplicates.
async function submitInvoice(invoice, attempts = 4) {
for (let attempt = 1; attempt <= attempts; attempt++) {
let res;
try {
res = await fetch("{{BASE_URL}}/service/v1/invoices", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ invoice: [invoice] }),
signal: AbortSignal.timeout(30_000),
});
} catch (err) {
// Network error or timeout: it may or may not have saved. Retry.
await sleep(2 ** attempt * 1000);
continue;
}
const data = await res.json();
if (res.ok) return { issued: true, receipt: data };
if (res.status === 400 && attempt > 1 &&
data.message.startsWith("Duplicated invoice number")) {
// An earlier attempt was saved. Look the receipt up in the dashboard.
return { issued: true, receipt: null };
}
if (res.status === 500) {
await sleep(2 ** attempt * 1000);
continue;
}
throw new Error(`${data.statusCode}: ${data.message}`);
}
throw new Error("PowerVFD did not respond after several attempts");
}
Tally integration
POST/service/v1/invoices/tally
Tally submits to its own route, which runs the same handler as /service/v1/invoices, wrapped for Tally XML integrations.
For TallyPrime licences, implementation and training, see PowerTally, Powercomputers' Tally team.
Tax codes
taxcode is the number you send. PowerVFD derives TRA's VAT category letter (A–E) from it, which is what's stored, printed and sent to TRA. You never send the letter yourself.
taxcode
Category
TRA label
Rate
How the amount is split
1
A
Standard Rate
18%
VAT-registered device: netamount = amt / 1.18, taxamount = amt − netamount. Not registered: netamount = amt, taxamount = 0.
2
B
Special Rate
0%
netamount = amt, taxamount = 0
3
C
Zero Rate
0%
netamount = amt, taxamount = 0
4
D
Special Relief
0%
netamount = amt, taxamount = 0
5
E
Exempt
0%
netamount = amt, taxamount = 0
Any other value (0, 6, non-numeric or missing) returns 400 Unrecognized tax code.
VAT registration
Code 1 is the only category where a rate is actually applied, and only when the device is VAT-registered: its vrn is set and isn't the literal NOT REGISTERED. A business that isn't registered can still sell standard-rate goods. The line stays category A, because the category describes the product, not the seller, but no VAT is collected on it.
Worked example
One line with amt: 5000.00 and taxcode: 1:
VAT-registered device
Not registered
Category
A
A
netamount
4,237.29
5,000.00
taxamount
762.71
0.00
Invoice totals
The invoice totals totaltaxexcl and totaltaxincl are the sums of netamount and of netamount + taxamount across every line, rounded to 2 decimal places.
Customer ID types
Values for custidtype.
Value
Label
Notes
1
TIN
Exactly 9 digits after non-digit characters are removed.
2
Driving Licence
3
Voters Number
4
Passport
5
NIDA
National ID.
6
NIL
Walk-in customer, no ID on file. custid must be omitted, blank or the string "null". Any other value is a validation error.
Payment types
Values for paytype.
Value
Label
Notes
1
CASH
2
CHEQUE
3
CCARD
Card payment.
4
EMONEY
Mobile money and other e-money.
5
INVOICE
custinvoiceno becomes required.
Glossary
Terms used across PowerVFD and these docs.
Term
Meaning
TRA
Tanzania Revenue Authority.
VFD
Virtual Fiscal Device. Software that signs receipts and submits them to TRA, doing the job of an EFD machine.
EFD
Electronic Fiscal Device. A physical fiscal machine at the point of sale.
TIN
Taxpayer Identification Number. 9 digits.
VRN
VAT Registration Number. A device with no VRN, or NOT REGISTERED, doesn't charge VAT.
Device
A VFD registration in PowerVFD, with its own TIN, TRA certificate, serial number and licence. Referred to by number, such as DV03.
Default device
The device used when an invoice doesn't send devicenumber.
Interface
One system authorised to submit invoices, identified by fcode and authenticated by fcodetoken.
Licence
PowerVFD's per-device licence, checked on every request and bound to the server it was activated on.
rctvcode
Receipt verification code printed on the receipt: the device's receipt code plus its global counter.
rctvnum
The full TRA verification URL for a receipt. The QR code encodes it.
vfdinvoicenum
The TRA running receipt number, also called rctnum.
Global counter (gc)
The device's running fiscal counter. Part of rctvcode.
Z report / znumber
The daily summary submitted to TRA. znumber identifies the Z report an invoice was rolled into.
timeserver / lastinv
Device setting for invoice dates. With lastinv, back-dated invoices are accepted as long as they stay in date order.
Unique item mode
Device setting where each product can be sold once. Lines need a prodid and qty of 1.