API reference
VAT
VAT helpers: the rate for a sale, and whether a customer’s VAT number is valid. 2 operations.
Calculate VAT
POST /vat/calculate
Calculates the correct VAT rate for a sale based on the customer's country and type (B2C individual / B2B company), including OSS, reverse charge, intra-community exemption and the Portuguese territories. Does not create any invoice. Always returns the standard rate of the applicable regime (or 0% with the corresponding exemption reason); choosing reduced/intermediate rates per item category is the integrator's responsibility. Requires a plan with the Auto VAT feature.
Request body
Customer and item data for the VAT calculation
| Field | Type | Description |
|---|---|---|
clientHasVat required | boolean | Whether the customer has a VAT number (B2B). Use false for final consumers (B2C) |
clientCountry | string | Customer country code (ISO 3166-1 alpha-2) |
clientTerritory | string | Customer territory, Portugal only One of: continental, azores, madeira |
clientVatNumber | string | Customer VAT number. For PT customers use the national NIF, without the country prefix (a "PT" prefix is removed automatically); for other EU countries it is validated via VIES |
clientPostalCode | string | Customer postal code |
clientIsTIENI | boolean | Whether the individual customer is a sole trader (TI/ENI — Trabalhador Independente or Empresário em Nome Individual). Used to resolve the territory of Portuguese B2B customers with an individual's NIF |
itemType required | string | Item type One of: PRODUCT, SERVICE |
itemText | string | Item description |
invoiceCae | string | Invoice CAE (economic activity code) |
curl --request POST 'https://api.fiz.co/vat/calculate' \
--header "x-api-key: $FIZ_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"clientHasVat": false,
"itemType": "SERVICE"
}'import { Fiz } from '@fiz-co/sdk';
const fiz = new Fiz(); // reads FIZ_API_KEY
const result = await fiz.vat.calculate({
clientHasVat: false,
itemType: 'SERVICE',
});from fiz_sdk import Fiz
fiz = Fiz() # reads FIZ_API_KEY
result = fiz.vat.calculate({
"clientHasVat": False,
"itemType": "SERVICE",
})<?php
require 'vendor/autoload.php';
$fiz = new Fiz\Fiz(); // reads FIZ_API_KEY
$result = $fiz->vat->calculate([
'clientHasVat' => false,
'itemType' => 'SERVICE',
]);Response 200
VAT calculation performed successfully
| Field | Type | Description |
|---|---|---|
vat | object | VAT calculation result |
vat. | number | Applicable VAT rate (percentage). It is always the standard rate of the determined regime/territory (e.g. 23% mainland PT, 16% Azores, the customer country's standard rate under OSS) or 0 in case of exemption. Reduced and intermediate rates are not determined — if the item qualifies for a reduced rate, it is up to the integrator to select it when creating the invoice |
vat. | number · can be null | Exemption reason code (e.g. 40 = reverse charge, 16 = Art. 16), null when VAT applies |
vat. | string | Explanatory text for the applied rate/exemption |
client | object | Customer data used in the calculation |
client. | string | Customer country used in the calculation (normalized) |
client. | string · can be null | Customer territory used in the calculation. For Portuguese B2B customers it can be resolved automatically from the postal code |
client. | number · can be null | Validated-VAT-number indicator used in the calculation (0 or 1). Explains why an EU B2B sale did (or did not) get reverse charge / intra-community exemption. Mind the semantics: for EU countries (except PT) it reflects VIES validation; for PT and non-EU customers only the presence of a number; if the VIES service is unavailable, the clientHasVat value provided in the request is used |
warning | string · can be null | Warning about the calculation (if applicable) |
warningCode | string · can be null | Warning code (if applicable) |
Errors
400Invalid data401Unauthorized - API key missing or invalid402Auto VAT feature not available on the current plan - upgrade required
Verify customer VAT number
POST /vat/validate-client
Verifies a customer's VAT number. For EU countries (except PT) validation is done via VIES (with a 24-hour cache); for PT and non-EU customers only the presence of a number is checked — the returned value does not guarantee the number exists. If VIES is unavailable, the provided clientHasVat value is returned. Does not create any record.
Request body
Customer data for VAT number verification
| Field | Type | Description |
|---|---|---|
clientHasVat required | boolean | Whether the customer has a VAT number (B2B). Use false for final consumers (B2C) |
clientCountry | string | Customer country code (ISO 3166-1 alpha-2) |
clientVatNumber | string | Customer VAT number to validate. For PT customers use the national NIF, without the country prefix (a "PT" prefix is removed automatically) |
curl --request POST 'https://api.fiz.co/vat/validate-client' \
--header "x-api-key: $FIZ_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"clientHasVat": true
}'import { Fiz } from '@fiz-co/sdk';
const fiz = new Fiz(); // reads FIZ_API_KEY
const result = await fiz.vat.validateClient({
clientHasVat: true,
});from fiz_sdk import Fiz
fiz = Fiz() # reads FIZ_API_KEY
result = fiz.vat.validate_client({
"clientHasVat": True,
})<?php
require 'vendor/autoload.php';
$fiz = new Fiz\Fiz(); // reads FIZ_API_KEY
$result = $fiz->vat->validateClient([
'clientHasVat' => true,
]);Response 200
Verification performed successfully
| Field | Type | Description |
|---|---|---|
valid | boolean | Verification result. Mind the semantics: for EU countries (except PT) the number is validated via VIES; for PT and non-EU customers only the presence of a number is checked (any non-empty value returns true). If the VIES service is unavailable, the clientHasVat value provided in the request is returned |
Errors
400Invalid data401Unauthorized - API key missing or invalid
Errors
Errors share one shape: statusCode, message, code and error, with the request id in the X-Request-Id header.