Skip to main content

Orders API Documentation (1.0.0)

Download OpenAPI specification:Download

Public endpoints for orders, closings and closing schedules.

Note that monetary values are expressed in the subunit of the currency, so for example 150 with currency EUR would be 1 Euro and 50 cents.

Orders

Endpoints for retrieving orders.

Orders are finalized transactions or checkouts - basically the purchases made on the snabble platform.

List orders of the project

Retrieve a paginated list of orders. The list will be ordered by the entries' finalizedAt timestamp. Note that the number of orders that can be returned is limited. Exceeding the limit will result in a Forbidden response with error type too_many_records.

Authorizations:
bearerAuth
path Parameters
projectID
string
Example: test-project-faa116
query Parameters
from
string (Timestamp)
Example: from=2020-01-01T04:20:00Z

If set the response will only include orders with a date after this timestamp. This can be combined with to but not with date.

to
string (Timestamp)
Example: to=2020-01-01T04:20:00Z

If set the response will only include orders with a date before this timestamp. This can be combined with from but not with date.

date
string (Timestamp)
Example: date=2020-01-01T04:20:00Z

Date for which orders should be returned. Note that this cannot be combined with the from/to parameters. If set, only orders with a date between this timestamp and one day later are returned.

page
integer >= 1
Default: 1

Page number.

perPage
integer >= 1
Default: 1000

Number of items per page. Cannot exceed 30000.

shopID
string

If set only orders made in the shop with this ID will be included.

shop.externalID
string

If set only orders made in the shop with this external ID will be included.

Responses

Response samples

Content type
application/json
{
  • "resources": [
    ],
  • "pagination": {
    },
  • "links": {
    }
}

Get a single order

Request the order with the given ID.

Authorizations:
bearerAuth
path Parameters
projectID
string
Example: test-project-faa116
orderID
string
Example: 131d4e61-031d-436b-8666-312a27a3fb62

Responses

Response samples

Content type
application/json
{
  • "id": "131d4e61-031d-436b-8666-312a27a3fb62",
  • "project": "test-project-faa116",
  • "startedAt": "2020-01-01T04:20:00Z",
  • "finalizedAt": "2020-01-01T04:20:00Z",
  • "date": "2020-01-01T04:20:00Z",
  • "createdAt": "2020-01-01T04:20:00Z",
  • "appUserID": "ffba8c9c-cf48-11ee-aa21-779116e37ea5",
  • "clientID": "98ce3d10-cf45-11ee-8b11-33b24afeadc3",
  • "checkoutDeviceID": "98ce3d10-cf45-11ee-8b11-33b24afeadc3",
  • "checkoutDevice": {
    },
  • "shopID": 128,
  • "shop": {
    },
  • "customer": {
    },
  • "paymentCardType": "girocard",
  • "paymentMethod": "cash",
  • "paymentInformation": { },
  • "paymentResult": { },
  • "paymentState": "successful",
  • "paidAmount": 975,
  • "lineItems": [
    ],
  • "currency": "EUR",
  • "price": {
    },
  • "session": "string",
  • "fiscalReference": {
    },
  • "links": {
    }
}

Closings

Endpoints for retrieving closings.

Closings are reports for accounting and record all orders after the last closing. They are created according to closing schedules. A closing contains a set of orders made in one shop.

List closings

Authorizations:
bearerAuth
path Parameters
projectID
string
Example: test-project-faa116
query Parameters
page
integer >= 1
Default: 1

Page number.

perPage
integer >= 1
Default: 1000

Number of items per page. Cannot exceed 30000.

Responses

Response samples

Content type
application/json
{
  • "closings": [
    ],
  • "pagination": {
    },
  • "links": {
    }
}

Get a single closing

Authorizations:
bearerAuth
path Parameters
projectID
string
Example: test-project-faa116
shopID
string
Example: 128
seqNum
string

Responses

Response samples

Content type
application/json
{
  • "project": "test-project-faa116",
  • "shopID": 128,
  • "sequenceNumber": 1234,
  • "createdAt": "2020-01-01T04:20:00Z",
  • "currency": "EUR",
  • "lastOrderSequenceNumber": 1234,
  • "shop": {
    },
  • "taxShares": [
    ],
  • "shareByPaymentMethod": [
    ],
  • "total": 420,
  • "taxNumber": "taxNumber",
  • "vatID": "taxID",
  • "companyName": "snabble",
  • "companyAdress": {
    },
  • "orders": [
    ],
  • "logs": [
    ],
  • "links": {
    }
}

Get a single log file for a closing.

Authorizations:
bearerAuth
path Parameters
projectID
string
Example: test-project-faa116
logID
string

Responses

Response samples

Content type
application/json
{
  • "type": [
    ],
  • "message": [
    ]
}

Schedules

Endpoints for creating, updating and removing closing schedules. Closing schedules are intervals at which orders are aggregated into log files for reporting and exporting out of the snabble platform.

This typically takes place at the time when conventionally cash registers are closed for the day, but it can also occur more frequently. If no cash has to be counted at the time of closing, the period length becomes somewhat arbitrary, but it must occur at least once per day.

Get the list of schedules of the project

Authorizations:
bearerAuth
path Parameters
projectID
string
Example: test-project-faa116

Responses

Response samples

Content type
application/json
{
  • "schedules": [
    ],
  • "links": {
    }
}

Create a new schedule

Authorizations:
bearerAuth
path Parameters
projectID
string
Example: test-project-faa116
Request Body schema: application/json
shop
required
string

Internal shop ID where the closing was made.

mode
string
Enum: "includeUntilExecution" "includeUntilScheduled"

Whether to include orders until the time of the closing schedule, or the time of closing execution. The latter may be some seconds later.

days
required
Array of strings
Items Enum: "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday" "Sunday"

On what days of the week should closings be made.

hour
integer [ 0 .. 24 ]

What hour of the day should the closing be made.

minute
integer [ 0 .. 59 ]

What minute of the hour should the closing be made.

location
required
string

IANA Timezone Database name of the location used

includeAllStates
boolean

Whether non-final (i.e. failed) orders should be included in the closing. Default behavior is not to include them, but in most cases this makes sense for bookkeeping purposes.

formats
Array of strings

A list of formats in which the log should be generated for each closing.

appendBatchEvery
string

How often a batch closing should be made. See https://pkg.go.dev/time#ParseDuration for an explanation of the format.

batchFormats
Array of strings

A list of batch formats in which the log should be generated. Contact snabble for more information on what formats are available.

Responses

Request samples

Content type
application/json
{
  • "shop": 1234,
  • "mode": "includeUntilExecution",
  • "days": [
    ],
  • "hour": 16,
  • "minute": 20,
  • "location": "UTC",
  • "includeAllStates": true,
  • "formats": [
    ],
  • "appendBatchEvery": "1h0m0s",
  • "batchFormats": [
    ]
}

Response samples

Content type
application/json
{
  • "type": [
    ],
  • "message": [
    ]
}

Get a single schedule

Authorizations:
bearerAuth
path Parameters
projectID
string
Example: test-project-faa116
scheduleID
integer
Example: 420

Responses

Response samples

Content type
application/json
{
  • "id": 420,
  • "project": "test-project-faa116",
  • "shop": 1234,
  • "mode": "includeUntilExecution",
  • "days": [
    ],
  • "hour": 16,
  • "minute": 20,
  • "location": "UTC",
  • "includeAllStates": true,
  • "formats": [
    ],
  • "appendBatchEvery": "1h0m0s",
  • "batchFormats": [
    ]
}

Update a schedule

Authorizations:
bearerAuth
path Parameters
projectID
string
Example: test-project-faa116
scheduleID
integer
Example: 420
Request Body schema: application/json
shop
required
string

Internal shop ID where the closing was made.

mode
string
Enum: "includeUntilExecution" "includeUntilScheduled"

Whether to include orders until the time of the closing schedule, or the time of closing execution. The latter may be some seconds later.

days
required
Array of strings
Items Enum: "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday" "Sunday"

On what days of the week should closings be made.

hour
integer [ 0 .. 24 ]

What hour of the day should the closing be made.

minute
integer [ 0 .. 59 ]

What minute of the hour should the closing be made.

location
required
string

IANA Timezone Database name of the location used

includeAllStates
boolean

Whether non-final (i.e. failed) orders should be included in the closing. Default behavior is not to include them, but in most cases this makes sense for bookkeeping purposes.

formats
Array of strings

A list of formats in which the log should be generated for each closing.

appendBatchEvery
string

How often a batch closing should be made. See https://pkg.go.dev/time#ParseDuration for an explanation of the format.

batchFormats
Array of strings

A list of batch formats in which the log should be generated. Contact snabble for more information on what formats are available.

Responses

Request samples

Content type
application/json
{
  • "shop": 1234,
  • "mode": "includeUntilExecution",
  • "days": [
    ],
  • "hour": 16,
  • "minute": 20,
  • "location": "UTC",
  • "includeAllStates": true,
  • "formats": [
    ],
  • "appendBatchEvery": "1h0m0s",
  • "batchFormats": [
    ]
}

Response samples

Content type
application/json
{
  • "type": [
    ],
  • "message": [
    ]
}

Delete a schedule

Authorizations:
bearerAuth
path Parameters
projectID
string
Example: test-project-faa116
scheduleID
integer
Example: 420

Responses

Response samples

Content type
application/json
{
  • "type": [
    ],
  • "message": [
    ]
}