Skip to main content

Create batch serials via API

A batch serial groups several individual serial numbers under one batch (parent) serial number. Batch serials are created through the ERP API — send one batch serial together with all the serials that belong to it in a single request.

Only creating is exposed through the API. There are no API endpoints for listing, updating or deleting batch serials.

1. Authentication

All requests must be authenticated with an OAuth2 access token. Get the token by logging in with your username and password, as described in the API documentation, section OAuth2 → Login (Password Grant).

The login call returns an access_token, which you send with every request:

Authorization: Bearer <access_token>

The account you log in with needs the Create batch Serial permission (create-batch-serials). The admin and super-admin roles have it by default.

2. Endpoint

POST https://erpapi-<tenant>.dewesoft.com/v1/batch-serials

Use your own company's API host — for example https://erpapi-erp.dewesoft.com/v1/batch-serials. Required headers:

Authorization: Bearer <access_token>
Content-Type: application/json
Accept: application/json

3. Request body

The example below creates one batch serial with two serial items:

{
  "serial_number": "BATCH-0001",
  "related_serials": [
    {
      "serial_1": {
        "sn": "SN-AAA-001",
        "production_date": "2026-08-17 14:12:00"
      },
      "serial_2": {
        "sn": "SN-BBB-001",
        "production_date": "2026-08-17 14:12:00"
      }
    },
    {
      "serial_1": {
        "sn": "SN-AAA-002",
        "production_date": "2026-08-18 08:30:00"
      },
      "serial_2": {
        "sn": "SN-BBB-002",
        "production_date": "2026-08-18 08:30:00"
      }
    }
  ]
}

If an item has only one serial number, set serial_2 to null or leave it out:

{
  "serial_1": { "sn": "SN-AAA-003", "production_date": "2026-08-18 09:00:00" },
  "serial_2": null
}

4. Fields

FieldRequiredDescription serial_numberyesSerial number of the batch (parent). Must be unique — a batch serial with the same number cannot be created twice. related_serialsnoList of serial items that belong to this batch. Each entry is one item. related_serials[].serial_1.snyesFirst serial number of the item. related_serials[].serial_2.snnoSecond serial number (alias) of the same item. Use null when the item has only one serial number. production_datenoProduction date of that serial, format YYYY-MM-DD HH:MM:SS.

production_date is kept for reference on the batch serial record only — it is not written onto the individual serial.