API reference

Expenses

Purchase documents imported from e-Fatura, with their category and VAT. Read-only. 2 operations.

Expense summary

GET /expenses/stats

Counts and totals of the expenses for a year, quarter or date range: categorised and still to categorise, business and personal, refusals and conflicts with the e-Fatura portal, deductible VAT, and the date of the last e-Fatura import.

Authentication: an API key (x-api-key) or an OAuth access token.

Parameters

NameInTypeDescription
yearquerynumberFiscal year, by emission date. Required unless fromDate and toDate are given.
quarterquerynumberQuarter (1-4) of the given year. Without a quarter, the whole year.
fromDatequerystringPeriod start, inclusive (YYYY-MM-DD), instead of year and quarter. An expense counts by its accounting date (accountingDate) or, when it has none, by its emission date.
toDatequerystringPeriod end, inclusive (YYYY-MM-DD)
curl 'https://api.fiz.co/expenses/stats' \
  --header "x-api-key: $FIZ_API_KEY"
import { Fiz } from '@fiz-co/sdk';

const fiz = new Fiz(); // reads FIZ_API_KEY
const result = await fiz.expenses.stats();
from fiz_sdk import Fiz

fiz = Fiz()  # reads FIZ_API_KEY
result = fiz.expenses.stats()
<?php
require 'vendor/autoload.php';

$fiz = new Fiz\Fiz(); // reads FIZ_API_KEY
$result = $fiz->expenses->stats();

Response 200

Expense summary returned successfully

FieldTypeDescription
totalCountnumberTotal number of expenses
categorizedCountnumberCategorised expenses
uncategorizedCountnumberExpenses still to categorise
uncategorizedWithoutPortalAnswerCountnumberExpenses still to categorise with no answer on the e-Fatura portal either: the ones nobody has answered anywhere
businessCountnumberBusiness expenses
personalCountnumberPersonal expenses
syncFailedCountnumberExpenses whose categorisation the e-Fatura portal refused and the person can fix
syncLockedCountnumberRefusals in a period the portal has closed: shown, nothing can be re-sent; not part of syncFailedCount
pendingSendCountnumberCategorisations FIZ will still send to the e-Fatura portal automatically
efaturaSendPendingbooleanA send of categorisations to the e-Fatura portal is queued or running for the period year
conflictCountnumberExpenses where FIZ and the e-Fatura portal hold different answers; a person picks one in the app
portalDisagreesCountnumberExpenses deducted in a filed quarter that the e-Fatura portal now contradicts
totalAmountnumberTotal including VAT, in euros
totalVatnumberTotal VAT, in euros
businessVatDeductiblenumberDeductible VAT on business expenses, in euros
personalCategoryTotalsobject[]Totals per personal category (no IRS deduction applied)
personalCategoryTotals[].categorystringPersonal category
One of: ARTS, BOOKS, EDUCATION, ELDERLY_CARE, GYMS, HAIRDRESSER, HEALTH, HOUSING, MOTORCYCLE, MUSEUMS, NEWSPAPERS, OTHER, PUBLIC_TRANSPORT, RESTAURANT, VEHICLE_REPAIR, VETERINARY
personalCategoryTotals[].countnumberNumber of expenses
personalCategoryTotals[].amountnumberTotal including VAT, in euros
personalCategoryTotals[].vatAmountnumberVAT included in the total, in euros
lastSyncDatestring · can be nullDate of the last expense import from e-Fatura. The most recent expenses may not be in FIZ yet.

Errors

  • 400 Invalid parameters
  • 401 Unauthorized - API key missing or invalid
  • 429 The OAuth connection’s request limit is reached. Nothing was executed: repeat the same request after Retry-After seconds.

List expenses

GET /expenses

Expenses (purchase invoices) imported from e-Fatura for a year, quarter or date range, newest first, with their categorisation and deductible VAT. The period works as in GET /expenses/stats. Read-only: the e-Fatura import and categorisation happen in the FIZ app. GET /expenses/stats gives the date of the last import.

Authentication: an API key (x-api-key) or an OAuth access token.

Parameters

NameInTypeDescription
yearquerynumberFiscal year, by emission date. Required unless fromDate and toDate are given.
quarterquerynumberQuarter (1-4) of the given year. Without a quarter, the whole year.
fromDatequerystringPeriod start, inclusive (YYYY-MM-DD), instead of year and quarter. An expense counts by its accounting date (accountingDate) or, when it has none, by its emission date.
toDatequerystringPeriod end, inclusive (YYYY-MM-DD)
expenseTypequerystringFilter by expense type (business or personal)
One of: BUSINESS, PERSONAL
isCategorizedquerybooleantrue: only categorised expenses; false: only those still to categorise
syncFailedquerybooleantrue: only expenses whose categorisation the e-Fatura portal refused
searchquerystringSearch by supplier name or NIF, or document number
offsetquerynumberNumber of records to skip (offset)
limitquerynumberMaximum number of records to return (at most 500)
curl 'https://api.fiz.co/expenses' \
  --header "x-api-key: $FIZ_API_KEY"
import { Fiz } from '@fiz-co/sdk';

const fiz = new Fiz(); // reads FIZ_API_KEY
const result = await fiz.expenses.list();
from fiz_sdk import Fiz

fiz = Fiz()  # reads FIZ_API_KEY
result = fiz.expenses.list()
<?php
require 'vendor/autoload.php';

$fiz = new Fiz\Fiz(); // reads FIZ_API_KEY
$result = $fiz->expenses->list();

Response 200

Expense list returned successfully

FieldTypeDescription
[].idstringFIZ expense identifier
[].efaturaDocumentIdstringe-Fatura document identifier
[].numberstring · can be nullSupplier's document number
[].atcudstring · can be nullDocument ATCUD
[].documentTypestring · can be nulle-Fatura document type (FT, FS, FR, NC, ND)
[].datestring · can be nullEmission date (YYYY-MM-DD)
[].accountingDatestring · can be nullAccounting date (YYYY-MM-DD): the first open day when the emission's period was already closed. Null when none was assigned; the emission date then applies.
[].supplierobjectSupplier
[].supplier.nifstringSupplier NIF
[].supplier.namestringSupplier name
[].supplier.activityCodestring · can be nullSupplier's e-Fatura activity sector code
[].supplier.activitystring · can be nullSupplier's e-Fatura activity sector
[].totalnumberTotal including VAT, in euros
[].taxBasenumberTaxable base, in euros
[].vatnumberVAT, in euros
[].vatBreakdownobject[]Document VAT per rate, as reported to e-Fatura (stamp duty excluded)
[].vatBreakdown[].rateTypestringVAT rate type (NOR, INT, RED, ISE)
[].vatBreakdown[].ratenumberVAT rate (%)
[].vatBreakdown[].taxBasenumberTaxable base at this rate, in euros
[].vatBreakdown[].vatnumberVAT at this rate, in euros
[].isForeignDocumentbooleanDocument issued by a foreign supplier
[].creditNoteParentIdstring · can be nullFor credit notes: the expense (invoice) the note corrects, if confirmed
[].categorizationobjectExpense categorisation
[].categorization.isCategorizedbooleanWhether the expense is already categorised
[].categorization.sourcestring · can be nullCategorisation source: AUTO (suggested by FIZ from the supplier activity), USER (chosen by a person in FIZ) or PORTAL (the answer given on the e-Fatura portal)
One of: AUTO, USER, PORTAL
[].categorization.expenseTypestring · can be nullBusiness or personal expense
One of: BUSINESS, PERSONAL
[].categorization.businessCategorystring · can be nullBusiness category
One of: BANKING, EDUCATION, ENTERTAINMENT, EQUIPMENT, EVENTS, FACILITIES, FUEL, MARKETING, OTHER, PARKING, PROFESSIONAL, RESALE, SOFTWARE, SUPPLIES, TELECOMMUNICATIONS, TRANSPORT, TRAVEL, VEHICLE
[].categorization.personalCategorystring · can be nullPersonal category (IRS tax deduction, art. 78 CIRS)
One of: ARTS, BOOKS, EDUCATION, ELDERLY_CARE, GYMS, HAIRDRESSER, HEALTH, HOUSING, MOTORCYCLE, MUSEUMS, NEWSPAPERS, OTHER, PUBLIC_TRANSPORT, RESTAURANT, VEHICLE_REPAIR, VETERINARY
[].categorization.businessPercentagenumber · can be nullBusiness use percentage (100 = fully business)
[].categorization.catalogCategoryIdstring · can be nullBookkeeping catalogue category the person chose; businessCategory is the grouping derived from it. The value "uncategorized" is a business expense with no category chosen, which deducts no VAT.
[].vatDeductionobject · can be nullDeductible VAT computed by the VAT return engine. Null when there is nothing to deduct (not categorised, personal expense).
[].vatDeduction.deductibleVatnumberDeductible VAT in euros, business share already applied. Do not add up across expenses: the period total is in the periodic VAT return.
[].vatDeduction.ratenumber · can be nullDeduction rate (0 to 1). Null when the document splits across several rates.
[].vatDeduction.ivaFieldstring · can be nullField of table 06 of the periodic VAT return
One of: CAMPO_20, CAMPO_21, CAMPO_22, CAMPO_23, CAMPO_24, REVERSE_CHARGE_EU, REVERSE_CHARGE_NON_EU, ZERO
[].vatDeduction.restrictionCodestring · can be nullLegal rule limiting the deduction, when below 100%
One of: ART9_EXEMPT, ART20_EXEMPT_ACTIVITY, ART20_NOT_AN_INPUT, ART21_1A_VEHICLE, ART21_1B_HALF, ART21_1B_PETROL, ART21_1C_PARKING, ART21_1C_TRANSPORT, ART21_1D_HOSPITALITY, ART21_1D_REPRESENTATION, ART21_1E_ENTERTAINMENT, ART21_2DE_CONGRESS, ART21_2FG_PRICE_CAP, ART23_PRORATA, CATALOG_UNMAPPED, NO_INPUT_VAT, REGIME_ART9_EXEMPT, REGIME_ART53_EXEMPT
[].efaturaSyncobjectCategorisation reported to the e-Fatura portal
[].efaturaSync.syncedAtstring · can be nullWhen the categorisation was reported to the e-Fatura portal
[].efaturaSync.failedbooleanThe e-Fatura portal refused the categorisation
[].efaturaSync.lockedbooleanThe refusal sits in a period the portal has closed: shown, but nothing can be re-sent
[].efaturaSync.errorstring · can be nullThe e-Fatura portal's refusal message, as received
[].efaturaSync.conflictobject · can be nullFIZ and the e-Fatura portal hold different answers and it is unknown which is newer; a person picks one in the app
[].efaturaSync.conflict.sincestringSince when the conflict exists
[].efaturaSync.conflict.portalUsageTypestring · can be nullScope given on the portal (the professional-activity answer)
[].efaturaSync.conflict.portalCategorystring · can be nullCategory given on the portal
[].efaturaSync.portalDisagreesAtstring · can be nullSince when the portal contradicts an expense already deducted in a filed quarter (the portal answer was not applied)
[].createdAtstringRecord created at
[].updatedAtstringRecord last updated at

Errors

  • 400 Invalid parameters
  • 401 Unauthorized - API key missing or invalid
  • 429 The OAuth connection’s request limit is reached. Nothing was executed: repeat the same request after Retry-After seconds.

Errors

Errors share one shape: statusCode, message, code and error, with the request id in the X-Request-Id header.

All resources