e-bon
e-bon.ro
TypeScript SDK

client.devices

Reference for client.devices — every method with TypeScript signatures, parameters and Node examples, mirroring the /api/v1/devices REST surface.

client.devices

client.devices wraps /api/v1/devices/* — fiscal-device CRUD, live status and connection history, header/footer/VAT/operator configuration, on-device receipt printing helpers, alerts and the claim/release flow used by the E-BON mobile app. Every method returns the same plain object shape as the matching REST endpoint documented in Devices API.

All HTTP-level failures surface as EBonApiError — see Errors and the cross-referenced HTTP error catalogue at /en/api/errors.

client.devices.list(query?)

List all devices, optionally filtered by status or locationId.

async list(query?: ListDevicesQuery): Promise<Device[]>
NameTypeRequiredNotes
statusstringnoOne of online, offline, error — see DeviceStatus in @e-bon/types.
locationIdstringnoFilter to a single location.

Returns an array of Device objects.

const onlineTills = await client.devices.list({ status: 'online' });
console.log(onlineTills.map((d) => d.id));

client.devices.get(id)

Get a single device by ID.

async get(id: string): Promise<Device>
NameTypeRequiredNotes
idstringyesDevice identifier.

Returns a single Device.

const device = await client.devices.get('dev_01HZ...');

client.devices.create(body)

Register a new fiscal device.

async create(body: CreateDeviceBody): Promise<Device>
NameTypeRequiredNotes
namestringyesHuman-readable label.
protocolDeviceProtocolyesWire protocol — see @e-bon/types.
transportDeviceTransportyestcp, bluetooth, usb, etc.
connectionParamsConnectionParamsyesProtocol-specific connection details.
locationIdstringnoOptional location to assign.

Returns the created Device.

const device = await client.devices.create({
  name: 'Counter 1',
  protocol: 'datecs_dp25',
  transport: 'tcp',
  connectionParams: { host: '10.0.0.20', port: 4001 },
});

client.devices.update(id, body)

Update device properties.

async update(id: string, body: UpdateDeviceBody): Promise<Device>
NameTypeRequiredNotes
namestringnoRename the device.
connectionParamsConnectionParamsnoReplace the full connection params object.
locationIdstring | nullnoMove to a location, or null to detach.

Returns the updated Device.

await client.devices.update('dev_01HZ...', { name: 'Counter A' });

client.devices.delete(id)

Delete a device.

async delete(id: string): Promise<undefined>
NameTypeRequiredNotes
idstringyesDevice identifier.

Returns undefined on success.

await client.devices.delete('dev_01HZ...');

client.devices.getStatuses()

Get batch device statuses.

async getStatuses(): Promise<DeviceStatusesResult>

No parameters. Returns { statuses: Record<deviceId, DeviceStatusInfo> }.

const { statuses } = await client.devices.getStatuses();

client.devices.getStatus(id)

Get device connection status.

async getStatus(id: string): Promise<DeviceStatusInfo>
NameTypeRequiredNotes
idstringyesDevice identifier.

Returns a single DeviceStatusInfo.

const status = await client.devices.getStatus('dev_01HZ...');

client.devices.getConnectionHistory(id)

Get device connection history.

async getConnectionHistory(id: string): Promise<ConnectionHistoryResult>
NameTypeRequiredNotes
idstringyesDevice identifier.

Returns { events: ConnectionEvent[] } with chronological connect/disconnect entries.

const { events } = await client.devices.getConnectionHistory('dev_01HZ...');

client.devices.sendCommand(id, body)

Submit a command to a specific device.

async sendCommand(id: string, body: SendDeviceCommandBody): Promise<FiscalCommand>
NameTypeRequiredNotes
typeCommandTypeyesCommand kind — see @e-bon/types.
payloadunknownnoCommand-specific payload (shape depends on type).

Returns the created FiscalCommand record (status starts as pending). Subscribe to the events WebSocket for command.completed / command.failed.

const cmd = await client.devices.sendCommand('dev_01HZ...', {
  type: 'print_x_report',
});

client.devices.getReceipts(id, query?)

List receipts for a specific device.

async getReceipts(id: string, query?: ListDeviceReceiptsQuery): Promise<Receipt[]>
NameTypeRequiredNotes
typestringnoReceipt type filter — see ReceiptType.
startDatestringnoISO-8601 lower bound (inclusive).
endDatestringnoISO-8601 upper bound (inclusive).
limitnumbernoPage size; server caps the maximum.
startAfterstringnoCursor — pass the previous page's last receipt ID.

Returns an array of Receipt. (The SDK unwraps the { receipts } envelope.)

const recent = await client.devices.getReceipts('dev_01HZ...', { limit: 50 });

client.devices.getCashBalance(id)

Get cash balance for a device.

async getCashBalance(id: string): Promise<CashBalanceResult>
NameTypeRequiredNotes
idstringyesDevice identifier.

Returns { cashBalance, currency, deviceId, timestamp }.

const { cashBalance } = await client.devices.getCashBalance('dev_01HZ...');

client.devices.setDatetime(id, body)

Set device date/time.

async setDatetime(id: string, body: SetDatetimeBody): Promise<undefined>
NameTypeRequiredNotes
datetimestringyesISO-8601 datetime to push to the device clock.

Returns undefined on success.

await client.devices.setDatetime('dev_01HZ...', { datetime: new Date().toISOString() });

client.devices.printDuplicate(id)

Print duplicate of last receipt.

async printDuplicate(id: string): Promise<undefined>
NameTypeRequiredNotes
idstringyesDevice identifier.

Returns undefined on success.

await client.devices.printDuplicate('dev_01HZ...');

client.devices.nonFiscalReceipt(id, body)

Print a non-fiscal text receipt.

async nonFiscalReceipt(id: string, body: NonFiscalReceiptBody): Promise<undefined>
NameTypeRequiredNotes
linesstring[]yesOne entry per printed line.
headerstringnoOptional header line printed first.

Returns undefined on success.

await client.devices.nonFiscalReceipt('dev_01HZ...', {
  lines: ['Welcome', 'See you soon'],
});

client.devices.uploadLogo(id, body)

Upload logo to device.

async uploadLogo(id: string, body: UploadLogoBody): Promise<undefined>
NameTypeRequiredNotes
logostringyesBase64-encoded bitmap (driver-specific).

Returns undefined on success.

await client.devices.uploadLogo('dev_01HZ...', { logo: base64Bitmap });

client.devices.deleteLogo(id)

Delete logo from device.

async deleteLogo(id: string): Promise<undefined>
NameTypeRequiredNotes
idstringyesDevice identifier.

Returns undefined on success.

await client.devices.deleteLogo('dev_01HZ...');

client.devices.getVatRates(id)

Get VAT rates configured on a device.

async getVatRates(id: string): Promise<VatRatesResult>
NameTypeRequiredNotes
idstringyesDevice identifier.

Returns { rates: VatRate[], deviceId, timestamp }.

const { rates } = await client.devices.getVatRates('dev_01HZ...');

client.devices.getVatCapabilities(id)

Get VAT capabilities of a device.

async getVatCapabilities(id: string): Promise<VatCapabilitiesResult>
NameTypeRequiredNotes
idstringyesDevice identifier.

Returns { capabilities, deviceId, timestamp } describing what the printer firmware accepts.

const caps = await client.devices.getVatCapabilities('dev_01HZ...');

client.devices.setVatRates(id, body)

Set VAT rates on a device.

async setVatRates(id: string, body: SetVatRatesBody): Promise<undefined>
NameTypeRequiredNotes
ratesVatRate[]yesArray of { name, percentage } entries.

Returns undefined on success.

await client.devices.setVatRates('dev_01HZ...', {
  rates: [
    { name: 'A', percentage: 19 },
    { name: 'B', percentage: 9 },
  ],
});

client.devices.getHeaderFooterCapabilities(id)

Get header/footer capabilities of a device.

async getHeaderFooterCapabilities(id: string): Promise<HeaderFooterCapabilitiesResult>
NameTypeRequiredNotes
idstringyesDevice identifier.

Returns { capabilities: { maxHeaderLines, maxFooterLines, maxCharsPerLine }, deviceId, timestamp }.

const caps = await client.devices.getHeaderFooterCapabilities('dev_01HZ...');

client.devices.getHeaderFooter(id)

Get header and footer lines configured on a device.

async getHeaderFooter(id: string): Promise<HeaderFooterResult>
NameTypeRequiredNotes
idstringyesDevice identifier.

Returns { header: string[], footer: string[], deviceId, timestamp }.

const { header, footer } = await client.devices.getHeaderFooter('dev_01HZ...');

client.devices.setHeaderFooter(id, body)

Set header and footer lines on a device.

async setHeaderFooter(id: string, body: SetHeaderFooterBody): Promise<undefined>
NameTypeRequiredNotes
headerstring[]yesHeader lines (respect maxHeaderLines).
footerstring[]yesFooter lines (respect maxFooterLines).

Returns undefined on success.

await client.devices.setHeaderFooter('dev_01HZ...', {
  header: ['ACME SRL', 'CUI RO12345678'],
  footer: ['Mulțumim!'],
});

client.devices.getOperatorCapabilities(id)

Get operator capabilities for a device.

async getOperatorCapabilities(id: string): Promise<OperatorCapabilitiesResult>
NameTypeRequiredNotes
idstringyesDevice identifier.

Returns { capabilities: { maxOperators, maxNameLength, maxPasswordLength, supportsPassword }, deviceId, timestamp }.

const caps = await client.devices.getOperatorCapabilities('dev_01HZ...');

client.devices.setOperator(id, body)

Set operator name/password on a device.

async setOperator(id: string, body: SetOperatorBody): Promise<undefined>
NameTypeRequiredNotes
operatorIdnumberyesSlot index — bounded by maxOperators.
namestringyesOperator display name.
passwordstringnoRequired only when the device supportsPassword.

Returns undefined on success.

await client.devices.setOperator('dev_01HZ...', { operatorId: 1, name: 'Ana' });

client.devices.getInfo(id)

Get live device info (serial, firmware, fiscal memory, manufacturer).

async getInfo(id: string): Promise<DeviceInfoResult>
NameTypeRequiredNotes
idstringyesDevice identifier.

Returns { serialNumber, firmwareVersion, fiscalMemoryStatus, manufacturer, model? }.

const info = await client.devices.getInfo('dev_01HZ...');

client.devices.getLastReceiptInfo(id)

Get last receipt info from a device.

async getLastReceiptInfo(id: string): Promise<LastReceiptInfoResult>
NameTypeRequiredNotes
idstringyesDevice identifier.

Returns { receiptNumber, date, total, fiscalMemoryNumber?, deviceId, timestamp }.

const last = await client.devices.getLastReceiptInfo('dev_01HZ...');

client.devices.voidOpenReceipt(id)

Void an open receipt on a device.

async voidOpenReceipt(id: string): Promise<VoidOpenReceiptResult>
NameTypeRequiredNotes
idstringyesDevice identifier.

Returns { success, message, deviceId, timestamp }.

const res = await client.devices.voidOpenReceipt('dev_01HZ...');

client.devices.printReversalReceipt(id, body)

Print a reversal receipt on a device.

async printReversalReceipt(id: string, body: ReversalReceiptBody): Promise<ReversalReceiptResult>
NameTypeRequiredNotes
uniqueSaleNumberstringyesSale identifier on the original receipt.
originalReceiptNumberstringyesOriginal receipt number.
originalReceiptDateTimestringyesISO-8601 timestamp of the original receipt.
fiscalMemorySerialNumberstringyesSerial number of the original device's fiscal memory.
originalZReportNumberstringnoZ report number containing the original receipt.
reason'operator_error' | 'refund' | 'tax_base_reduction'yesLegal reason code.
itemsReversalReceiptItem[]yesItems to reverse — { name, quantity, price, vatRate }.
paymentsReversalReceiptPayment[]noOptional refund payment lines.

Returns { success, message, receiptNumber?, deviceId, timestamp }.

await client.devices.printReversalReceipt('dev_01HZ...', {
  uniqueSaleNumber: 'SALE-1042',
  originalReceiptNumber: '0001234',
  originalReceiptDateTime: '2026-04-20T11:32:00+03:00',
  fiscalMemorySerialNumber: 'DY12345678',
  reason: 'refund',
  items: [{ name: 'T-shirt', quantity: 1, price: 49.9, vatRate: 19 }],
});

client.devices.getAlerts(id, query?)

Get alerts for a specific device.

async getAlerts(id: string, query?: ListDeviceAlertsQuery): Promise<DeviceAlert[]>
NameTypeRequiredNotes
severitystringnoFilter by DeviceAlertSeverity.

Returns an array of DeviceAlert. (The SDK unwraps the { alerts } envelope.)

const alerts = await client.devices.getAlerts('dev_01HZ...', { severity: 'error' });

client.devices.getAllAlerts(query?)

Get batch alerts for all org devices.

async getAllAlerts(query?: ListDeviceAlertsQuery): Promise<BatchAlertsResult>
NameTypeRequiredNotes
severitystringnoFilter by DeviceAlertSeverity.

Returns { alerts: Record<deviceId, DeviceAlert[]> }.

const { alerts } = await client.devices.getAllAlerts();

client.devices.claim(id, body)

Claim control of a device.

async claim(id: string, body: ClaimDeviceBody): Promise<undefined>
NameTypeRequiredNotes
appInstanceIdstringyesThe mobile-app instance taking control.

Returns undefined on success.

await client.devices.claim('dev_01HZ...', { appInstanceId: 'app_inst_01HZ...' });

client.devices.release(id)

Release control of a device.

async release(id: string): Promise<undefined>
NameTypeRequiredNotes
idstringyesDevice identifier.

Returns undefined on success.

await client.devices.release('dev_01HZ...');