Skip to main content

Audit

Query audit reports and verify fiscal chain integrity for locations. All endpoints require authentication.

Get audit report

GET /v1/locations/{id}/audit?from=YYYY-MM-DD&to=YYYY-MM-DD

Returns a comprehensive audit report for a location over the specified date range, including transaction summary, chain integrity check, event log, and available export formats.

Path parameters

ParameterTypeDescription
iduuidLocation UUID

Query parameters

ParameterTypeRequiredDescription
fromstringYesStart date (YYYY-MM-DD or RFC 3339)
tostringYesEnd date (YYYY-MM-DD or RFC 3339)
limitintegerNoItems per page (max 100, default 20)
offsetintegerNoPagination offset (max 10000, default 0)

Example

curl "https://api.zyntem.dev/v1/locations/7c9e6679-7425-40de-944b-e07fc1f90ae7/audit?from=2026-01-01&to=2026-03-31" \
-H "Authorization: Bearer zyn_test_abc123def456..."

Response 200 OK

{
"location": {
"id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"name": "Bilbao Office",
"country": "ES",
"address": "Gran Via 1",
"tax_id": "B12345674",
"status": "active",
"country_config": { "system": "ticketbai" }
},
"period": {
"from": "2026-01-01T00:00:00Z",
"to": "2026-03-31T23:59:59Z"
},
"summary": {
"total_transactions": 1500,
"total_amount": 12500000,
"total_tax": 2625000,
"sales_count": 1480,
"sales_amount": 12400000,
"cancellations_count": 20,
"cancellations_amount": 100000,
"by_status": { "success": 1490, "failed": 5, "pending": 5 }
},
"transactions": {
"data": [],
"total": 1500,
"limit": 20,
"offset": 0
},
"chain_integrity": {
"valid": true,
"total_checked": 1500,
"fiscal_id_count": 1490,
"gaps": [],
"first_fiscal_id": "TBAI-00001",
"last_fiscal_id": "TBAI-01490"
},
"event_log": [],
"export_formats": ["ticketbai-xml", "csv", "pdf"]
}

Export audit data

POST /v1/locations/{id}/audit/export

Queues an export of audit data in a country-specific format.

Request body

FieldTypeRequiredDescription
fromstringYesStart date (YYYY-MM-DD or RFC 3339)
tostringYesEnd date (YYYY-MM-DD or RFC 3339)
formatstringNoExport format (default: csv)

Available formats by country:

CountryFormats
FRjet, csv, pdf
PTsaft-pt, csv, pdf
ESticketbai-xml, csv, pdf
ITfattura-xml, csv, pdf
Otherscsv, pdf

Example

curl -X POST "https://api.zyntem.dev/v1/locations/7c9e6679-7425-40de-944b-e07fc1f90ae7/audit/export" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer zyn_test_abc123def456..." \
-d '{"from": "2026-01-01", "to": "2026-03-31", "format": "csv"}'

Response 200 OK

{
"format": "csv",
"status": "pending",
"message": "Export generation queued. Country-specific export adapters will produce the file."
}

Check chain integrity

GET /v1/locations/{id}/audit/chain-integrity?from=YYYY-MM-DD&to=YYYY-MM-DD

Verifies the fiscal ID chain integrity for a location. Checks for gaps (successful transactions without fiscal IDs) and duplicate fiscal IDs.

Query parameters

Same as Get audit report.

Example

curl "https://api.zyntem.dev/v1/locations/7c9e6679-7425-40de-944b-e07fc1f90ae7/audit/chain-integrity?from=2026-01-01&to=2026-03-31" \
-H "Authorization: Bearer zyn_test_abc123def456..."

Response 200 OK

{
"valid": true,
"total_checked": 1500,
"fiscal_id_count": 1490,
"gaps": [],
"first_fiscal_id": "TBAI-00001",
"last_fiscal_id": "TBAI-01490"
}