SmartVend API Spec (1.0.0)

Download OpenAPI specification:

This is the first version of the SmartVend service API. The documentation will be continuously updated and improved, but we will maintain backward compatibility with all previously published API versions. If you have discovered any errors or inaccuracies in the documentation, please email us at support@smartvend.ru.

Authentication

In the current version of the API, authentication is implemented using the x-organization-key parameter in the request headers. You can obtain this key from the Settings -> Integration -> API section of your SmartVend account's. x-organization-key is the publicKey property from the pair of generated keys.

In the future, we will add request signing for additional security in API interactions.
If you want to get data for a specific user, pass the user ID in the x-user-id header.

apiAuth

Security Scheme Type: API Key
Header parameter name: x-organization-key

bearer

Security Scheme Type: HTTP
HTTP Authorization Scheme: bearer
Bearer format: JWT

Controller

Management and retrieval of data for a specific controller

Get controller matrix

Authorizations:
apiAuth
Request Body schema: application/json
required
controllerId
required
string <uuid>

Controller ID in UUID v4 format

Responses

Request samples

Content type
application/json
{
  • "controllerId": "5a6d4d99-405d-4cf2-9840-bd718bfab2cb"
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "result": {
    }
}

Update controller matrix

Authorizations:
apiAuth
Request Body schema: application/json
required
id
required
string <uuid>

Identifier of the controller matrix (ControllerMatrixId).

columnsNumber
required
number

Number of columns in matrix

rowsNumber
required
number

Number of rows in matrix

required
Array of objects

Products in matrix

Array
columnNumber
required
number

Column number (index) in matrix

rowNumber
required
number

Row number (index) in matrix

price
required
number

Price in cents

required
string or null

Product ID in UUID v4 format, except for the impulse controller type, where the value can be 'null'.

required
Array of objects

An array of the maximum number of ingredients from the products of the matrix

Array
resourceId
required
string <uuid>

Identifier of the product resource (ProductResourceId).

maxRefillQuantity
required
number

The maximum number of ingredient

Responses

Request samples

Content type
application/json
{
  • "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  • "columnsNumber": 0,
  • "rowsNumber": 0,
  • "products": [
    ],
  • "resources": [
    ]
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "result": {
    }
}

Send deposit to controller

Authorizations:
apiAuth
Request Body schema: application/json
required
controllerId
required
string <uuid>

Controller ID in UUID v4 format

deposit
required
number

Deposit in cents

Responses

Request samples

Content type
application/json
{
  • "controllerId": "5a6d4d99-405d-4cf2-9840-bd718bfab2cb",
  • "deposit": 0
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "result": {
    }
}

Issue product

Authorizations:
apiAuth
Request Body schema: application/json
required
controllerId
required
string
position
required
number

Responses

Request samples

Content type
application/json
{
  • "controllerId": "string",
  • "position": 0
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "result": {
    }
}

Send remote payment to controller

Authorizations:
apiAuth
Request Body schema: application/json
required
controllerId
required
string <uuid>

Controller ID in UUID v4 format

amount
required
number

Payment value in cents

terminalKey
string

Responses

Request samples

Content type
application/json
{
  • "controllerId": "5a6d4d99-405d-4cf2-9840-bd718bfab2cb",
  • "amount": 0,
  • "terminalKey": "string"
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "result": {
    }
}

Get controller config

Authorizations:
apiAuth
Request Body schema: application/json
required
controllerId
required
string <uuid>

Controller ID in UUID v4 format

Responses

Request samples

Content type
application/json
{
  • "controllerId": "5a6d4d99-405d-4cf2-9840-bd718bfab2cb"
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "result": {
    }
}

Update controller config

It is recommended to send only the modified values in the config property.

Authorizations:
apiAuth
Request Body schema: application/json
required
Any of
type
required
string
Value: "coffee"
controllerConfigId
required
string <uuid>

Config ID in UUID v4 format (!= controller id)

required
object

Coffee command config

re
boolean

Payment systems disabled, false – enabled, true – disabled

in
boolean

Inhibit, true – enabled, false – disabled

hl
boolean

Active level of inhibit signal

bp
boolean

Requirement to press button before dispensing, false – not required, true – required

qr
boolean

Show payment QR on display, false – not show, true – show

2f
boolean

Pre-authorization

2c
string

Currency code

vg
boolean

Vendista GPRS, false – Vendista uses local internet from controller, true – Vendista uses its internal SIM

vl
boolean

Vendista Low, false – 115200, true – 9600

0 (number) or 1 (number) or 2 (number)

Recipe teaching and testing mode

Any of
number (0)

Default mode

sm
number

Input pulse price for input 1 (bills) in cents

bm
number

Input pulse price for input 2 (coins) in cents

em
number

Input pulse price for input 3 (aquiring) in cents

cd
number

Deposit displayed on the machine

0 (number) or 2 (number) or 4 (number) or 6 (number) or 8 (number) or 10 (number) or 12 (number) or 14 (number) or 255 (number)

Cashless flags

Any of
number (0)

Default

qt
number

Fiscal QR-code timeout

da
boolean

Direction of the display arrow, false – Right, true – Left

2a
number

Last byte of POS IP address

2r
string

Deprecated command

0 (number) or 1 (number) or 2 (number) or 3 (number) or 4 (number) or 5 (number) or 6 (number) or 7 (number) or 8 (number) or 9 (number) or 10 (number) or 11 (number)

POS terminal type

Any of
number (0)

Disabled

2l
string

2can login

2p
string

2can password

2t
number

Payment timeout, in seconds

vt
number

Vend timeout, in seconds

vr
number

Interval in which the payment request restarts

0 (number) or 1 (number) or 2 (number) or 3 (number) or 4 (number) or 5 (number) or 6 (number) or 7 (number)

Telemetry type

Any of
number (0)

Disabled

td
string = 4 characters

Time of the daily EVA-DTS report request in HHMM format, FFFF – disabled

ti
number

Interval since the last sale to request the EVA-DTS report

tg
number

Max timeout for a forced request

0 (number) or 1 (number) or 2 (number)

Type of milk level sensor

Any of
number (0)

Disabled

fc
number

Number of cups before blocking milk beverages

wf
string

Wi-Fi module configuration

wn
string

Wi-Fi SSID

wp
string

Wi-Fi password

wt
string

Deprecated command

an
string

APN name

al
string

APN login

ap
string

APN password

sa
string

Deprecated command

sp
number

Deprecated command

0 (number) or 1 (number) or 2 (number)

MDB Master Mode

Any of
number (0)

Default. MDB coin acceptor and bill acceptor are controlled by the controller

mv
boolean

Configuration parameter for the controller - mv - MultiVend, 0 (default) - disabled, change is given after the product is dispensed, 1 - enabled.

0 (number) or 1 (number) or 2 (number) or 3 (number)

Loyalty system mode

Any of
number (0)

Disabled

0 (number) or 1 (number)

UART 2can speed

Any of
number (0)

115200

ha
string

HTTP address of loyalty server

hp
string

HTTP port of loyalty server

co
boolean

Shift PLU to PLU+1, false – do not shift, true – shift

1a
string

1-Wire reader additional byte

1l
boolean

Reader indication mode, false - disabled, true - enabled

1t
boolean

Thermal control mode, false – disabled (loyalty card reader), true – enabled (DS18B20)

1w
boolean

1-Wire reader mode, false — reader is disabled, true - reader is enabled

3a
string

POS IP address

3p
string

POS port

Responses

Request samples

Content type
application/json
{
  • "type": "impulse",
  • "controllerConfigId": "da980242-b70d-44f0-9baf-a5b2a9fd72b9",
  • "config": {
    }
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "result": {
    }
}

Get controller state

Authorizations:
apiAuth
Request Body schema: application/json
required
controllerId
required
string <uuid>

Controller ID in UUID v4 format

Responses

Request samples

Content type
application/json
{
  • "controllerId": "5a6d4d99-405d-4cf2-9840-bd718bfab2cb"
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "result": {
    }
}

Get controller connection status

Authorizations:
apiAuth
Request Body schema: application/json
required
controllerId
required
string <uuid>

Controller ID in UUID v4 format

Responses

Request samples

Content type
application/json
{
  • "controllerId": "5a6d4d99-405d-4cf2-9840-bd718bfab2cb"
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "result": {
    }
}

Reports

Requests for report retrieval

Get list of controllers

Authorizations:
apiAuth
Request Body schema: application/json
required
^(.*)$
pattern property
any

Responses

Request samples

Content type
application/json
{ }

Response samples

Content type
application/json
{
  • "id": "string",
  • "result": {
    }
}

Get list of sales

Authorizations:
apiAuth
Request Body schema: application/json
required
required
object

Pagination object

currentPage
required
number >= 1

Current page number (min 1)

perPage
required
number >= 1

Items per page (min 1, max 1000)

required
object

The time range for which the data needs to be retrieved

from
required
number

From date in UNIX timestamp format

to
required
number

To date in UNIX timestamp format

required
object

Controller filters

Array of ("cash" (string) or "electronic" (string) or "coin" (string) or "remote-deposit" (string) or "remote-payment" (string)) or "credit" (string)
Array
Any of
Any of
string ("cash")

Payment type (cash, electronic, coin, remote-deposit, remote-payment)

"all" (string) or "fiscalized" (string) or "nonFiscalized" (string)

Payment type array (cash, electronic, coin, remote-deposit, remote-payment)

Any of
string ("all")

Payment type array (cash, electronic, coin, remote-deposit, remote-payment)

controllerIds
Array of strings <uuid> [ items <uuid > ]

IDs of controllers

collaboratorIds
Array of strings <uuid> [ items <uuid > ]

IDs of controllers

"online" (string) or "offline" (string)

Controller connection status (online or offline)

Any of
string ("online")

Controller connection status (online or offline)

groupIds
Array of strings <uuid> [ items <uuid > ]

IDs of groups

searchString
string

Search by substring in the serial number or human name of a controller.

object

Sort object

required
"controllerSerialNumber" (string) or "controllerHumanName" (string) or "controllerCreatedAt" (string) or "createdAt" (string) or "insertedMoney" (string) or "totalPrice" (string) or "income" (string) or "quantity" (string)

Sort field

Any of
string ("controllerSerialNumber")

Sort field

-1 (number) or 1 (number) or "asc" (string) or "desc" (string)

Sort direction (-1 = DESC or 1 = ASC)

Any of
number (-1)

Sort direction (-1 = DESC or 1 = ASC)

Responses

Request samples

Content type
application/json
{
  • "pagination": {
    },
  • "dateRange": {
    },
  • "filters": {
    },
  • "sort": {
    }
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "result": {
    }
}

Get list of events

Authorizations:
apiAuth
Request Body schema: application/json
required
required
object

Pagination object

currentPage
required
number >= 1

Current page number (min 1)

perPage
required
number >= 1

Items per page (min 1, max 1000)

required
object
controllerIds
Array of strings <uuid> [ items <uuid > ]

IDs of controllers

collaboratorIds
Array of strings <uuid> [ items <uuid > ]

IDs of controllers

"online" (string) or "offline" (string)

Controller connection status (online or offline)

Any of
string ("online")

Controller connection status (online or offline)

groupIds
Array of strings <uuid> [ items <uuid > ]

IDs of groups

searchString
string

Search by substring in the serial number or human name of a controller.

"relevant" (string) or "irrelevant" (string)

Event status (relevant or irrelevant)

Any of
string ("relevant")

Event status (relevant or irrelevant)

"info" (string) or "warning" (string) or "danger" (string)

Event level (info, warning, danger)

Any of
string ("info")

Event level (info, warning, danger)

"user" (string) or "controller" (string)

Event source type (user or controller)

Any of
string ("user")

Event source type (user or controller)

required
object

The time range for which the data needs to be retrieved

from
required
number

From date in UNIX timestamp format

to
required
number

To date in UNIX timestamp format

Responses

Request samples

Content type
application/json
{
  • "pagination": {
    },
  • "filters": {
    },
  • "status": "relevant",
  • "level": "info",
  • "source": "user",
  • "dateRange": {
    }
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "result": {
    }
}

Get list of products

Authorizations:
apiAuth
Request Body schema: application/json
required
archive
boolean

Filter products by archived status.

Responses

Request samples

Content type
application/json
{
  • "archive": true
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "result": {
    }
}

Get dictionary of events

Authorizations:
apiAuth
Request Body schema: application/json
required
required
"en" (string) or "pt" (string) or "es" (string) or "de" (string) or "fr" (string) or "ru" (string)

Language code (en, pt, es, de, fr, ru)

Any of
string ("en")

Language code (en, pt, es, de, fr, ru)

Responses

Request samples

Content type
application/json
{
  • "language": "en"
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "result": {
    }
}

Encashment

Retrieving a list of encashments and creating an encashment

Get encashments list

Authorizations:
apiAuth
Request Body schema: application/json
required
required
object

Pagination object

currentPage
required
number >= 1

Current page number (min 1)

perPage
required
number >= 1

Items per page (min 1, max 1000)

required
object

The time range for which the data needs to be retrieved

from
required
number

From date in UNIX timestamp format

to
required
number

To date in UNIX timestamp format

required
object
controllerIds
Array of strings <uuid> [ items <uuid > ]

IDs of controllers

collaboratorIds
Array of strings <uuid> [ items <uuid > ]

IDs of controllers

"online" (string) or "offline" (string)

Controller connection status (online or offline)

Any of
string ("online")

Controller connection status (online or offline)

groupIds
Array of strings <uuid> [ items <uuid > ]

IDs of groups

searchString
string

Search by substring in the serial number or human name of a controller.

object

Sort object

required
"controllerSerialNumber" (string) or "controllerHumanName" (string) or "controllerCreatedAt" (string) or "createdAt" (string) or "insertedMoney" (string) or "totalPrice" (string) or "income" (string) or "quantity" (string)

Sort field

Any of
string ("controllerSerialNumber")

Sort field

-1 (number) or 1 (number) or "asc" (string) or "desc" (string)

Sort direction (-1 = DESC or 1 = ASC)

Any of
number (-1)

Sort direction (-1 = DESC or 1 = ASC)

Responses

Request samples

Content type
application/json
{
  • "pagination": {
    },
  • "dateRange": {
    },
  • "filters": {
    },
  • "sort": {
    }
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "result": {
    }
}

Create encashment

Authorizations:
apiAuth
Request Body schema: application/json
required
controllerId
required
string <uuid>

Controller ID in UUID v4 format

Responses

Request samples

Content type
application/json
{
  • "controllerId": "5a6d4d99-405d-4cf2-9840-bd718bfab2cb"
}

Response samples

Content type
application/json
{
  • "id": "string",
  • "result": {
    }
}

Webhooks

Description

Webhooks are a method used to automatically send real-time data from the SmartVend application to an integrated application when a specific event occurs.
When an event happens in the SmartVend application, it triggers an HTTP POST request to a predefined URL specified in the Settings -> Integration -> Webhooks section of the SmartVend application.

The retry system is as follows

Any response to a webhook with a status code of 200 is considered successful.
If, for any reason, the integrated application responds with any other status code, the SmartVend application will attempt to resend the requests after 1 minute, 5 minutes, 10 minutes, 30 minutes, 2 hours, and 5 hours.
If a response with a status code of 200 is not received after 6 attempts, the SmartVend application will stop sending webhooks.

Webhook authentication

To set up and use webhooks with signature verification in the SmartVend application, follow these steps:

Key Pair Generation

Open the SmVend application, go Settings -> Integration -> Webhooks section.
In the Webhooks section, generate an RSA key pair. This typically involves creating a public and private key that will be used for signing and verifying webhook requests.

Signature Verification

To verify the signature of incoming webhook requests, follow these steps:

  • When your application receives a webhook request, it will contain a header x-signature with the signature of the request body.
  • Sort the JSON body of the request to ensure consistent ordering. This involves recursively sorting all keys and values in the JSON object to ensure that the structure is consistent for signing and verification.
const createDeepSortedJSONString = (data: any): string => {
 if (Array.isArray(data)) {
  return JSON.stringify(data.map(item => JSON.parse(createDeepSortedJSONString(item))));
 } else if (typeof data === 'object' && data !== null) {
  const sortedData = Object.keys(data)
   .sort()
   .reduce((result: Record<string, any>, key: string) => {
          result[key] = JSON.parse(createDeepSortedJSONString(data[key]));
          return result;
   }, {});
  return JSON.stringify(sortedData);
 } else {
  return JSON.stringify(data);
 }
};
  • Use the public key to verify the signature provided in the x-signature header against the sorted JSON body. The verify method in the example is used from the crypto library for JavaScript
 const verifySignature = (body: string, signature: string, publicKey: string): boolean => {
     const publicKeyBuffer = Buffer.from(publicKeyHex, 'hex');
     return verify(
       null,
       Buffer.from(body),
       {
         key: publicKeyBuffer,
         format: 'der',
         type: 'spki',
       },
       Buffer.from(signature, 'base64')
     );
 }
 const requestBody = { /* received request body */ };
 const sortedRequestBody = createDeepSortedJSONString(requestBody);
 const signature = req.headers['x-signature']; // assuming express.js
 const isSignatureValid = verifySignature(sortedRequestBody, signature, publicKey);
 if (isSignatureValid) {
     console.log('Signature is valid');
 } else {
     console.log('Invalid signature');
 };

Event Webhook

Webhook for Event Creation Controller Event

Request Body schema: application/json
controllerId
required
string <uuid>

Controller ID in UUID v4 format

controllerHumanName
required
string

Human-readable name assigned to the controller.

controllerSerialNumber
required
string <uuid>

The serial number of the controller.

required
"coffee" (string) or "impulse" (string)

Controller type (coffee or impulse)

Any of
string ("coffee")

Controller type (coffee or impulse)

required
string or null

Controller location (address)

Any of
string

Controller location (address)

string or null

Name used for reports, if specified.

Any of
string

Name used for reports, if specified.

string or null

City of the controller's location, if specified.

Any of
string

City of the controller's location, if specified.

id
required
any <uuid>

Controller event ID in UUID v4 format

controllerTimezone
required
any

The timezone of the user.

createdAt
required
number

The timestamp (UNIX) of when the entity was created.

controllerCreatedAt
required
number

The timestamp (UNIX) of when the entity was created on the controller.

tag
required
string

Event tag (Char32).

code
required
string

Event code (Char32).

localizeKey
required
string

Localization key for the event message.

required
"user" (string) or "controller" (string)

Event source type (user or controller)

Any of
string ("user")

Event source type (user or controller)

required
"relevant" (string) or "irrelevant" (string)

Event status (relevant or irrelevant)

Any of
string ("relevant")

Event status (relevant or irrelevant)

required
"info" (string) or "warning" (string) or "danger" (string)

Event level (info, warning, danger)

Any of
string ("info")

Event level (info, warning, danger)

Responses

Request samples

Content type
application/json
{
  • "controllerId": "5a6d4d99-405d-4cf2-9840-bd718bfab2cb",
  • "controllerHumanName": "string",
  • "controllerSerialNumber": "d0c5ce0d-9dcd-4a0f-a616-b17107be115d",
  • "controllerType": "coffee",
  • "controllerLocation": "string",
  • "controllerNameForReport": "string",
  • "controllerCity": "string",
  • "id": null,
  • "controllerTimezone": "Europe/Lisbon",
  • "createdAt": 0,
  • "controllerCreatedAt": 0,
  • "tag": "string",
  • "code": "string",
  • "localizeKey": "string",
  • "source": "user",
  • "status": "relevant",
  • "level": "info"
}

Sale Webhook

Webhook for Sale Creation Event

Request Body schema: application/json
controllerId
required
string <uuid>

Controller ID in UUID v4 format

controllerHumanName
required
string

Human-readable name assigned to the controller.

controllerSerialNumber
required
string <uuid>

The serial number of the controller.

required
"coffee" (string) or "impulse" (string)

Controller type (coffee or impulse)

Any of
string ("coffee")

Controller type (coffee or impulse)

required
string or null

Controller location (address)

Any of
string

Controller location (address)

string or null

Name used for reports, if specified.

Any of
string

Name used for reports, if specified.

string or null

City of the controller's location, if specified.

Any of
string

City of the controller's location, if specified.

insertedMoney
required
string

Total inserted money (bill + coin + digital + remotePayment + remoteDeposit).

bill
required
string

Bill amount.

coin
required
string

Coin amount.

digital
required
string

Digital payment amount.

remotePayment
required
string

Remote payment amount.

remoteDeposit
required
string

Remote deposit amount.

controllerTimezone
required
any

The timezone of the user.

saleId
required
string <uuid>

Identifier of the sale (SaleId).

controllerCreatedAt
required
number

The timestamp (UNIX) of when the entity was created on the controller.

createdAt
required
number

The timestamp (UNIX) of when the entity was created.

required
(Array of "cash" (string) or "electronic" (string) or "coin" (string) or "remote-deposit" (string) or "remote-payment" (string)) or null
Any of
Array
Any of
string ("cash")

Payment type (cash, electronic, coin, remote-deposit, remote-payment)

quantity
required
number

Total quantity of products in sale

totalPrice
required
string

Total price of sale (in cents)

income
required
string

Total income of sale (in cents)

balance
required
string

Balance before sale (in cents)

change
required
string

Total change of sale (in cents)

required
Array of objects
Array
required
string or null
name
required
string

Product name

quantity
required
number

Product quantity in sale

required
string or null
number or null

Responses

Request samples

Content type
application/json
{
  • "controllerId": "5a6d4d99-405d-4cf2-9840-bd718bfab2cb",
  • "controllerHumanName": "string",
  • "controllerSerialNumber": "d0c5ce0d-9dcd-4a0f-a616-b17107be115d",
  • "controllerType": "coffee",
  • "controllerLocation": "string",
  • "controllerNameForReport": "string",
  • "controllerCity": "string",
  • "insertedMoney": "string",
  • "bill": "string",
  • "coin": "string",
  • "digital": "string",
  • "remotePayment": "string",
  • "remoteDeposit": "string",
  • "controllerTimezone": "Europe/Lisbon",
  • "saleId": "2bab4348-b09e-4b08-a600-8273f0d2907f",
  • "controllerCreatedAt": 0,
  • "createdAt": 0,
  • "paymentTypes": [
    ],
  • "quantity": 0,
  • "totalPrice": "string",
  • "income": "string",
  • "balance": "string",
  • "change": "string",
  • "products": [
    ]
}