Digital Terrain Logistics Standard - Technical Guide (v31)

Download OpenAPI specification:Download



Introduction

The DTLS API is a REST API for getting documents like invoices, delivery notes scanned or uploaded.

The products used on the documents like delivery note are also can listed by the API.

Quickstart

To access the API, you will need a way to authenticate. The simplest way to do this is with an API key.

To get an API key to the sandbox server, contact us at hello@bauapp.com.

The sandbox server is a test environment where you can freely experiment with the API. It's available at https://dtlsscan.mobilengine.com/. Do not store live data on the sandbox server. The sandbox server is meant to be used while developing an API client. Data on the sandbox server is removed periodically, without notice.

After acquiring an API key, download the swagger.json file containing the API specification with the Download button at te top of this document.

You can open the swagger.json file with a number of REST client tools, like Postman or Insomnia.

You'll need to set up the base URL of the service to https://dtlsscan.mobilengine.com/ and set the authorization header to look like this:

Authorization: Bearer $ApiKey

Replace $ApiKey with your API key.

You should be able to make API requests now.

Security

The API is only accessible through HTTPS.

Access to the API is only allowed when the request contains an API key or a client certificate.

Requests without valid authentication will result in a HTTP 401: Unauthorized or a HTTP 403: Forbbidden response code. These can happen if your API key/client certificate is not known, or you don't have the rights to a resource (it belongs to another company).

There are no fine-grained access rights, a valid API key/client certificate allows clients to perform all operations through the API.

The IP addresses from where API access is allowed can be restricted, contact us for details.

API Key Authentication

The API key must be sent in the HTTP Authorization header, with the Bearer authentication scheme:

Authorization: Bearer MyApiKey123

On the live instance (https://api.bauapp.com), administering API keys is done through your company's BauApp web interface.

Api keys for the sandbox server can be requested at hello@bauapp.com.

Client Certificate Authentication

TLS client certificates can be used as an alternative to the API key authentication mechanism.

The client certificate must be a valid certificate issued by a certificate authority. The certificate must include the Client Authentication (1.3.6.1.5.5.7.3.2) OID in the Extended key usage field.

You'll need to send us the thumbprint (aka. fingerprint) of your certificate, so that we can associate it with your company.

Main use case

AI Scan documents and products retrival

  1. Get delivery note or other document data from certain timeframe
  2. Get delivery note or other document changes from certain timeframe
  3. Get document product data from certain timeframe
  4. Get document product changes data from certain timeframe
  5. Getting document pdf

API Conventions

Message format

The API consumes and produces JSON messages, with the exception of the QR code endpoint, which returns an image.

The encoding of the JSON messages must be UTF-8.

Date fields are formatted like 2020-12-31 according to OpenAPI specs. Datetime values are formatted like 2020-12-31T23:59:59Z for UTC datetimes, and 2020-12-31T23:59:59+02:00 for datetimes with an offset.

See http://spec.openapis.org/oas/v3.0.3#data-types for the specification details.

Paging

Some endpoints can potentially return a large number of objects, for example the /products endpoint.

These endpoints only return a page of objects at once. To receive the next page, call the same endpoint with a from parameter. The from parameter should contain the last identifier received in the previous endpoint request. The response for this reques will contain objects starting with (but not including) the object identified in the from parameter.

To read all objects, proceed to do this in a loop until you get an empty response.

The from field must contain the id of an existing object, otherwise a HTTP 404 error occurs.

Example: Reading all products

  1. Make a GET request to /products, let's say you receive this page (product details are omitted for the example):

    [ { id: 'p34' }, { id: 'p67' }, { id: 'p23' } ]

  2. Make a GET request with the last ID to /products?from=p23, receive this page:

    [ { id: 'p11' }, { id: 'p76' } ]

Note that the product with ID p23 is not included in this page.

  1. Make a GET request with the last ID to /products?from=p76, receive this page:

    []

  2. Since the response is an empty list you're done querying all products

String length restrictions

String length restrictions specified on fields are to be interpreted as the number of bytes in the UTF-8 encoded string, not as unicode character count.

So the length specified only applies if you don't use any multibyte characters.

HTTP version requirements

The API requires the use of HTTP/1.1, HTTP/2 and newer protocols are not supported.

If a request doesn't use HTTP/1.1, a HTTP 426 error code will be returned.

Getting notifications of document creation or status updates

It's possible to configure the DTLS API server to send an HTTP request to your servers when a document is received, modified or deleted.

When the document is recevied, these two requests are sent:

  • a POST request to {your-url}?content=document, with the body containing the delivery note JSON

The {your-url} placeholder can be configured to anything you like. Documents notifications can be filtered by document type, project or supplier. Notifications can be sent for created, updated and deleted documents, but not necessary all.

Authorization can be performed with any HTTP Authorization header or with a TLS client certificate.

If you'd like to use this feature, contact us.

API Limitations

Data retention

The production server keeps products and delivery notes indefinitely. This may change in future implementations of the API.

The data on the sandbox server is removed on a regular basis, without prior notice.

Rate limiting

Rate limiting is based on the provided API key. If too many requests are sent in a period of time the server responds with HTTP 429 messages.

Explicit rate limit values are to be determined later.

Rate limits on the sandbox server may be stricter than on the production server.

If you exceed the rate limit, a HTTP 429: Too many requests result is returned.

Request size

The request body size of create (POST) operations is limited. Currently all requests sizes are limited to 256KiB.

If you send a larger request, you'll receive a HTTP 413: Payload too large response.

Generating client code

The OpenAPI specification (the swagger.json file) can be used to generate API client code for many different programming languages.

To download the swagger.json for the API using the download button at the top of this document.

For information about how to generate clients from the specification see the OpenAPI Generator Homepage.

Authentication

ApiKey

The API key for the deliveryNoteManager must be sent in the HTTP Authorization header as such:

Authorization: Bearer MyApiKey123

Requests without an API key or with an invalid API key will result in a HTTP 401 response code.

Security Scheme Type HTTP
HTTP Authorization Scheme Bearer

Delivery Notes

Create a new delivery note

The delivery note with the specified id must not exist yet.

The API doesn't allow updating delivery notes after creation, you can just create a new note if a created note contains an error.

This API call can also create the products used on the delivery note, see the description of items.

Authorizations:
Request Body schema:
required
Array of objects (NewItem) non-empty

The products and their quantities which are listed on the delivery note.

At least one item is required.

At least one identifier from productId or name+unit must be specified for each item.

When referring to a product by it's productId, the product must already exist. When using the name+unit to reference a product, the necessary products are created automatically before the delivery note is created. For this automatic creation to work, you must name and unit in the item.

If the product already exists in the DTLS database, the values supplied in the item will not change the existing product. Multiple items can reference the same product. These references will be merged into one, and the quantity of each item will be summed up.

uuid
string or null^[0-9a-f]{32}$

A globally unique identifier for the delivery note. This field is automatically generated on creation, if not supplied. The identifier is in lowercase, and in the short format without hyphen characters.

supplierId
required
string [ 1 .. 40 ] characters

The unique identifier for the delivery note, as represented in the supplier's ERP system. The format of the note is not fixed, any identifier format can be used. The identifier doesn't need to be globally unique, it's enough that it's unique for the current user (the one identified by the API key).

issueDate
required
string <date-time> non-empty

The date and time when the delivery note was issued.

The value of this field is not verified, it can be in the far past or in the future.

orderDate
string or null <date>

The order date of the delivery note.

The value of this field is not verified, it can be in the far past or in the future.

estimatedDeliveryDate
string or null <date>

The estimated delivery date of the delivery note.

The value of this field is not verified, it can be in the far past or in the future.

required
object (Supplier)

Fields related to the issuer of the delivery note.

required
object (Customer)

Fields related to the customer.

required
object (Delivery)

Delivery address and transport information.

netWeight
string or null <= 65535 characters

Total net weight of all products. Also includes weight units in the field.

grossWeight
string or null <= 65535 characters

Total gross weight of all products. Also includes weight units in the field.

orderNumber
string or null <= 65535 characters

Additional identifier from the manufacturer’s ERP system

assignmentNumber
string or null <= 65535 characters

Additional identifier from the manufacturer’s ERP system

referenceNumber
string or null <= 65535 characters

Additional identifier from the manufacturer’s ERP system

Responses

Request samples

Content type
{
}

Response samples

Content type
application/json
{
}

List delivery notes

Returns delivery notes. The delivery notes are ordered so that the first ones are the ones that are most recently made available to be queried through the API.This way when polling for new orders, you should only need to check the first page(s).This ordering is not necessarily the same as a descending ordering by creationDate, because delivery notes created through the web UI may take longer to be visible through the API.

The endpoint uses paging, so it doesn't return all delivery notes at once.

To get the next page of notes call the endpoint with the fromUuid parameter, using the ID of the oldest (last) note that you received.

Authorizations:
query Parameters
fromUuid
string

The result will only contain items starting at (but not including) this one.

Responses

Response samples

Content type
application/json
[
]

Search delivery notes

Currently the search only supports finding delivery notes by the supplierId

The response contains all matches, no paging is used.

In rare cases there may be more than one delivery notes with the same supplierId.

For example when you're a haulier company and you have access to many companies delivery notes, and two happen to share the same supplierId.

Authorizations:
query Parameters
supplierId
required
string

The supplier's identifier of the delivery note, as supplied in the supplierId field when creating the delivery note.

Responses

Response samples

Content type
application/json
[
]

Get a delivery note by UUID

Authorizations:
path Parameters
uuid
required
string

The UUID of the delivery note.

Responses

Response samples

Content type
application/json
{
}

Get the QR code for a delivery note

Returns an image of a QR code containing a link to the delivery note.

You can include this image on your own documents, and the QR code can be scanned with the mobile app during delivery.

Try to print the QR code as large as you can. This will make scanning easier and will also protect against damage and staining. We recommend at least 4cm by 4cm.

Authorizations:
path Parameters
uuid
required
string

The uuid of the delivery note the create the QR code from.

Responses

Response samples

Content type
No sample

Get the receipt PDF for a delivery note

Download the receipt for the delivery note - a .pdf report confirming the delivery, with comments and information supplied by the recipient.

Only available after the delivery note was received, see the status field on the delivery note.

Authorizations:
path Parameters
uuid
required
string

The uuid of the delivery note.

Responses

Response samples

Content type
No sample

Documents

Get a document by UUID

Authorizations:
path Parameters
uuid
required
string

The UUID of the document.

Responses

Response samples

Content type
application/json
{
}

List documents for search criteria

The documents are in descending order of creation.The endpoint uses paging, so it doesn't return all documents at once.

To get the next page of notes call the endpoint with the fromUuid parameter, using the ID of the oldest (last) note that you uploaded.

Authorizations:
query Parameters
fromUuid
string

The result will only contain items starting at (but not including) this one.

project
string

Documents in project

supplierName
string

Documents from supplier

documentNumber
string

Documents with document (e.g. delivery note or invoice) number

orderNumber
string

Documents with order number

agreementNumber
string

Documents with agreement number

documentType
string

Documents with type, "Delivery Note" or "Invoice"

issuedFrom
string <date-time>

Documents issued from this date

issuedTo
string <date-time>

Documents issued to this date

uploadedFrom
string <date-time>

Documents uploaded from this date

uploadedTo
string <date-time>

Documents uploaded to this date

updatedFrom
string <date-time>

Documents updated from this date

updatedTo
string <date-time>

Documents updated to this date

Responses

Response samples

Content type
application/json
[
]

List document changes in a date range

Returns changed documents. Descending order of document creation.The endpoint uses paging, so it doesn't return all documents at once.

To get the next page of notes call the endpoint with the fromUuid parameter, using the ID of the oldest (last) note that you uploaded.

Authorizations:
query Parameters
fromUuid
string

The result will only contain items starting at (but not including) this one.

project
string

Documents in project

supplierName
string

Supplier name

documentType
string

Documents with type like "Delivery Note" or "Invoice"

updatedFrom
string <date-time>

Documents updated from this date

updatedTo
string <date-time>

Documents updated to this date

Responses

Response samples

Content type
application/json
[
]

Get the PDF file for a document

Download the pdf for the document.

Authorizations:
path Parameters
uuid
required
string

The uuid of the document.

Responses

Response samples

Content type
No sample

Products

Create a new product

Register a new product, so that it can later be referenced in delivery notes.

Modifying the properties of a product after creation is not supported for now.

It's strongly recommended to provide the eanCode or the manufacturerItemNumber values in the request. If these fields match an existing product, no new product will be created.

Authorizations:
Request Body schema:
name
required
string [ 1 .. 65535 ] characters

The name of the product.

unit
required
string [ 1 .. 65535 ] characters

The name of the smallest undividable unit of the product. This cannot be changed after a product is added to the DTLS database and on all delivery notes in the system the products can be listed only in this unit. E.g. a roll of electrical tape, or a can of paint.

manufacturerItemNumber
string or null <= 65535 characters
cprCategory
string (CprCategory)
Enum: "precast" "door" "membrane" "insulation" "bearing" "chimney" "gypsum" "geotextile" "curtwalling" "firefight" "sanitary" "circulation" "timber" "woodpanel" "cement" "rebar" "masonry" "sewer" "flooring" "structmetal" "wallfinish" "roof" "road" "aggregate" "adhesives" "mortar" "heating" "tank" "drinkwater" "glass" "cable" "sealant" "fixing" "prefab" "firestop" "concrete" "lighting" "services" "electrical" "pallet" "tools" "none" "other"

Responses

Request samples

Content type
{
}

Response samples

Content type
application/json
{
}

List products

List products that are registered for your company.

The products are ordered so that the first ones are the ones that are most recently made available to be queried through the API.This way when polling for new products, you should only need to check the first page(s).This ordering is not necessarily the same as a descending ordering by creationDate, because products created through the web UI may take longer to be visible through the API.

The endpoint uses paging, so it doesn't return all products at once.To get the next page of notes call the endpoint with the from parameter, using the ID of the last product that you received.

Authorizations:
query Parameters
from
string

A product id. The result will only contain items starting at (but not including) the specified one.

Responses

Response samples

Content type
application/json
[
]

Get a product by its id

Returns a single product with the specified product identifier

Authorizations:
path Parameters
id
required
string

The product's product id or product uuid

Responses

Response samples

Content type
application/json
{
}

List products with summed amount

List products that are registered for your company.

The products are ordered so that the first ones are the ones that are most recently made available to be queried through the API.This way when polling for new products, you should only need to check the first page(s).This ordering is not necessarily the same as a descending ordering by creationDate, because products created through the web UImay take longer to be visible through the API.

The endpoint uses paging, so it doesn't return all products at once.To get the next page of notes call the endpoint with the from parameter, using the ID of the last product that you received.

Authorizations:
query Parameters
from
string

A product id. The result will only contain items starting at (but not including) the specified one.

project
string

Documents in project

supplierName
string

Documents from supplier

documentType
string

Documents with type, "Delivery Note" or "Invoice"

uploadedFrom
string <date-time>

Documents uploaded from this date

uploadedTo
string <date-time>

Documents uploaded to this date

Responses

Response samples

Content type
application/json
[
]

List product changes in a date range

Returns changed products. Descendingly ordered by lastUpdated.The endpoint uses paging, so it doesn't return all products at once.

To get the next page of notes call the endpoint with the fromUuid parameter, using the ID of the oldest (last) note that you received.

Authorizations:
query Parameters
from
string

The result will only contain items starting at (but not including) this one.

updatedFrom
string <date-time>

Products updated from this date

updatedTo
string <date-time>

Products updated to this date

Responses

Response samples

Content type
application/json
[
]

Projects

List projects

Returns all project in company used by at least one document. The projects are in the order of their code.

Authorizations:

Responses

Response samples

Content type
application/json
[
]