Get BOM

Retrieves a single bill of materials by its unique identifier. Unlike the list endpoint, this response includes a computed summary object with real-time production statistics for each BOM entry. The summary is calculated by querying serial number completion data across all contributing jobs.

Use this endpoint to display a BOM detail view with progress tracking, showing how many parts have been completed vs. how many are still outstanding for each entry.

Request

Path Parameters

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

Response

200 OK

Returns the BOM object merged with a summary field containing production statistics.

FieldTypeDescription
idstringUnique identifier for the BOM
namestringHuman-readable BOM name
entriesBomEntry[]Array of part entries
entries[].idstring | undefinedEntry ID, if assigned
entries[].bomIdstring | undefinedParent BOM ID reference
entries[].partTypestringPart type name
entries[].requiredQuantityPerBuildnumberQuantity needed per build
entries[].contributingJobIdsstring[]Job IDs that supply this part
createdAtstringISO 8601 timestamp of creation
updatedAtstringISO 8601 timestamp of last modification
summaryBomSummaryComputed production statistics
summary.bomIdstringThe BOM ID (same as top-level id)
summary.bomNamestringThe BOM name (same as top-level name)
summary.entriesBomEntrySummary[]Per-entry production statistics
summary.entries[].partTypestringPart type name
summary.entries[].requiredQuantityPerBuildnumberRequired quantity
summary.entries[].totalCompletednumberTotal completed serials across contributing jobs
summary.entries[].totalInProgressnumberTotal in-progress serials across contributing jobs
summary.entries[].totalOutstandingnumberRemaining units needed (max(0, required - completed))

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 querying the database.

ConditionMessage
Database read failure"Internal Server Error"

Examples

Request

curl http://localhost:3000/api/bom/bom_abc123

Response — BOM with summary

{
  "id": "bom_abc123",
  "name": "Widget Assembly BOM",
  "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-15T10:30:00.000Z",
  "summary": {
    "bomId": "bom_abc123",
    "bomName": "Widget Assembly BOM",
    "entries": [
      {
        "partType": "Steel Plate",
        "requiredQuantityPerBuild": 4,
        "totalCompleted": 3,
        "totalInProgress": 5,
        "totalOutstanding": 1
      },
      {
        "partType": "Bolt M8",
        "requiredQuantityPerBuild": 12,
        "totalCompleted": 12,
        "totalInProgress": 0,
        "totalOutstanding": 0
      }
    ]
  }
}

Response — BOM with no contributing job progress

{
  "id": "bom_def456",
  "name": "New Product BOM",
  "entries": [
    {
      "id": "entry_003",
      "bomId": "bom_def456",
      "partType": "Custom Bracket",
      "requiredQuantityPerBuild": 2,
      "contributingJobIds": []
    }
  ],
  "createdAt": "2024-01-20T09:00:00.000Z",
  "updatedAt": "2024-01-20T09:00:00.000Z",
  "summary": {
    "bomId": "bom_def456",
    "bomName": "New Product BOM",
    "entries": [
      {
        "partType": "Custom Bracket",
        "requiredQuantityPerBuild": 2,
        "totalCompleted": 0,
        "totalInProgress": 0,
        "totalOutstanding": 0
      }
    ]
  }
}

Notes

  • The summary field is computed in real time on every request. It is not cached or stored — it reflects the current state of serial number completion across all contributing jobs.
  • The totalOutstanding value is calculated as max(0, requiredQuantityPerBuild - totalCompleted). It will never be negative, even if more serials have been completed than required.
  • If a BOM entry has an empty contributingJobIds array, all summary values for that entry will be 0.
  • The summary counts serials across all contributing jobs for each entry. If two jobs both contribute to the same part type, their serial counts are summed.
  • Scrapped serials are excluded from totalCompleted but included in the total count used to compute totalInProgress.