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.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
year | query | number | Fiscal year, by emission date. Required unless fromDate and toDate are given. |
quarter | query | number | Quarter (1-4) of the given year. Without a quarter, the whole year. |
fromDate | query | string | Period 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. |
toDate | query | string | Period 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
| Field | Type | Description |
|---|---|---|
totalCount | number | Total number of expenses |
categorizedCount | number | Categorised expenses |
uncategorizedCount | number | Expenses still to categorise |
uncategorizedWithoutPortalAnswerCount | number | Expenses still to categorise with no answer on the e-Fatura portal either: the ones nobody has answered anywhere |
businessCount | number | Business expenses |
personalCount | number | Personal expenses |
syncFailedCount | number | Expenses whose categorisation the e-Fatura portal refused and the person can fix |
syncLockedCount | number | Refusals in a period the portal has closed: shown, nothing can be re-sent; not part of syncFailedCount |
pendingSendCount | number | Categorisations FIZ will still send to the e-Fatura portal automatically |
efaturaSendPending | boolean | A send of categorisations to the e-Fatura portal is queued or running for the period year |
conflictCount | number | Expenses where FIZ and the e-Fatura portal hold different answers; a person picks one in the app |
portalDisagreesCount | number | Expenses deducted in a filed quarter that the e-Fatura portal now contradicts |
totalAmount | number | Total including VAT, in euros |
totalVat | number | Total VAT, in euros |
businessVatDeductible | number | Deductible VAT on business expenses, in euros |
personalCategoryTotals | object[] | Totals per personal category (no IRS deduction applied) |
personalCategoryTotals[]. | string | Personal category One of: ARTS, BOOKS, EDUCATION, ELDERLY_CARE, GYMS, HAIRDRESSER, HEALTH, HOUSING, MOTORCYCLE, MUSEUMS, NEWSPAPERS, OTHER, PUBLIC_TRANSPORT, RESTAURANT, VEHICLE_REPAIR, VETERINARY |
personalCategoryTotals[]. | number | Number of expenses |
personalCategoryTotals[]. | number | Total including VAT, in euros |
personalCategoryTotals[]. | number | VAT included in the total, in euros |
lastSyncDate | string · can be null | Date of the last expense import from e-Fatura. The most recent expenses may not be in FIZ yet. |
Errors
400Invalid parameters401Unauthorized - API key missing or invalid429The 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.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
year | query | number | Fiscal year, by emission date. Required unless fromDate and toDate are given. |
quarter | query | number | Quarter (1-4) of the given year. Without a quarter, the whole year. |
fromDate | query | string | Period 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. |
toDate | query | string | Period end, inclusive (YYYY-MM-DD) |
expenseType | query | string | Filter by expense type (business or personal) One of: BUSINESS, PERSONAL |
isCategorized | query | boolean | true: only categorised expenses; false: only those still to categorise |
syncFailed | query | boolean | true: only expenses whose categorisation the e-Fatura portal refused |
search | query | string | Search by supplier name or NIF, or document number |
offset | query | number | Number of records to skip (offset) |
limit | query | number | Maximum 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
| Field | Type | Description |
|---|---|---|
[]. | string | FIZ expense identifier |
[]. | string | e-Fatura document identifier |
[]. | string · can be null | Supplier's document number |
[]. | string · can be null | Document ATCUD |
[]. | string · can be null | e-Fatura document type (FT, FS, FR, NC, ND) |
[]. | string · can be null | Emission date (YYYY-MM-DD) |
[]. | string · can be null | Accounting 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. |
[]. | object | Supplier |
[]. | string | Supplier NIF |
[]. | string | Supplier name |
[]. | string · can be null | Supplier's e-Fatura activity sector code |
[]. | string · can be null | Supplier's e-Fatura activity sector |
[]. | number | Total including VAT, in euros |
[]. | number | Taxable base, in euros |
[]. | number | VAT, in euros |
[]. | object[] | Document VAT per rate, as reported to e-Fatura (stamp duty excluded) |
[]. | string | VAT rate type (NOR, INT, RED, ISE) |
[]. | number | VAT rate (%) |
[]. | number | Taxable base at this rate, in euros |
[]. | number | VAT at this rate, in euros |
[]. | boolean | Document issued by a foreign supplier |
[]. | string · can be null | For credit notes: the expense (invoice) the note corrects, if confirmed |
[]. | object | Expense categorisation |
[]. | boolean | Whether the expense is already categorised |
[]. | string · can be null | Categorisation 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 |
[]. | string · can be null | Business or personal expense One of: BUSINESS, PERSONAL |
[]. | string · can be null | Business category One of: BANKING, EDUCATION, ENTERTAINMENT, EQUIPMENT, EVENTS, FACILITIES, FUEL, MARKETING, OTHER, PARKING, PROFESSIONAL, RESALE, SOFTWARE, SUPPLIES, TELECOMMUNICATIONS, TRANSPORT, TRAVEL, VEHICLE |
[]. | string · can be null | Personal 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 |
[]. | number · can be null | Business use percentage (100 = fully business) |
[]. | string · can be null | Bookkeeping 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. |
[]. | object · can be null | Deductible VAT computed by the VAT return engine. Null when there is nothing to deduct (not categorised, personal expense). |
[]. | number | Deductible VAT in euros, business share already applied. Do not add up across expenses: the period total is in the periodic VAT return. |
[]. | number · can be null | Deduction rate (0 to 1). Null when the document splits across several rates. |
[]. | string · can be null | Field 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 |
[]. | string · can be null | Legal 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 |
[]. | object | Categorisation reported to the e-Fatura portal |
[]. | string · can be null | When the categorisation was reported to the e-Fatura portal |
[]. | boolean | The e-Fatura portal refused the categorisation |
[]. | boolean | The refusal sits in a period the portal has closed: shown, but nothing can be re-sent |
[]. | string · can be null | The e-Fatura portal's refusal message, as received |
[]. | object · can be null | FIZ and the e-Fatura portal hold different answers and it is unknown which is newer; a person picks one in the app |
[]. | string | Since when the conflict exists |
[]. | string · can be null | Scope given on the portal (the professional-activity answer) |
[]. | string · can be null | Category given on the portal |
[]. | string · can be null | Since when the portal contradicts an expense already deducted in a filed quarter (the portal answer was not applied) |
[]. | string | Record created at |
[]. | string | Record last updated at |
Errors
400Invalid parameters401Unauthorized - API key missing or invalid429The 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.