API Reference

CreateBatchNumber

Create a batch number

Note: This mutation can be used only for companies who can create batch numbers.

Parameters

input - BatchNumberInput
Data of the batch number

Example

mutation {
  CreateBatchNumber(
    input: {
      label: "my batch",
      barcode: "123456789",
      expiry_date: "2024-04-24",
      variant: {
        id: 100359
      }
    }
  ) {
    id
  }
}

Returned data

{
  "data": {
    "CreateBatchNumber": {
      "id": 100367,
    }
  }
}

CreateBatchNumbers

Same as CreateBatchNumber, but you can create multiple batch numbers by passing an array of batch data

UpdateBatchNumber

Update a Batch number

Parameters

id - ID
Id of the batch number
input - BatchNumberInput
Data of the batch number

Example

mutation UpdateBatchNumber($id: ID!, $input: BatchNumberInput!) {
  UpdateBatchNumber(id: $id, input: $input) {
    id
    label
  }
}
{
  "id": 100047,
  "input": {
    "label": "batch1233"
  }
}

Returned data

{
  "data": {
    "UpdateBatchNumber": {
      "id": 100047,
      "label": "batch1233"
    }
  }
}

UpdateBatchNumbers

Same as UpdateBatchNumber, but you can update multiple batch numbers by passing an array of batch data

DeleteBatchNumber

Delete a batch number

Parameters

id - ID
Id of the batch number

Example

mutation DeleteBatchNumber($id: ID!) {
  DeleteBatchNumber(id: $id)
}
{
  "id": 100009
}

Returned data

{
  "data": {
    "DeleteBatchNumber": true
  }
}

AllocateBatchNumber

Allocate batch numbers to stock not allocated

Parameters

input - BatchNumberInput
Data of the batch number

Example

mutation AllocateBatchNumber($input: [BatchNumberStockLevelInput]!) {
  AllocateBatchNumber(input: $input) {
    id
    on_hand
    location {
      id
      label
    }
    variant {
      id
      label
    }
    batch_number {
      id
      label
      barcode
      expiry_date
    }
  }
}
{
  "input": [
    {
      "quantity": 12,
      "location": {
        "id": 100000,
        "label": "Default location"
      },
      "variant": {
        "id": 100359
      },
      "batch_number": {
        "id": -1,
        "label": "batchasicssneak1",
        "barcode": "234567",
        "expiry_date": "2024-04-26",
        "variant": {
          "id": 100359
        }
      }
    }
  ]
}

Returned data

{
  "data": {
    "AllocateBatchNumber": [
      {
        "id": 100041,
        "on_hand": 12,
        "location": {
          "id": 100000,
          "label": "Default location"
        },
        "variant": {
          "id": 100359,
          "label": "Amazing Asics Sneakers"
        },
        "batch_number": {
          "id": 100048,
          "label": "batchasicssneak1",
          "barcode": "234567",
          "expiry_date": "2024-04-26"
        }
      }
    ]
  }
}

BatchNumberInput data type

id - Int
Unique identifier of the batch number
label - String
Name of the batch
barcode - String
Barcode of the variant
expiry_date - String
expiry date of the batch
variant - VariantInput
Variant data ( variant { id: 1020012 } )