The Manufacturing Database API provides access to device provisioning data collected during the provisioning process. This API allows for integration with other systems and custom UIs.

# /api/v2/manufacturing

**HTTP Method:** GET

**Description:** Returns manufacturing database records in JSON format, with optional range support.

**Parameters:**

| Parameter | Type    | Required | Description                                                                               |
|-----------|---------|----------|-------------------------------------------------------------------------------------------|
| offset    | Integer | No       | Number of records to skip (default: 0)                                                    |
| limit     | Integer | No       | Maximum number of records to return. If not specified or less than 1, returns all records |

**Response Format:**

The endpoint returns a JSON array where each element represents a provisioned device with the following information:

``` json
[
  {
    "id": 1,
    "boardname": "CM5",
    "serial": "c561b701c85be8ea",
    "eth_mac": "2c:cf:67:bd:78:4f",
    "wifi_mac": "00:00:00:00:00:00",
    "bt_mac": "00:00:00:00:00:00",
    "mmc_size": 15634268160,
    "mmc_cid": "150100414a5444345206c9e4baeeba00",
    "rpi_duid": "0000911043955412",
    "board_revision": "0x0",
    "processor": "BCM2712",
    "memory": "2GB",
    "manufacturer": "Sony UK",
    "secure": "1",
    "jtag_locked": "1",
    "eeprom_write_protected": "1",
    "pubkey_programmed": "1",
    "devkey_revoked": "0",
    "signed_boot_enabled": "1",
    "os_image_filename": "raspios-2025-04-01.img",
    "os_image_sha256": "4f2d9c5b0e3b1d8a9c1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b3c",
    "connect_registered": "1",
    "connect_device_id": "device-123456",
    "customer_key_fingerprint": "a1b2c3d4e5f6789012345678901234567890abcdef1234567890abcdef123456",
    "customer_key_label": "production-2026",
    "eeprom_size": 524288,
    "eeprom_jedec": "ef4018",
    "eeprom_unique_id": "0123456789abcdef",
    "bootloader_build_timestamp": 1780326171,
    "provision_ts": "2025-04-28 13:53:28"
  },
  ...
]
```

**Field Descriptions:**

| Field                  | Description                                                                                                                                                                                                                                             |
|------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| id                     | Unique identifier in the database                                                                                                                                                                                                                       |
| boardname              | Type of Raspberry Pi board (e.g., "CM5", "RPi5")                                                                                                                                                                                                        |
| serial                 | Device serial number                                                                                                                                                                                                                                    |
| eth_mac                | Ethernet MAC address                                                                                                                                                                                                                                    |
| wifi_mac               | Wi-Fi MAC address (if applicable)                                                                                                                                                                                                                       |
| bt_mac                 | Bluetooth MAC address (if applicable)                                                                                                                                                                                                                   |
| mmc_size               | Storage size in bytes                                                                                                                                                                                                                                   |
| mmc_cid                | MMC Card ID                                                                                                                                                                                                                                             |
| rpi_duid               | Raspberry Pi Device Unique Identifier                                                                                                                                                                                                                   |
| board_revision         | Board revision code                                                                                                                                                                                                                                     |
| processor              | Processor type (e.g., "BCM2712")                                                                                                                                                                                                                        |
| memory                 | Device memory size (e.g., "2GB")                                                                                                                                                                                                                        |
| manufacturer           | Device manufacturer                                                                                                                                                                                                                                     |
| secure                 | Whether a device has been provisioned with a device unique identity                                                                                                                                                                                     |
| jtag_locked            | JTAG-lock **provisioning intent** (1=requested via `RPI_DEVICE_LOCK_JTAG`, 0=secure provisioning explicitly did not request it, null=not configured). Not currently observable from fastboot, so this records intent rather than verified device state. |
| eeprom_write_protected | EEPROM-write-protect **provisioning intent** (1=requested via `RPI_DEVICE_EEPROM_WP_SET`, 0=secure provisioning explicitly did not request it, null=not configured). Not currently observable from fastboot.                                            |
| pubkey_programmed      | Customer public key programming status (1=programmed, 0=not programmed, null=unknown). Observed via fastboot `getvar secure-otp`.                                                                                                                       |
| devkey_revoked         | Development-key revocation status (1=revoked, 0=not revoked, null=unknown). Observed via fastboot `getvar secure-devkey`.                                                                                                                               |
| signed_boot_enabled    | Signed boot enforcement status (1=enabled, 0=disabled, null=unknown). Derived from `pubkey_programmed` — firmware authenticates boot.img only when the customer pubkey hash is in OTP.                                                                  |
| os_image_filename      | OS image filename or IDP image summary used during provisioning                                                                                                                                                                                           |
| os_image_sha256        | SHA256 of the traditional OS image, or the original uploaded IDP archive hash stored in its sidecar file                                                                                                                                                  |
| connect_registered     | Raspberry Pi Connect registration result (1=registered, 0=not registered or registration failed, null=not attempted). Registration failures are non-fatal.                                                                                                |
| connect_device_id      | Raspberry Pi Connect device ID returned by the management API, when registration succeeds                                                                                                                                                                 |
| customer_key_fingerprint | SHA256 fingerprint of the active signing key from the saved-key registry at provision time                                                                                                                                                             |
| customer_key_label     | Human-readable label of the active signing key from the saved-key registry at provision time                                                                                                                                                            |
| eeprom_size            | EEPROM size in bytes, when reported by fastboot                                                                                                                                                                                                          |
| eeprom_jedec           | EEPROM JEDEC identifier, when reported by fastboot                                                                                                                                                                                                       |
| eeprom_unique_id       | EEPROM unique identifier, when reported by fastboot                                                                                                                                                                                                      |
| bootloader_build_timestamp | Bootloader build timestamp, when reported by fastboot                                                                                                                                                                                                |
| provision_ts           | Timestamp of when the device was provisioned                                                                                                                                                                                                            |

**Example Usage:**

To retrieve the first 10 provisioned devices:

``` bash
curl http://localhost:3142/api/v2/manufacturing?limit=10
```

To retrieve 20 devices after skipping the first 10:

``` bash
curl http://localhost:3142/api/v2/manufacturing?offset=10&limit=20
```

To retrieve all devices:

``` bash
curl http://localhost:3142/api/v2/manufacturing
```

**Error Responses:**

On error, the endpoint returns a JSON object with error details:

``` json
{
  "error": {
    "status": 500,
    "title": "Database Error",
    "code": "DB_ERROR",
    "detail": "Failed to retrieve manufacturing database data"
  }
}
```

**Notes:**

- This endpoint can be used for building custom dashboards or integrating with other monitoring systems.

- The data is ordered by provision timestamp in descending order (newest first).

- For large datasets, it is recommended to use pagination to improve performance.

- The database path is configured using the [RPI_SB_PROVISIONER_MANUFACTURING_DB](../config_vars.md#rpi_sb_provisioner_manufacturing_db) setting as described in the configuration documentation.
