Update BOM

Updates an existing bill of materials. This endpoint supports partial updates — you can update just the name, just the entries, or both in a single request. Only the fields you include in the request body are modified; omitted fields retain their current values.

This is a simple update that does not create a version snapshot. If you need change tracking with user attribution and a change description, use the Edit BOM endpoint instead. The simple update is appropriate for corrections, typo fixes, or non-significant changes that don't warrant a version record.

When updating entries, the entire entries array is replaced. There is no mechanism to add, remove, or modify individual entries — you must provide the complete new entry list.

Request

Path Parameters

ParameterTypeRequiredDescription
idstringYesThe unique identifier of the BOM to update (e.g. "bom_abc123")

Request Body

FieldTypeRequiredDescription
namestringNoUpdated BOM name. Must be non-empty if provided. Leading and trailing whitespace is trimmed.
entriesarrayNoUpdated array of part entries. Replaces the entire existing entries array.
entries[].partTypestringYes (if entries provided)Part type name or identifier.
entries[].requiredQuantityPerBuildnumberYes (if entries provided)Quantity needed per build.
entries[].contributingJobIdsstring[]Yes (if entries provided)Job IDs that supply this part.

Response

200 OK

Returned when the BOM is successfully updated. The response contains the complete updated BOM object.

FieldTypeDescription
idstringThe BOM's unique identifier (unchanged)
namestringThe BOM name (updated or unchanged)
entriesBomEntry[]The entries (updated or unchanged)
entries[].idstring | undefinedEntry ID, if assigned
entries[].bomIdstring | undefinedParent BOM ID reference
entries[].partTypestringPart type name
entries[].requiredQuantityPerBuildnumberRequired quantity per build
entries[].contributingJobIdsstring[]Contributing job IDs
createdAtstringOriginal creation timestamp (unchanged)
updatedAtstringISO 8601 timestamp of this update

400 Bad Request

Returned when the request body fails validation.

ConditionMessage
name is provided but empty"name is required"

404 Not Found

Returned when no BOM exists with the given ID.

ConditionMessage
BOM does not exist"BOM not found: bom_abc123"

500 Internal Server Error

Returned if an unhandled error occurs while persisting the update.

ConditionMessage
Database write failure"Internal Server Error"

Examples

Request — Update name only

curl -X PUT http://localhost:3000/api/bom/bom_abc123 \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Widget Assembly BOM v2"
  }'

Response — Name updated

{
  "id": "bom_abc123",
  "name": "Widget Assembly BOM v2",
  "entries": [
    {
      "id": "entry_001",
      "bomId": "bom_abc123",
      "partType": "Steel Plate",
      "requiredQuantityPerBuild": 4,
      "contributingJobIds": ["job_001", "job_002"]
    },
    {
      "id": "entry_002",
      "bomId": "bom_abc123",
      "partType": "Bolt M8",
      "requiredQuantityPerBuild": 12,
      "contributingJobIds": ["job_003"]
    }
  ],
  "createdAt": "2024-01-15T10:30:00.000Z",
  "updatedAt": "2024-01-20T14:00:00.000Z"
}

Request — Replace entries

curl -X PUT http://localhost:3000/api/bom/bom_abc123 \
  -H "Content-Type: application/json" \
  -d '{
    "entries": [
      {
        "partType": "Steel Plate",
        "requiredQuantityPerBuild": 6,
        "contributingJobIds": ["job_001", "job_002", "job_004"]
      },
      {
        "partType": "Bolt M10",
        "requiredQuantityPerBuild": 16,
        "contributingJobIds": ["job_003"]
      }
    ]
  }'

Response — Entries replaced

{
  "id": "bom_abc123",
  "name": "Widget Assembly BOM v2",
  "entries": [
    {
      "id": "entry_005",
      "bomId": "bom_abc123",
      "partType": "Steel Plate",
      "requiredQuantityPerBuild": 6,
      "contributingJobIds": ["job_001", "job_002", "job_004"]
    },
    {
      "id": "entry_006",
      "bomId": "bom_abc123",
      "partType": "Bolt M10",
      "requiredQuantityPerBuild": 16,
      "contributingJobIds": ["job_003"]
    }
  ],
  "createdAt": "2024-01-15T10:30:00.000Z",
  "updatedAt": "2024-01-20T15:30:00.000Z"
}

Notes

  • This endpoint does not create a version snapshot. The previous state of the BOM is lost. For tracked changes, use Edit BOM instead.
  • When entries is provided, the entire entries array is replaced. Old entries are discarded and new ones take their place. There is no merge or diff.
  • The updatedAt timestamp is set to the current time on every successful update, even if the actual data did not change.
  • The createdAt timestamp is never modified.
  • The contributingJobIds array is not validated against existing jobs. You can reference job IDs that don't exist yet.
  • An empty request body {} is technically valid — it will update only the updatedAt timestamp without changing any other fields.
  • Get BOM — Retrieve the current state of a BOM with summary
  • Edit BOM — Make a versioned edit with change tracking
  • Create BOM — Create a new BOM
  • List BOM Versions — View version history (from versioned edits)